Assets

Uploading Assets

The Asset Upload API is a alternative convenient way of uploading assets. The upload is done via a familiar HTTP POST request.

Afterwards, the uploaded asset(s) can be selected during content creation or edit.

URL Endpoint

The URL endpoint for Asset API is the Project API endpoint suffixed with /upload.

e.g. https://api-eu-central-1.graphcms.com/v2/ckfct0nfo004w1lsa5r0wdu9s/master/upload

Uploading

Upload is done via a POST to the URL endpoint with a multipart body. The following example is an upload of a file picture.jpg with curl.

curl -XPOST -F fileUpload=@picture.jpg <url-endpoint>

For non public projects, the Asset API uses the same authorization as other GraphCMS APIs. Make sure to "Allow Mutations" on your token or endpoint to be able to upload assets.

Response

The expected API response is of the following format.

{
"filename": "picture.jpg",
"mimetype": "image/jpeg",
"size": 32476,
"width": 500,
"height": 750,
"url": "https://media.graphcms.com/P3TkBzxyQLupgDWNFydB",
"id": "ckfdz530o0001ip92cdr3bbmj"
}

Upload Size Limitation

Currently, the maximum size of an upload is limited to 100 MegaBytes.


Were you expecting something more?

We are constantly contributing to our documentation, but if you spot something we're missing, let us know and we'll be sure to add it.

This site uses cookies to provide you with a better user experience. For more information, refer to our Privacy Policy