Skip to content

Upload a media file

POST
/cms/media
curl --request POST \
--url https://api.example.com/cms/media \
--header 'API-Key: <API-Key>' \
--header 'Content-Type: multipart/form-data' \
--form file=@file \
--form content_id=1 \
--form title=example \
--form alternate_text=example

Uploads a new media file into the library. Optionally associate it with a content item by providing a content_id.

Media typemultipart/form-data
object
file
required

The file to upload

string format: binary
content_id

Optional ID of a content item to associate the media with

integer
title

Optional title for the media

string
alternate_text

Optional alternate text for the media

string

Upload successful

Media typeapplication/json
object
id

ID of the created attachment

integer

Example generated

{
"id": 1
}

Bad request (missing file or invalid content_id)

Unauthorized

Forbidden