Articles on: API Reference

Segmind Storage

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-asset


Headers


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['urls'][0]
print(f"Asset uploaded successfully: {asset_url}")


const axios = require('axios');
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' };
try { const response = await axios.post(url, data, { headers }); const assetUrl = response.data.urls[0]; console.log(`Asset uploaded successfully: ${assetUrl}`); } catch (error) { console.error('Error:', error.response ? error.response.data : error.message); }
})();


Response


The API returns a JSON response containing the URLs of the uploaded assets:


{
"urls": [ "https://storage.segmind.com/assets/..." ]
}


These URLs can then be used as inputs for various models on the Segmind platform.


Use Cases


  1. Reusable Image Inputs: Upload an image once and use the URL across multiple model runs
  2. Batch Processing: Upload multiple images and process them with different models
  3. Workflow Integration: Use uploaded assets in PixelFlow workflows
  4. 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


Rate Limits


Asset uploads are subject to the standard Segmind API rate limits. Refer to the Rate Limits documentation for more information.

Updated on: 29/10/2025

Was this article helpful?

Share your feedback

Cancel

Thank you!