Skip to content

Media upload with credit

POST /v1/media (and POST /v1/sites/{site}/media with a company key) uploads an image to the site’s library. This page covers what the Media reference does not detail: the file’s provenance and the credit and licence that travel with the image.

  • Scope: media:upload. The media:write package grants media:upload and media:delete (see API v2).
  • Body: multipart/form-data with a part named file. Another content type answers 400 with the message expected multipart/form-data body with a `file` field.
  • Metadata: all in the query string, never in the multipart body.
  • Site: always the key’s (or the path {site} checked against the key’s company). A site_id in the query is ignored.

All optional. A whitespace-only value counts as absent. Anything outside the contract is 400, answered before the file is read.

Parameter Limit Notes
alt_text up to 500 characters The image’s text alternative.
source upload, imported, ai or system Provenance. Omitted means upload.
source_detail up to 200 characters Free-form provenance detail (for example codex with source=ai, or a stock-photo id).
credit_author up to 200 characters Author name.
credit_author_url up to 2048 characters, https Author link.
credit_license up to 200 characters Licence name, for example CC BY 4.0.
credit_license_url up to 2048 characters, https Licence link.
credit_caption up to 500 characters Ready-to-display attribution text.

Limits count characters, not bytes. Text fields reject control characters. URL fields accept only https:// with a host: no whitespace and no embedded credentials (https://user@host is rejected).

  • upload: ordinary upload (default).
  • imported: brought from another system.
  • ai: AI-generated. Put the generator in source_detail, for example source=ai&source_detail=codex. For ai no credit field is required.
  • system: created by a system routine.

unknown is not accepted: it is the value of files that predate provenance, not a choice for the sender.

invalid query string
alt_text must have at most 500 characters
source must be one of: upload, imported, ai, system
source_detail must have at most 200 characters
credit_author must have at most 200 characters
credit_license must have at most 200 characters
credit_caption must have at most 500 characters
credit_author_url must have at most 2048 characters
credit_license_url must have at most 2048 characters
credit_author must not contain control characters
credit_author_url must be an https:// URL
credit_author_url is not a valid https:// URL

For credit_license and credit_caption the same length and control-character messages apply; for credit_license_url, the length and https ones, swapping the field name. They come in the envelope { "error": { "code": "bad_request", "message": "..." } }.

Janela do terminal
curl -X POST "https://api.canverly.com/v1/media?alt_text=Desk%20with%20laptop&source=imported&credit_author=Ana%20Souza&credit_author_url=https%3A%2F%2Fexample.com%2Fana&credit_license=CC%20BY%204.0&credit_license_url=https%3A%2F%2Fcreativecommons.org%2Flicenses%2Fby%2F4.0%2F&credit_caption=Photo%3A%20Ana%20Souza%20%2F%20CC%20BY%204.0" \
-H "Authorization: Bearer $CANVERLY_API_KEY" \
-F "file=@desk.jpg"

For an AI-generated image, no credit:

Janela do terminal
curl -X POST "https://api.canverly.com/v1/media?alt_text=Illustration%20of%20a%20dashboard&source=ai&source_detail=codex" \
-H "Authorization: Bearer $CANVERLY_API_KEY" \
-F "file=@cover.png"
  • Body: at most 8 MiB. Above that: 413 (upload body too large).
  • Accepted types: PNG, JPEG, GIF, WebP, AVIF and SVG. The type is decided by the file’s bytes; the multipart part’s Content-Type is ignored. Any other type (BMP, TIFF, HEIC, PDF…) answers 415.
  • SVG: up to 512 KiB, and it is stored sanitized. An SVG with active content (script, event handler, javascript: URL, foreignObject) or that is not a servable SVG document is rejected with 415.
  • Absurd dimensions: the image header declares an area or side above the safety ceiling: 413.
  • Missing file part: 400 missing file.

Success is 202 (Accepted): the original is stored, variants are generated in the background.

{
"id": "…",
"key": "…",
"mime": "image/jpeg",
"hash": "…",
"primary_storage": "…",
"bytes": 123456,
"width": 1600,
"height": 900,
"filename": "desk.jpg",
"status": "processing"
}

width and height may be null when the format does not allow reading dimensions. Track progress with GET /v1/media/{id}. The credit is not echoed in the upload response; it is stored on the asset and returned when the asset is read. Use the id as featured_image_id or in the post’s image blocks.

If the key has no company context, the upload answers 422 (this api key has no org context; re-create it in Configurações → Integrações API).

The credit is stored with the asset (field credit, with provider equal to external and the keys author, author_url, license, license_url and caption) and returned by GET /v1/media/{id}.

See also Idempotency (the upload does not use Idempotency-Key), Rate limits (upload counts as a write) and Media.