Media assets
Prepare media asset upload
Prepare a media asset upload for use in world generation.
This API endpoint creates a media asset record and returns a signed upload URL. Use this workflow to upload images or videos that you want to reference in world generation requests.
Workflow
- Prepare Upload (this endpoint): Get a
media_asset_idandupload_url - Upload File: Use the signed URL to upload your file
- Generate World: Reference the
media_asset_idin/worlds:generatewith source type “media_asset”
Request Parameters
file_name: Your file’s name (e.g., “landscape.jpg”)extension: File extension without dot (e.g., “jpg”, “png”, “mp4”)kind: Either “image” or “video”metadata: Optional custom metadata object
Response
Returns a MediaAssetPrepareUploadResponse containing:
media_asset: Object withmedia_asset_id(use this in world generation)upload_info: Object withupload_url,required_headers, andcurl_example
Uploading Your File
Use the returned upload_url and required_headers to upload your file:
curl --request PUT \
--url <upload_url> \
--header "Content-Type: <content-type>" \
--header "<header-name>: <header-value>" \
--upload-file /path/to/your/file
Replace:
<upload_url>: Theupload_urlfrom the response<content-type>: MIME type (e.g.,image/png,image/jpeg,video/mp4)<header-name>: <header-value>: Each header fromrequired_headers/path/to/your/file: Path to your local file
Example Usage in World Generation
After uploading, use the media_asset_id in a world generation request:
{
"world_prompt": {
"type": "image",
"image_prompt": {
"source": "media_asset",
"media_asset_id": "<your-media-asset-id>"
}
}
}
POST
Prepare a media asset upload
Authorizations
API key for authentication. Get your key from the developer portal.
Body
application/json
Request to prepare a media asset upload.
Previous
Get media assetGet a media asset by ID.
Retrieves metadata for a previously created media asset.
Args:
media_asset_id: The media asset identifier.
Returns:
MediaAsset object with media_asset_id, file_name, extension, kind,
metadata, created_at, and updated_at.
Raises:
HTTPException: 404 if not found
Next
Prepare a media asset upload