Sorry, no results found for "".

Show examples in:
Javascript HTTP
Endpoint info
Available examples

Content Management API > Upload Collection

Create a new upload collection

Body parameters

id string Optional

RFC 4122 UUID of upload collection expressed in URL-safe base64 format

Example: "uinr2zfqQLeCo_1O0-ao-Q"
type string Required

Must be exactly "upload_collection". JSON API type field

attributes.label string Required

The label of the upload collection

Example: "Posts"
attributes.position integer Optional

Ordering index

Example: 1
relationships.parent.data Optional

Parent upload collection

Returns

Returns a resource object of type upload_collection.

Examples

POST https://site-api.datocms.com/upload-collections HTTP/1.1
Authorization: Bearer YOUR-API-TOKEN
Accept: application/json
X-Api-Version: 3
Content-Type: application/vnd.api+json
{
"data": {
"type": "upload_collection",
"attributes": {
"label": "Posts"
}
}
}
Terminal window
curl -g 'https://site-api.datocms.com/upload-collections' \
-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_collection","attributes":{"label":"Posts"}}}'
await fetch("https://site-api.datocms.com/upload-collections", {
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_collection", attributes: { label: "Posts" } },
}),
});
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_collection",
"id": "uinr2zfqQLeCo_1O0-ao-Q",
"relationships": {
"parent": {
"data": null
},
"children": {
"data": [
{
"type": "upload_collection",
"id": "uinr2zfqQLeCo_1O0-ao-Q"
}
]
}
},
"attributes": {
"label": "Posts",
"position": 1
}
}
}