Search documentation
karat

+

K

User Documentation ↗
Version 2.0

Upload Media

PUT/api/v2/mediasets/media/upload
Warning

This endpoint is in preview and may be modified or removed at any time. To use this endpoint, add preview=true to the request query parameters.

Uploads a temporary media item. If the media item isn't persisted within 1 hour, the item will be deleted.

If multiple resources are attributed to, usage will be attributed to the first one in the list.

The body of the request must contain the binary content of the file and the Content-Type header must be application/octet-stream. Third-party applications using this endpoint via OAuth2 must request the following operation scopes: api:ontologies-read api:ontologies-write.

Query parameters

filename
string

The path to write the media item to. Required if the backing media set requires paths.

preview
boolean
optional

A boolean flag that, when set to true, enables the use of beta features in preview mode.

Request body

body
string

Response body

MediaReference
object

The media reference for the uploaded media.

Hide child attributes

Hide child attributes

mimeType
string

The media type of the file or attachment. Examples: application/json, application/pdf, application/octet-stream, image/jpeg

reference
union

A union of the types supported by media reference properties.

Show child attributes

Show child attributes

Examples

Request

Copied!
1 2 3 4 5 curl -X PUT \ \t-H "Content-type: application/octet-stream" \ \t-H "Authorization: Bearer $TOKEN" \ "https://$HOSTNAME/api/v2/mediasets/media/upload?filename=my-file.png&preview=true" \ --data-binary '@/path/to/file'