Media
Upload media assets and get back dp:// references.
Upload media
Uploads one or more files and returns a dp:// reference per file for use in POST /jobs datapoints.
Request
Multipart form-data with one or more files fields:
Content-Type: multipart/form-data
--boundary
Content-Disposition: form-data; name="files"; filename="video_a.mp4"
Content-Type: video/mp4
<binary>
--boundary
Content-Disposition: form-data; name="files"; filename="video_b.mp4"
Content-Type: video/mp4
<binary>
--boundary--
Files in a batch are processed sequentially, and there is no partial rollback: if the third file in a batch fails, the first two are already stored and keep their references. The whole batch is handled within a single request, so keep batches modest rather than sending very large numbers of files at once.
Response (200 OK)
{
"media": [
{
"filename": "video_a.mp4",
"media_id": "b6a1cd3f-1234-4abc-9def-0123456789ab",
"media_ref": "dp://b6a1cd3f1234/video_a.mp4",
"type": "video",
"size_bytes": 2457623,
"url": "/media/v2/b6a1cd3f-1234-4abc-9def-0123456789ab?cid=...&exp=1753280000&sig=..."
}
]
}| Field | Type | Description |
|---|---|---|
filename | string | The original filename as uploaded. |
media_id | string | Stable identifier for the uploaded file. You normally pass `media_ref` to job creation; `media_id` is exposed for tooling that needs the raw identifier. |
media_ref | string | Opaque dp:// URI. Pass verbatim to POST /jobs datapoints. |
type | "video" | "image" | "audio" | Determined from the file extension (see Supported formats). |
size_bytes | int | Size of the stored file in bytes. Matches the bytes you sent, except for `.svg`, which is stored after sanitisation. |
url | string | Signed, relative preview path for the uploaded file. Bound to your account and valid for roughly one hour, so you can render the asset immediately without a separate fetch. Not a permanent link — mint jobs from `media_ref`, not this URL. |
Supported formats
| Type | Extensions |
|---|---|
| Image | .png, .jpg, .jpeg, .webp, .avif, .gif, .svg, .heic, .heif |
| Video | .mp4, .webm, .mov |
| Audio | .mp3, .wav, .ogg, .m4a, .flac |
The media type is taken from the file extension. The request Content-Type is only a cross-check:
- Extension not in the table above →
400(unsupported_media_extension). Upload one of the supported formats. - Extension and
Content-Typedisagree (e.g. a.mp4sent asimage/png) →400(media_type_mismatch). - A
Content-Typethe platform doesn't recognise is ignored — the extension still governs.
.svg uploads are sanitised on the way in (script vectors and unsafe references are stripped). An SVG that can't be parsed is rejected with 400 (invalid_svg).
Preview frames are generated for video only, and not at upload time — the poster frame is produced the first time the video is used in a job. The upload response's url always serves the full object; poster frames are served by thumbnail_url in GET /media.
Example
curl -X POST https://api.trydatapoint.com/data-labelling/v1/media \
-H "X-API-Key: $DATAPOINT_KEY" \
-F "files=@video_a.mp4" \
-F "files=@video_b.mp4"Error cases
| Status | Error code | Cause |
|---|---|---|
400 | unsupported_media_extension | The file extension isn't supported. |
400 | media_type_mismatch | The extension and the declared Content-Type disagree. |
400 | invalid_svg | An .svg upload couldn't be parsed. |
400 | invalid_media | The file couldn't be processed (corrupt or unreadable). |
401 | — | Missing or invalid API key. |
413 | media_too_large | A file exceeds the 20 MiB limit; the body carries max_bytes. |
422 | content_blocked | The file didn't pass content review. |
429 | — | Rate limit exceeded. |
503 | — | Content review is temporarily unavailable; retry after Retry-After seconds. |
List media
Lists your account's media — both files you uploaded through POST /media and media the platform fetched from direct URLs in your jobs — newest first. Paginated.
Query parameters
| Field | Type | Description |
|---|---|---|
page | intdefault: 1 | 1-based page number. |
per_page | intdefault: 50 | Items per page, between 1 and 100. |
Response (200 OK)
{
"media": [
{
"media_id": "b6a1cd3f-1234-4abc-9def-0123456789ab",
"filename": "video_a.mp4",
"media_ref": "dp://b6a1cd3f1234/video_a.mp4",
"type": "video",
"size_bytes": 2457623,
"moderation_status": "allowed",
"created_at": "2026-07-23T18:11:04Z",
"url": "/media/v2/b6a1cd3f-1234-4abc-9def-0123456789ab?cid=...&exp=1753280000&sig=...",
"thumbnail_url": "/media/v2/b6a1cd3f-1234-4abc-9def-0123456789ab?cid=...&exp=1753280000&sig=...&preview=1"
}
],
"total": 1,
"page": 1,
"per_page": 50
}| Field | Type | Description |
|---|---|---|
media | array | Media items on this page, newest first. |
total | int | Total number of media items across all pages. |
page | int | The page you requested. |
per_page | int | The page size in effect. |
Each item in media:
| Field | Type | Description |
|---|---|---|
media_id | string | Stable identifier for the file. |
media_ref | string | The dp:// reference to pass to POST /jobs. Null for media the platform fetched from a direct URL in a job — only files uploaded through POST /media carry a dp:// reference. |
filename | string | The original upload name, recovered from the reference. Falls back to the `media_id` when the row has no dp:// reference (media fetched from a direct URL). |
type | "video" | "image" | "audio" | The media type. |
size_bytes | int | Stored size in bytes. |
moderation_status | string | Availability of the file: `allowed` means it's ready to serve and preview; while it is `pending` (still in review) or if it was not accepted, the preview URLs won't resolve. |
created_at | string | Upload timestamp (ISO 8601). |
url | string | Signed, relative preview path, bound to your account and valid for roughly one hour. Only resolves once `moderation_status` is `allowed`. |
thumbnail_url | string | Signed preview path for the poster frame (videos). Falls back to the full object when no thumbnail exists; same availability rules as `url`. |
Next
- Media handling concepts: how
dp://refs are served end-to-end - Task types: where to plug media refs into datapoints