sangtao.ai
API key

User Assets

Create upload link

Step 1 of uploading an asset: get a link to upload the file to, and the fileKey to confirm it with.

POSThttps://api.sangtao.ai/v2/user-assets/presign

Authorization

  • X-Api-Keystring · headerrequired

    Your API key, from the API keys page of your account.

Upload and manage user media assets (videos, images, audio). Assets are used as intro/outro videos, logos, watermarks, background music, voiceovers, and thumbnails in video creation.

Files here are kept until you delete them, within each category's limits. Only need an image as a reference for the next image you create? Upload a reference image (temporary, deleted after 1 day).

Body

  • fileNamestringrequired

    Original file name (e.g. "logo.png")

  • contentTypestringrequired

    MIME type (e.g. "image/png", "video/mp4")

Response

  • uploadUrlstring

    Where to send the file (step 2). Write access to this one file only; no X-Api-Key needed

  • methodstring

    The method for that request: "PUT"

  • headersobject

    Send exactly these headers with the file (Content-Type, and x-ms-blob-type when it is there) — read them from here, do not write them in your code

  • urlstring

    Where the file can be read once uploaded

  • fileKeystring

    The file's key — send it to confirm (step 3)

  • expiresInnumber

    Seconds until uploadUrl stops working (600). Use this one.

  • expiresAtstring

    The same moment as a UTC time (ISO 8601) — kept for compatibility.

  • categorystring

    Category worked out from contentType

    Available options:videoimageaudiodocument

  • maxSizeBytesnumber

    Largest file allowed for this category, in bytes

  • allowedContentTypesstring[]

    MIME types this category takes

Errors

StatuserrorCodeWhen
400UNSUPPORTED_FILE_TYPEThe content type is not allowed for this category (see Category Limits)
429QUOTA_EXCEEDEDThe category's file count or storage cap is reached
500UPLOAD_FAILEDThe upload link could not be created (storage error) — try again

Upload Flow

text
1. POST /user-assets/presign  →  uploadUrl, method, headers, fileKey
2. PUT  uploadUrl (the file)  →  with exactly those headers
3. POST /user-assets/confirm  →  fileKey: the file becomes an asset
The presign response includes category, maxSizeBytes, and allowedContentTypes — use these for client-side validation before uploading.

Step 2: Upload the file

Send the file to uploadUrl with the method and exactly the headers the presign response gives. Then confirm it with fileKey — until then it is not an asset.

bash
curl -X PUT "UPLOAD_URL" \
  -H "Content-Type: image/png" \
  -H "x-ms-blob-type: BlockBlob" \
  --data-binary @my-logo.png

Purpose Values

PurposeUsed for
outro_videoAppended at end of rendered videos
intro_videoPrepended at start of rendered videos
logoOverlay logo on video during render
watermarkWatermark overlay in render pipeline
background_musicCustom background music for all video types
voiceoverUser-uploaded voice file (replaces TTS)
thumbnailCustom thumbnail for published jobs
generalGeneral reference files

Category Limits

CategoryContent TypesMax SizeMax Items
videovideo/mp4, video/webm500 MB20
imageimage/png, jpeg, webp, svg+xml, gif50 MB100
audioaudio/mpeg, wav, ogg, aac100 MB30
documentapplication/pdf, text/csv, application/json50 MB20

Next, once the file is uploaded: Confirm upload registers it as an asset.

POST/user-assets/presign
curl -X POST "https://api.sangtao.ai/v2/user-assets/presign" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "fileName": "my-logo.png",
    "contentType": "image/png"
  }'
{
  "success": true,
  "data": {
    "uploadUrl": "https://…/user-assets/1e65….png?sv=…&sig=…",
    "method": "PUT",
    "headers": {
      "Content-Type": "image/png",
      "x-ms-blob-type": "BlockBlob"
    },
    "url": "https://cdn.sangtao.ai/user-assets/1e65….png",
    "fileKey": "d15ed…/user-assets/1e65….png",
    "expiresIn": 600,
    "expiresAt": "2026-06-08T12:30:00Z",
    "category": "image",
    "maxSizeBytes": 52428800,
    "allowedContentTypes": [
      "image/png",
      "image/jpeg",
      "image/webp",
      "image/svg+xml",
      "image/gif"
    ]
  }
}