Media
Upload files (images, videos, documents) to attach to other content. The flow is two-step:
- Upload the file via
POST /mediato receive a media object with anid. - Reference the
idwhere the media is used. Theidmust come from an upload by the same token.
Uploads can be used in these places:
media_idsonPOST /walls/{wall_id}/postscover_media_id(an image) on events and calendar entriesmedia_idson staff cardsmedia_idsin theimage_gallery,video_galleryanddocumentelements of an article
Required scope: write:media for both endpoints. There is no separate read scope, so a read-only token cannot fetch media objects.
Media belongs to the token that uploaded it. GET /media/{id} returns 404 for any other id, including media uploaded in the CMS or the app and media uploaded by another token. The same holds when attaching: an id from another token returns 422 with an error on media_ids (posts, staff cards), cover_media_id (events, calendar entries) or elements (articles). Upload with the token that will attach the media.
Endpoints
/api/open/v1/mediaUpload a file (multipart/form-data)
/api/open/v1/media/{id}Get a media object you uploaded with this token
Upload request
Send as multipart/form-data:
| Field | Type | Notes |
|---|---|---|
media | file | Required. The file to upload. |
type | string | Required. One of image, video, document. |
The API accepts files up to 2,000 MiB (2,097,152,000 bytes), the same limit for every type; a larger file returns 422 with an error on media. A file whose type Monotree can't store returns 422 as well.
That is the effective limit: the web server and PHP on Monotree's servers accept request bodies up to 2,048 MiB, so they never lower it. A request body above 2,048 MiB never reaches the API: the web server answers 413 Request Entity Too Large with an HTML page instead of JSON.
type decides how the file is processed. The type in the response is the kind of file Monotree detected: image or video, or for a document the detected kind, such as pdf, document, spreadsheet, presentation or archive.
curl -X POST https://customer.monotree.com/api/open/v1/media \
-H "Authorization: Bearer mono_your_token_here" \
-F "media=@./photo.jpg" \
-F "type=image"A successful upload returns 201 with the media object (see Response).
Attach to a post
curl -X POST https://customer.monotree.com/api/open/v1/walls/1/posts \
-H "Authorization: Bearer mono_your_token_here" \
-H "Content-Type: application/json" \
-d '{"body": "Look at this!", "media_ids": [42]}'Response
{
"data": {
"id": 42,
"type": "image",
"mime_type": "image/jpeg",
"filename": "photo.jpg",
"size": 123456,
"url": "https://cdn.monotree.dk/.../photo.jpg",
"width": 1920,
"height": 1080,
"tag": null,
"created_at": "2026-04-24T10:00:00+02:00"
}
}tag is always null on /media responses. It is only set when the media is embedded in another resource, such as the QR code on a staff card, where it tells generated attachments from uploads.
A video carries four more fields:
| Field | Type | Notes |
|---|---|---|
state | string | processing while the video is still being encoded, ready once it can be streamed. |
stream_url | string or null | The streaming URL, null until state is ready. |
poster_url | string or null | A still image from the video, once one has been made. |
duration | integer or null | Length in milliseconds. |