Upload a File

 

This method is used to upload files and returns a URL for use in CME. The file schema field type for content requires a URL, so you must use this endpoint before saving/updating file content.

NOTE: If you're uploading a file for a field that has been previously uploaded, then please use the Replace a File 2.0 endpoint to delete the old file - otherwise zombie files will exist that can never be deleted.

NOTE: This request must be a multipart/form-data for the file to be uploaded. Please search for how to complete a multipart/form-data request in your framework/programming language.

 

Method

POST

 

URL

 

Headers

In order to provide CME with the JWT, you must provide a header named Authorization and the token must be prefixed with the word Bearer.

Key

Authorization

Value

Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6MTY3NCwiZW1haWwiOiJvcmdvd25lckBjeWJhZ2UuY29tIiwiZmlyc3RfbmFtZSI6IkN5YmFnZSIsImxhc3RfbmFtZSI6Ik9yZyBPd25lciIsIm9yZ3MiOltdLCJzZXNzaW9uX2lkIjoiNzk3ZWRjNmY2Mjk5Y2JmYmEyODE3NDlhMGFlZjI0YmNhNmZmODM0NSIsIm9yZ19pZCI6NTEsIm9yZ19uYW1lIjoiQ3liYWdlIENsZWFuIiwiaWF0IjoxNDg4MjI5ODY0LCJleHAiOjE0ODgzMTYyNjR9.Vd7BCYEkeWOq2B3_3Np9ylYDwYaAWyE1-e4ZvCIvK4E

 

 

Request Parameters

Required parameters are underlined.

Parameter

Value

Description

file

File

The file being uploaded.

 

 

Request

Content-Type: multipart/form-data

Send the file field.

 

 

Response

A successful response will have a 200 status code and a body containing the URL of the new file.

{
"message": "Successfully uploaded file to S3.",
"file": "https://lbs-dev.s3.amazonaws.com/cyb-cln/e4d22a023db54fa08680b11078e0d9d6/dog_typing_fast.gif"
}

 

 

Error Handling

An error response will return a 400 (or 500 for internal server error) and a message:

{
"message": "No file found in the request."
}