Segmind Storage
Upload files to Segmind Storage and get a reusable URL to pass as an image input to any model, instead of re-uploading the same file.
Segmind Storage allows you to upload files as assets and get URLs that can be used with other models. This is particularly useful when you need to provide image inputs to various AI models without repeatedly uploading the same file.
Upload Asset API
Upload files to Segmind Storage and receive a URL that can be used across different models.
Endpoint
POST https://workflows-api.segmind.com/upload-assetHeaders
| Header | Value | Required | Description |
|---|---|---|---|
accept | application/json, text/plain, */* | Yes | Accepted response types |
x-api-key | SG_XXX | Yes | Your Segmind API key |
content-type | application/json | Yes | Request content type |
Request Body
The request body should be a JSON object with the following structure:
{
"data_urls": ["data:image/jpeg;base64,..."]
}| Field | Type | Description |
|---|---|---|
data_urls | Array of strings | Array of base64-encoded data URLs for the files to upload |
Data URL Format
Files should be provided as base64-encoded data URLs in the format:
data:<mime-type>;base64,<base64-encoded-content>Supported formats include:
- Images:
data:image/jpeg;base64,,data:image/png;base64,,data:image/webp;base64, - Other file types as supported by the models you intend to use
Code Examples
Upload files to Segmind Storage using your preferred programming language.
curl 'https://workflows-api.segmind.com/upload-asset' \
-H 'accept: application/json, text/plain, */*' \
-H 'x-api-key: SG_YOUR_API_KEY_HERE' \
-H 'content-type: application/json' \
--data-raw '{"data_urls":["data:image/jpeg;base64,/9j/4AAQSkZJRg..."]}'import requests
import base64
api_key = "SG_YOUR_API_KEY_HERE"
url = "https://workflows-api.segmind.com/upload-asset"
# Read and encode your image file
with open("image.jpg", "rb") as image_file:
encoded_string = base64.b64encode(image_file.read()).decode('utf-8')
data_url = f"data:image/jpeg;base64,{encoded_string}"
data = {
"data_urls": [data_url]
}
headers = {
'x-api-key': api_key,
'accept': 'application/json, text/plain, */*',
'content-type': 'application/json'
}
response = requests.post(url, json=data, headers=headers)
result = response.json()
# Get the uploaded asset URL
asset_url = result['file_urls'][0]
print(f"Asset uploaded successfully: {asset_url}")const fs = require('fs');
const api_key = "SG_YOUR_API_KEY_HERE";
const url = "https://workflows-api.segmind.com/upload-asset";
// Read and encode your image file
const imageBuffer = fs.readFileSync('image.jpg');
const base64String = imageBuffer.toString('base64');
const dataUrl = `data:image/jpeg;base64,${base64String}`;
(async () => {
const data = {
data_urls: [dataUrl]
};
const headers = {
'x-api-key': api_key,
'accept': 'application/json, text/plain, */*',
'content-type': 'application/json'
};
const response = await fetch(url, {
method: 'POST',
headers,
body: JSON.stringify(data),
});
if (!response.ok) throw new Error(`${response.status} ${await response.text()}`);
const result = await response.json();
console.log(`Asset uploaded successfully: ${result.file_urls[0]}`);
})();Response
{
"file_urls": [
"https://images.segmind.com/assets/you@example.com/images/fb61f8b1-731e-42fd-988e-675965942a8d.jpg"
],
"message": "Files uploaded successfully"
}| Field | Description |
|---|---|
file_urls | One URL per entry in data_urls, in the same order |
message | A human-readable status string |
These URLs can then be used as inputs for various models on the Segmind platform — pass one wherever a model takes an image URL.
An asset URL is public, and it identifies your account. It needs no API key — anything holding the link can fetch the file — and the path contains the email address of the account that uploaded it. That is fine for passing to a model or your own frontend; think twice before putting one somewhere public.
Use Cases
- Reusable Image Inputs: Upload an image once and use the URL across multiple model runs
- Batch Processing: Upload multiple images and process them with different models
- Workflow Integration: Use uploaded assets in PixelFlow workflows
- Model Chaining: Pass asset URLs between different models in a pipeline
Best Practices
- Store the returned URLs for reuse to avoid uploading the same file multiple times
- Ensure your base64 encoding is correct to prevent upload failures
- Use appropriate MIME types in your data URLs for proper file handling
- Keep your API key secure and never expose it in client-side code
Limits
There is no small file-size cap to design around — uploads well into the tens of megabytes go through fine.
Two things do bite:
The request is JSON, so base64 inflates it by about a third. A 50 MB file becomes roughly a 67 MB request body. Budget for that in any client timeout.
The ceiling is total pixel count, not file size and not any single dimension. A 5 MB image was rejected while a 53 MB one went through, and a very wide but short image is unaffected — 16,000 × 800 is only 12.8 megapixels and uploads without trouble.
Narrowing it by bisection, the limit sits between these two:
| Image | Pixels | Result |
|---|---|---|
| 13,300 × 13,300 | 176.9 MP | uploads |
| 13,400 × 13,400 | 179.6 MP | rejected |
So anything under roughly 175 megapixels is safe, and there is no practical reason to send an image that large to a model in the first place.
An image over that ceiling comes back as a generic validation error, not a size error:
{ "error": "No valid files or data URLs provided" }Nothing in that message points at dimensions. If a data URL you are confident is well formed keeps getting rejected, check the image's pixel count before you go looking for an encoding bug.
Rate Limits
Asset uploads are subject to the standard Segmind API rate limits. Refer to the Rate Limits documentation for more information.
Logging
What Segmind logs for usage and billing, the data we never store, and how long files are held temporarily during model fine-tuning.
Dedicated Endpoints
Endpoints are GPU instances enabling AI models to be deployed on dedicated hardware . This enables private inferences that automatically scale up or down based on traffic.