Skip to content

Uploads & assets

Upload files with signed tickets, confirm media and manage source assets and processed versions.

Read the allowed formats and size/dimension/duration limits before sending a file. Upload acceptance does not guarantee every tool can process that source; individual tools have their own limits.

GET/api/v1/assets/upload-limits
Bearer API KeyScope: readSuccess: 200

Request example

Terminal window
curl --include --fail-with-body --silent --show-error --max-time 60 \
--request GET 'https://app.berserkapi.com/api/v1/assets/upload-limits' \
--header "Authorization: Bearer $GLACIER_API_KEY"
Response fields · 200
imageobjectrequired
Expand fields / variants
maxAspectinteger · int64required
maxBytesinteger · int64required
maxDurationMsinteger · int64required
maxFrameRateinteger · int64required
maxFramesinteger · int64required
maxPixelsinteger · int64required
maxSideinteger · int64required
minSideinteger · int64required
videoobjectrequired
Expand fields / variants
maxAspectinteger · int64required
maxBytesinteger · int64required
maxDurationMsinteger · int64required
maxFrameRateinteger · int64required
maxFramesinteger · int64required
maxPixelsinteger · int64required
maxSideinteger · int64required
minSideinteger · int64required

Send the file name, MIME type and exact byte length. Replace 123456 in the example with the size of your file. The 201 response contains assetId, uploadUrl, method, headers (an array of name/value pairs), fileField and expiresAt. Save this response locally as ticket.json for the next step; it contains a temporary signed URL, so keep it private.

POST/api/v1/assets/uploads
Bearer API KeyScope: writeSuccess: 201
Request body fields · application/json
mimeTypestringrequired
multipartbooleanoptional
namestringrequired
sizeBytesinteger · int64required

Request example

Terminal window
curl --include --fail-with-body --silent --show-error --max-time 60 \
--request POST 'https://app.berserkapi.com/api/v1/assets/uploads' \
--header "Authorization: Bearer $GLACIER_API_KEY" \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "input.png",
"mimeType": "image/png",
"sizeBytes": 123456
}'
Response fields · 201
assetIdstringrequired
expiresAtstring · date-timerequired
fileFieldstring | nullrequired
headersstring[][]required
Expand fields / variants

string

method"PUT" | "POST"required
uploadUrlstringrequired

These examples use the default PUT ticket and stream input.png to the returned URL. Use the exact returned headers. This is a storage request: it has no API-key header and does not go through /api/v1.

Terminal window
# Save the upload-ticket response as ticket.json. Requires jq.
# The ticket must be for input.png with its exact byte length.
test "$(jq -r '.method' ticket.json)" = PUT || exit 1
headers=()
while IFS= read -r header; do headers+=(--header "$header"); done < <(
jq -r '.headers[] | .[0] + ": " + .[1]' ticket.json
)
curl --fail-with-body --silent --show-error --max-time 1800 \
--request PUT "$(jq -r '.uploadUrl' ticket.json)" \
"${headers[@]}" --upload-file input.png

If you explicitly request multipart: true, the ticket instead uses POST. Send a multipart/form-data body with the file under the returned fileField, keep the returned headers, and let your HTTP library set the multipart boundary. Do not use the PUT example for a POST ticket.

After the storage request succeeds, confirm with the ticket’s assetId. The service checks the actual media and adds it to your library. This call is idempotent. If the upload response was lost, try completion with the known asset ID before starting another upload. Pending uploads are absent from list/detail responses; keep your ticket until completion succeeds.

POST/api/v1/assets/{assetId}/complete
Bearer API KeyScope: writeSuccess: 200
Path, query and headers
ParameterLocationType & constraints
assetId
required
pathstring

Request example

Terminal window
curl --include --fail-with-body --silent --show-error --max-time 60 \
--request POST 'https://app.berserkapi.com/api/v1/assets/ASSET_ID/complete' \
--header "Authorization: Bearer $GLACIER_API_KEY"
Response fields · 200
coverUrlstring | nullrequired
createdAtstring · date-timerequired
durationMsinteger | null · int64required
expiresAtstring | null · date-timerequired
heightinteger · int64required
idstringrequired
isPublicbooleanrequired
kind"image" | "video"required
mimeTypestringrequired
namestringrequired
sizeBytesinteger · int64required
thumbnailUrlstring | nullrequired
updatedAtstring · date-timerequired
urlstringrequired
versionCountinteger · int64required
widthinteger · int64required

Use scope=mine for your assets or scope=public for samples. scope=all is the default. Optional filters include kind and search. Pass nextCursor back as the cursor query parameter until it is null. The example requests 24 assets.

GET/api/v1/assets
Bearer API KeyScope: readSuccess: 200
Path, query and headers
ParameterLocationType & constraints
scope
optional
query"all" | "mine" | "public"

kind
optional
query"image" | "video"

search
optional
querystring

maxLength: 100

limit
optional
queryinteger · int64

minimum: 1 · maximum: 100 · default: 24

cursor
optional
querystring

Request example

Terminal window
curl --include --fail-with-body --silent --show-error --max-time 60 \
--request GET 'https://app.berserkapi.com/api/v1/assets?scope=mine&limit=24' \
--header "Authorization: Bearer $GLACIER_API_KEY"
Response fields · 200
itemsobject[]required
Expand fields / variants
coverUrlstring | nullrequired
createdAtstring · date-timerequired
durationMsinteger | null · int64required
expiresAtstring | null · date-timerequired
heightinteger · int64required
idstringrequired
isPublicbooleanrequired
kind"image" | "video"required
mimeTypestringrequired
namestringrequired
sizeBytesinteger · int64required
thumbnailUrlstring | nullrequired
updatedAtstring · date-timerequired
urlstringrequired
versionCountinteger · int64required
widthinteger · int64required
nextCursorstring | nullrequired
totalinteger · int64required

The response contains asset and versions. Keep the version ID if you want a later task to use it as sourceVersionId. File URLs are temporary; request fresh details when needed. Processing a public sample can create an owned copy; follow the assetId returned by the task.

GET/api/v1/assets/{assetId}
Bearer API KeyScope: readSuccess: 200
Path, query and headers
ParameterLocationType & constraints
assetId
required
pathstring

Request example

Terminal window
curl --include --fail-with-body --silent --show-error --max-time 60 \
--request GET 'https://app.berserkapi.com/api/v1/assets/ASSET_ID' \
--header "Authorization: Bearer $GLACIER_API_KEY"
Response fields · 200
assetobjectrequired
Expand fields / variants
coverUrlstring | nullrequired
createdAtstring · date-timerequired
durationMsinteger | null · int64required
expiresAtstring | null · date-timerequired
heightinteger · int64required
idstringrequired
isPublicbooleanrequired
kind"image" | "video"required
mimeTypestringrequired
namestringrequired
sizeBytesinteger · int64required
thumbnailUrlstring | nullrequired
updatedAtstring · date-timerequired
urlstringrequired
versionCountinteger · int64required
widthinteger · int64required
versionsobject[]required
Expand fields / variants
assetIdstringrequired
createdAtstring · date-timerequired
downloadUrlstringrequired
durationMsinteger | null · int64required
frameCountinteger | null · int64required
frameRatenumber | null · doublerequired
heightinteger · int64required
idstringrequired
indexinteger · int64required
labelstringrequired
maskUrlstring | nullrequired
mimeTypestringrequired
previewPendingbooleanrequired
previewUrlstring | nullrequired
sizeBytesinteger · int64required
sourceVersionIdstring | nullrequired
thumbnailUrlstring | nullrequired
toolIdstring | nullrequired
urlstringrequired
watermarkMarksobject[]required
Expand fields / variants
colorstringoptional

pattern: "^#[0-9a-fA-F]{6}$"

endMsinteger · int64optional

minimum: 0

heightnumber · doublerequired

minimum: 0 · maximum: 1

kind"positive" | "negative" | "absent" | "suggested"optional
objectIdinteger · int64optional

minimum: 0 · maximum: 7

strokesobject[]optional

maxItems: 64

Expand fields / variants
pointsnumber · double[][]required

minItems: 1 · maxItems: 4000

Expand fields / variants

number · double

radiusnumber · doublerequired

minimum: 0 · maximum: 0.25

timeMsinteger · int64optional

minimum: 0

widthnumber · doublerequired

minimum: 0 · maximum: 1

xnumber · doublerequired

minimum: 0 · maximum: 1

ynumber · doublerequired

minimum: 0 · maximum: 1

watermarkObjectsobject[]required
Expand fields / variants
namestringrequired

minLength: 1 · maxLength: 24

objectIdinteger · int64required

minimum: 0 · maximum: 7

widthinteger · int64required

Only supplied fields are changed. Names are trimmed and need not be unique.

PATCH/api/v1/assets/{assetId}
Bearer API KeyScope: writeSuccess: 200
Path, query and headers
ParameterLocationType & constraints
assetId
required
pathstring

Request body fields · application/json
namestringoptional

minLength: 1 · maxLength: 255

Request example

Terminal window
curl --include --fail-with-body --silent --show-error --max-time 60 \
--request PATCH 'https://app.berserkapi.com/api/v1/assets/ASSET_ID' \
--header "Authorization: Bearer $GLACIER_API_KEY" \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "Enhanced photo"
}'
Response fields · 200
coverUrlstring | nullrequired
createdAtstring · date-timerequired
durationMsinteger | null · int64required
expiresAtstring | null · date-timerequired
heightinteger · int64required
idstringrequired
isPublicbooleanrequired
kind"image" | "video"required
mimeTypestringrequired
namestringrequired
sizeBytesinteger · int64required
thumbnailUrlstring | nullrequired
updatedAtstring · date-timerequired
urlstringrequired
versionCountinteger · int64required
widthinteger · int64required

This removes a processed output version. The original cannot be deleted through this endpoint; remove the whole asset instead. A successful deletion returns 204 with no body.

DELETE/api/v1/assets/{assetId}/versions/{versionId}
Bearer API KeyScope: writeSuccess: 204
Path, query and headers
ParameterLocationType & constraints
assetId
required
pathstring

versionId
required
pathstring

Request example

Terminal window
curl --include --fail-with-body --silent --show-error --max-time 60 \
--request DELETE 'https://app.berserkapi.com/api/v1/assets/ASSET_ID/versions/VERSION_ID' \
--header "Authorization: Bearer $GLACIER_API_KEY"
Response fields · 204

No response body. Do not attempt to parse empty JSON.

Deletes the owned asset and cancels its related tasks. Use this only when the original and its versions are no longer needed. Public samples cannot be deleted. Success returns 204 with no body.

DELETE/api/v1/assets/{assetId}
Bearer API KeyScope: writeSuccess: 204
Path, query and headers
ParameterLocationType & constraints
assetId
required
pathstring

Request example

Terminal window
curl --include --fail-with-body --silent --show-error --max-time 60 \
--request DELETE 'https://app.berserkapi.com/api/v1/assets/ASSET_ID' \
--header "Authorization: Bearer $GLACIER_API_KEY"
Response fields · 204

No response body. Do not attempt to parse empty JSON.