Developers
Assets endpoints
Agent API v1 endpoints for assets — two-step uploads with presigned URLs, finalizing, listing, signed download URLs, renaming and deleting.
On this page
Uploads happen in two steps so file bytes never pass through the API: request an upload to get a presigned URL, PUT the bytes directly to storage, then finalize. A finalized asset can be placed in any design of the workspace by adding it with an asset operation and referencing its id from an image, SVG or video node.
# 1. request
UPLOAD=$(curl -sS -X POST "https://api.desyn.app/api/v1/assets/uploads" \
-H "Authorization: Bearer $DESYN_API_KEY" -H "Content-Type: application/json" \
-d "{\"name\":\"hero.jpg\",\"mime\":\"image/jpeg\",\"bytes\":$(stat -c %s hero.jpg)}")
# 2. upload the bytes with the returned URL and headers
curl -sS -X PUT "$(echo "$UPLOAD" | jq -r .uploadUrl)" -H "content-type: image/jpeg" --data-binary @hero.jpg
# 3. finalize
curl -sS -X POST "https://api.desyn.app/api/v1/assets/$(echo "$UPLOAD" | jq -r .assetId)/finalize" \
-H "Authorization: Bearer $DESYN_API_KEY"Allowed types and the maximum size per file depend on the plan (15 MB on Free, 200 MB on Pro, 1 GB self-hosted).
Assets#
Upload files in two steps (presigned PUT, then finalize) and manage the asset library.
Request an upload#
/assets/uploadsValidates type and size against your plan and returns a presigned PUT URL. Upload the bytes with exactly the returned headers, then finalize.
Parameters
namestringBodyRequiredFile name.
mimestringBodyRequiredMIME type, e.g. image/png, image/svg+xml, font/woff2, video/mp4.
bytesintegerBodyRequiredExact size in bytes.
sha256stringBodyHex digest; identical files are deduplicated.
curl -X POST "https://api.desyn.app/api/v1/assets/uploads" \
-H "Authorization: Bearer $DESYN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "hero.jpg",
"mime": "image/jpeg",
"bytes": 2483112
}'{
"assetId": "a9b8c7d6e5f4",
"uploadUrl": "https://s3.eu-north-1.amazonaws.com/desyn/uploads/a9b8c7d6e5f4?X-Amz-Signature=…",
"headers": {
"content-type": "image/jpeg"
},
"expiresAt": 1792484100000
}Finalize an upload#
/assets/{assetId}/finalizeVerifies the uploaded object, reads dimensions/duration, sanitizes SVG and marks the asset ready. Returns an AssetRef you can reference from nodes (add it to the design with an asset op).
Parameters
assetIdstringPathRequiredFrom the upload request.
curl -X POST "https://api.desyn.app/api/v1/assets/$ASSET_ID/finalize" \
-H "Authorization: Bearer $DESYN_API_KEY"{
"id": "a9b8c7d6e5f4",
"kind": "image",
"mime": "image/jpeg",
"bytes": 2483112,
"width": 3000,
"height": 2000,
"source": "upload",
"name": "hero.jpg",
"status": "ready"
}List assets#
/assetsYour uploads and generated assets, newest first.
Parameters
kind"image" | "svg" | "font" | "video" | "audio"QueryFilter by kind.
source"upload" | "ai" | "stock" | "brand"QueryFilter by origin.
limitintegerQuery1–100, default 50.
cursorstringQueryPagination cursor.
curl "https://api.desyn.app/api/v1/assets" \
-H "Authorization: Bearer $DESYN_API_KEY"{
"items": [
{
"id": "a9b8c7d6e5f4",
"kind": "image",
"name": "hero.jpg",
"width": 3000,
"height": 2000,
"source": "upload"
}
],
"nextCursor": null
}Get an asset#
/assets/{assetId}The asset's metadata and a signed GET URL (cached and reused until shortly before it expires).
Parameters
assetIdstringPathRequiredAsset id.
curl "https://api.desyn.app/api/v1/assets/$ASSET_ID" \
-H "Authorization: Bearer $DESYN_API_KEY"{
"id": "a9b8c7d6e5f4",
"kind": "image",
"mime": "image/jpeg",
"url": "https://files.desyn.app/uploads/a9b8c7d6e5f4?sig=…",
"expiresAt": 1792486800000
}Rename an asset#
/assets/{assetId}Change the display name in the library.
Parameters
assetIdstringPathRequiredAsset id.
namestringBodyRequiredNew name.
curl -X PATCH "https://api.desyn.app/api/v1/assets/$ASSET_ID" \
-H "Authorization: Bearer $DESYN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Hero — spring"
}'{
"id": "a9b8c7d6e5f4",
"name": "Hero — spring"
}Delete an asset#
/assets/{assetId}Removes it from the library. Designs that still use it keep a reference until they stop using it.
Parameters
assetIdstringPathRequiredAsset id.
curl -X DELETE "https://api.desyn.app/api/v1/assets/$ASSET_ID" \
-H "Authorization: Bearer $DESYN_API_KEY"{
"deleted": true
}