SmakeSmake API Docs
EndpointsMedia

Upload media

POST
/media

In the Media section you can upload image or PDF files to use them in other parts of the system by referencing the Media ID.

The request body is the raw file content; set the Content-Type header to the file's mime type (and Content-Length to its size), e.g.:

POST /media HTTP/1.1Content-Type: image/jpegContent-Length: 42840raw content

The following file formats are currently supported:

TypeOptions
JPG/JPEGRGB, 360dpi recommended
PNGRGB, transparency, 360dpi recommended
PDFRGB, 360dpi recommended

Warning: The maximum file size is 51.2MB.

AuthorizationbearerAuth

Authorization

bearerAuth
AuthorizationBearer <token>

API token as bearer token — you receive a test and a live token, there is no switch between them. See Setup → Authentication and Setup → Test mode.

In: header

Header Parameters

Accept*"application/json"

The API only responds with JSON — this header is mandatory on every request (see Setup → Headers).

Default"application/json"

Value in

  • "application/json"

Request Body

application/octet-stream

The raw file content. The maximum file size is 51.2MB.

TypeScript Definitions

Use the request body type in TypeScript.

body*file

The raw file content (JPG/JPEG, PNG or PDF). Set the Content-Type header to the file's mime type, e.g. image/jpeg, image/png or application/pdf.

Formatbinary

Response Body

application/json

application/json

application/json

Request example
curl -X POST "https://example.com/media" \  -H "Accept: application/json" \  -H "Content-Type: application/octet-stream" \  -d 'string'
{  "id": 1,  "is_test": 0,  "collection_name": "api-media-upload",  "file_name": "39b8196929f742e7bccab01a643b6524.jpeg",  "size": 42840,  "mime_type": "image/jpeg",  "download_url": "https://api.smake.io/v2/media/1/download",  "state": "completed",  "requested": null,  "failure_message": null,  "created_at": "2017-09-28T08:40:44+00:00",  "updated_at": "2017-09-28T08:40:44+00:00"}