Skip to content

API: Media

Import media files

POST /api/v1/projects/{id}/media: Import media files

Last updated:

POST/api/v1/projects/{id}/media

Heavy call: shares the limit of 10 a minute per credential (E_RATE_LIMITED with Retry-After).

Authentication#

Send the secret in the header Authorization: Bearer <secret>: the local token in local mode, an API key in network mode. An API key needs the media scope; the local token has every scope. See the API overview for both modes.

Path parameters#

NameTypeRequiredDescription
idstringyesmin length 1

Request body#

Content type application/json.

NameTypeRequiredDescription
dry_runbooleannoChecks the paths and limits only: the format is probed on the real import, so a file that is refused there (SVG, for one) still answers 202.
filesarray of importFileInyesat least 1 items; at most 50 items
infoAssetInfo or any or null or nullnoTags, the reuse mark, a description and the sound kind (music, voice or effect) for the files of the call.
originOrigin or any or null or nullnoWhere the files came from: kind imported (default), generated (provider and model), fetched_by_agent (source and rights_note) or rendered_externally (source).
timeline_idstringnoThe timeline of the project; required when the project has several.
wait_msintegerno0 to 25000: hold the call until the assets are ready.

Responses#

200 OK#

Accepted

Content type application/json. Schema: MediaImportResult.

NameTypeRequiredDescription
assetsarray of ImportedAssetno
failedintegerno
importedintegerno
project_idstringno
revisioninteger (int64)no
textstringno
untrusted_noticestringno

202 Accepted#

Content type application/json. Schema: MediaImportResult.

NameTypeRequiredDescription
assetsarray of ImportedAssetno
failedintegerno
importedintegerno
project_idstringno
revisioninteger (int64)no
textstringno
untrusted_noticestringno

400#

Validation failed; errors maps each field to its messages and issues lists each problem with its code, key and params

Content type application/problem+json. Schema: Problem.

401 Unauthorized#

Error (RFC 9457 problem details)

Content type application/problem+json. Schema: Problem.

403#

Error (RFC 9457 problem details)

Content type application/problem+json. Schema: Problem.

404#

Error (RFC 9457 problem details)

Content type application/problem+json. Schema: Problem.

409#

Error (RFC 9457 problem details)

Content type application/problem+json. Schema: Problem.

422 Unprocessable Content#

Error (RFC 9457 problem details)

Content type application/problem+json. Schema: Problem.

429#

Error (RFC 9457 problem details)

Content type application/problem+json. Schema: Problem.

Any other status#

Error (RFC 9457 problem details)

Content type application/problem+json. Schema: Problem.

curl -X POST "http://127.0.0.1:7878/api/v1/projects/PROJECT_ID/media" \
  -H "Authorization: Bearer $STUARTY_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "files": [
    {
      "asset_id": "string",
      "hash": "string",
      "path": "string"
    }
  ]
}'

Response examples

{
  "assets": [
    {
      "asset_id": "string",
      "deduplicated": false,
      "error": {},
      "hash": "string",
      "job_id": "string",
      "kind": "string",
      "name": "string",
      "probe": {},
      "progress": 0,
      "replaces": [],
      "state": "string"
    }
  ],
  "failed": 0,
  "imported": 0,
  "project_id": "string",
  "revision": 0,
  "text": "string",
  "untrusted_notice": "string"
}

The examples are built from the schemas of the OpenAPI document, so a value is a placeholder of its type. The fields that carry the real values are in the tables.