Many API endpoints in Belga.press handle binary media.
This page explains how they work.Media can be divided in 2 main categories:Newsobject attachments#
Any newsobject provided by Belga can contain attachments, being binary files such as images and videos.
They are always represented in the form of an attachment object:Attachment objects contain a lot of metadata describing the attachment, and under the references attribute provide the API consumer with various representations of the actual file (e.g. different sizes for an image), generated by the Belga Media CDN.The media endpoints described in this section were introduced recently in Belga.press. Existing media handling patterns will be deprecated and replaced gradually in the coming months.
User media is defined as any media that are uploaded by Belga.press users.
The handling of these is always the same: first the binary file itself is uploaded, then it is linked to the entity that needs it.For example, when an API consumer wants to create a Newsroom with a cover image, they first need to upload the image, which will respond with an media ID.
Then they create the Newsroom, linking to the desired cover image by the provided ID.
When the Newsroom is later requested, the Belga Media CDN will automatically generated a URL for the linked cover image.Orphaned media, not linking to any entity, are automatically deleted after some time.There are 2 media endpoints:POST /uploads/media: accepts any common media type (jpg, png, gif, ...), does not have any metadata
POST /uploads/files: accepts any whitelisted file type, plus additional metadata about the file (name, size, ...)
Modified at 2025-10-28 10:25:54