Skip to main content

Video Upload

Video Upload API

AntCDN supports two upload workflows:

  • Direct upload (recommended): request upload URLs, then send bytes directly to storage. Uploads can be resumed after interruptions.
  • Upload from URL: give AntCDN an HTTPS URL and we fetch it server-side.

All upload requests use the API base https://api.antcdn.net/v1 and require X-Api-Key.

1) Request upload URL

/videos/upload-url

Example request:

Terminal window
curl -X POST "https://api.antcdn.net/v1/videos/upload-url" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"fileName": "demo.mp4",
"allowPublicAccess": true,
"videoQuality": "high"
}'

Example response:

{
"body": {
"assetId": "vid_XXX",
"resumableUploadURL": "https://storage.googleapis.com/upload/storage/v1/b/...&upload_id=...",
"signedURL": "https://<storage-provider>/<path>?<signature>",
"contentType": "video/mp4",
"bucketPath": "<internal-bucket-path>",
"expiresAt": 1640995200
}
}

Both URLs are valid for one week, until expiresAt.

2) Upload bytes

For large files, send the file in chunks to resumableUploadURL. An interrupted upload continues from the last byte stored. See Uploading With a Pre-Signed URL for the protocol and examples in Python, Go and JavaScript.

For small files, a single PUT to signedURL is enough. It must send Content-Type equal to contentType from the response:

Terminal window
curl -X PUT "SIGNED_URL_FROM_STEP_1" -H "Content-Type: CONTENT_TYPE_FROM_STEP_1" --data-binary @demo.mp4

Tip

Processing starts automatically after the upload finishes. Use assetId to query status and to create Edge Keys for playback.

Encrypting segments

Pass encryptSegments: true in the request body of either upload endpoint to AES-128 encrypt every media segment. It requires the Growth plan (402 otherwise), can only be set at upload time, and changes playback: encrypted videos reject any request that does not carry a signed playback session. See Encrypted Video for the full playback protocol.

Terminal window
curl -X POST "https://api.antcdn.net/v1/videos/upload-url" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"fileName": "demo.mp4",
"allowPublicAccess": false,
"encryptSegments": true
}'

Option B: Upload from an Accessible URL

/videos/upload

Terminal window
curl -X POST "https://api.antcdn.net/v1/videos/upload" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"fileName": "demo.mp4",
"videoURL": "https://example.com/demo.mp4",
"allowPublicAccess": true,
"videoQuality": "high"
}'

Response:

{
"body": { "assetId": "vid_XXX" }
}

Next steps

  • Check status and metadata: GET /videos/{assetId}
  • Create/manage playback Edge Keys: see the “Edge Keys” docs
  • Embed: https://player.antcdn.net/v1/{edgeKey}/master.m3u8