Upload Flow

Media uploads use presigned S3 URLs. Request one with POST /v1/uploads/presign, upload directly to S3, then use the returned taskId when creating segmentation jobs.

Step 1 — Request a Presigned URL

Send a POST request with the contentType of the file you want to upload. The API returns a signed URL valid for 5 minutes, along with the taskId that identifies this upload in subsequent job requests.

Request

curl -X POST \
  https://api.segmentationapi.com/v1/uploads/presign \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_SEGMENTATION_API_KEY" \
  -d '{
    "contentType": "image/png"
  }'

Response

200 OK

{
  "uploadUrl": "https://segmentation-assets-prod.s3.us-east-2.amazonaws.com/inputs/acct_demo_123/0000_a1b2c3d4?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Expires=300&X-Amz-Signature=example",
  "taskId": "0000_a1b2c3d4",
  "bucket": "segmentation-assets-prod",
  "expiresIn": 300
}
FieldTypeDescription
uploadUrlstringPresigned S3 PUT URL — expires after expiresIn seconds
taskIdstringUnique identifier for this upload; use in POST /v1/jobs
bucketstringS3 bucket name (informational)
expiresInnumberURL validity in seconds (default 300)

Step 2 — Upload File to S3

Use the uploadUrl from the presign response to PUT the raw file bytes directly to S3. Set the Content-Type header to match the contentType you specified in the presign request.

PUT to S3

curl -X PUT "https://s3.amazonaws.com/...signed-url..." \
  -H "Content-Type: image/png" \
  --data-binary "@frame-0001.png"

Supported Formats

TypeSupported Formats
Imagesimage/png, image/jpeg, image/webp
Videovideo/mp4, video/webm