Sorry, no results found for "".

Show examples in:
Javascript HTTP
Endpoint info
Available examples

Content Management API > Upload permission

Request a new upload

Body parameters

type string Required

Must be exactly "upload_request".

attributes.filename string Optional

The original file name

Example: "image.png"

Returns

Returns a resource object of type upload_request.

Examples

POST https://site-api.datocms.com/upload-requests HTTP/1.1
Authorization: Bearer YOUR-API-TOKEN
Accept: application/json
X-Api-Version: 3
Content-Type: application/vnd.api+json
{
"data": {
"type": "upload_request",
"attributes": {}
}
}
Terminal window
curl -g 'https://site-api.datocms.com/upload-requests' \
-X POST \
-H "Authorization: Bearer YOUR-API-TOKEN" \
-H "Accept: application/json" \
-H "X-Api-Version: 3" \
-H "Content-Type: application/vnd.api+json" \
--data-binary '{"data":{"type":"upload_request","attributes":{}}}'
await fetch("https://site-api.datocms.com/upload-requests", {
method: "POST",
headers: {
Authorization: "Bearer YOUR-API-TOKEN",
Accept: "application/json",
"X-Api-Version": "3",
"Content-Type": "application/vnd.api+json",
},
body: JSON.stringify({ data: { type: "upload_request", attributes: {} } }),
});
HTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: cache-control: max-age=0, private, must-revalidate
X-RateLimit-Limit: 30
X-RateLimit-Remaining: 28
{
"data": {
"type": "upload_request",
"id": "/7/1455102967-image.png",
"attributes": {
"url": "https://dato-images.s3-eu-west-1.amazonaws.com/7/1455102967-image.png?X-Amz-Credential=AKIAJDTXTZHHDUCKAUMA%2F20160210",
"request_headers": {}
}
}
}