Worlds
Prepare Media Asset Upload
Creates a World Labs media asset upload target
Create a World Labs media asset record and receive an upload URL for an image or video. Upload the binary file to upload_info.upload_url, then reference the returned media_asset.media_asset_id from world_prompt with source: "media_asset".
The asset is available only in the Workspace that created it.
Request Body
Original file name, up to 64 characters.
Media type: image or video.
Optional extension such as png, jpg, or mp4.
Custom metadata stored with the asset.
Response
Prepared World Labs media asset metadata.
Signed URL for uploading the file.
HTTP method to use when uploading the binary file to upload_info.upload_url, when returned.
Headers to include with the binary upload, when returned.
Request
curl -X POST "https://api.tokenlab.sh/v1/worlds/media-assets/prepare-upload" \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"file_name": "reference.png",
"kind": "image",
"extension": "png"
}'{ "media_asset": { "created_at": "2019-08-24T14:15:22Z", "file_name": "string", "kind": "image", "media_asset_id": "string", "extension": "string", "metadata": {}, "updated_at": "2019-08-24T14:15:22Z" }, "upload_info": { "upload_method": "string", "upload_url": "http://example.com", "curl_example": "string", "required_headers": { "property1": "string", "property2": "string" } }}Authorization
BearerAuth API Key authentication. Create or manage API keys in Dashboard > API > API Keys.
In: header
Request Body
application/json
Response
application/json
application/json