BASE URL: https://api.umbraco.io
Auth is required for this API meaning that you must supply a Bearer Token via an Authorization header or an API Key via an Authorization or Api-Key header.
If an error occours you will receive a HTTP status code along with an API error code and an error message in the response body.
JSON example:
Get a list of all available Media Types.
URL: /media/type
Method: GET
Permissions required : Access to Settings section of the Umbraco Backoffice
Code: 200
Content Example:
Get a specific Media Type by its alias.
URL: /media/type/{alias}
Method: GET
Permissions required : Access to Settings section of the Umbraco Backoffice
Code: 200
Content Example:
BASE URL: https://api.umbraco.io
Auth is required for this API meaning that you must supply a Bearer Token via an Authorization header or an API Key via an Authorization or Api-Key header.
If an error occours you will receive a HTTP status code along with an API error code and an error message in the response body.
JSON example:
Get all media at the root of the tree, which the authorized user has access to according to the 'Start node'-permissions.
URL: /media
Method: GET
Permissions required : Access to Media section of the Umbraco Backoffice
Code: 200
Content Example:
Get specific media item by its GUID ID.
URL: /media/{id}
Method: GET
Permissions required : Access to Media section of the Umbraco Backoffice
Code: 200
Content Example:
Get a list of children (media items) by their parent GUID ID.
URL: /media/{id}/children
Method: GET
Query Strings
Permissions required : Access to Media section of the Umbraco Backoffice
Code: 200
Content Example:
Create a new media item and optionally upload a file to the created item.
Media can be created by sending a POST request to the media endpoint. The request body should contain the media item properties and the file to upload. The file is sent as a multi-part request. The first MultipartBoundary
contains the JSON body describing the content for the image. The second MultipartBoundary
contains the file. If the media item does not contain a file you can send a regular JSON request to create the media.
The umbracoFile.src
property in the first MultipartBoundary
's JSON body defines the name of the file to be uploaded. The fileName
in the second MultipartBoundary
must match the umbracoFile.src
property's value.
URL: /media
Method: POST
Header: Content-Type: multipart/form-data; boundary=MultipartBoundry
Permissions required : Access to Media section of the Umbraco Backoffice
Code: 201
Content Example:
Updates an existing media item and optionally uploads a file to the updated item.
Media would typically contain an upload field (the Image
and File
media types has this by default), which means it is possible to send a file along with the request to update an existing media item. This is done by sending a multi-part request with the JSON body and the file. If the media item does not contain a file you can send a regular JSON request to update the media.
URL: /media/{id}
Method: PUT
Header: Content-Type: multipart/form-data; boundary=MultipartBoundry
Permissions required : Access to Media section of the Umbraco Backoffice
Code: 200
Content Example:
Delete a media item. This will also delete any file that is attached to the media item.
URL: /media/{id}
Method: DELETE
Permissions required : Access to Media section of the Umbraco Backoffice
Code: 200
Content Example:
DELETE https://api.umbraco.io/media/b60a1257-4bef-4d5a-aeb6-4af17b6233b2
Status Code | Error Code | Message |
---|---|---|
Status Code | Error Code | Message |
---|
Different media property editors will require different request body formats.The File Upload property editor has the file name as the value "umbracoFile": FILE_NAME
, and the Image Cropper property editor expects a JSON value "umbracoFile": { "src": FILE_NAME }
. To verify the JSON structure you can manually upload the media file via the backoffice and fetch the data. It can then be used for reference. (See how in the tutorial.)
401
Unauthorized
Authorization has been denied for this request.
403
Forbidden
You are not authorized to access the given resource.
404
NotFound
Media Type with alias '{alias}' could not be found.
500
InternalServerError
Internal server error.
400 | BadRequest | Body cannot be empty. |
401 | Unauthorized | Authorization has been denied for this request. |
403 | Forbidden | You are not authorized to access the given resource. |
404 | NotFound | Media with id '{id}' could not be found. |
422 | ValidationFailed | Validation error occured when trying to save or update the media item. |
500 | InternalServerError | Internal server error. |