Show examples in:
Javascript HTTP
Endpoint info
Available examples

Content Management API > Upload

List all uploads

To retrieve a collection of uploads, send a GET request to the /uploads endpoint. The collection is paginated, so make sure to iterate over all the pages if you need every record in the collection!

The following table contains the list of all the possible arguments, along with their type, description and examples values.

Pro tip: in case of any doubts you can always inspect the network calls that the CMS interface is doing, as it's using the Content Management API as well!

Query parameters

filter object

Attributes to filter uploads

ids string

IDs to fetch, comma separated

Example: "12,31"
query string

Textual query to match. If locale is defined, search within that locale. Otherwise environment's main locale will be used.

Example: "foobar"
fields object

Same as GraphQL API uploads filters. Use snake_case for fields names. If locale is defined, search within that locale. Otherwise environment's main locale will be used.

Example: { type: { eq: "image" }, size: { gt: 5000000 } }
locale string

When filter[query] or field[fields] is defined, filter by this locale. Default: environment's main locale

Example: "it"
order_by string

Fields used to order results. Format: <field_name>_<DIRECTION(ASC|DESC)>. You can pass multiple comma separated rules.

Example: "_created_at_DESC,size_ASC"
page object

Parameters to control offset-based pagination

offset integer

The (zero-based) offset of the first entity returned in the collection (defaults to 0)

Example: 200
limit integer

The maximum number of entities to return (defaults to 30, maximum is 500)

Returns

Returns an array of resource objects of type upload.

Examples

1
GET https://site-api.datocms.com/uploads HTTP/1.1
2
Authorization: Bearer YOUR-API-TOKEN
3
Accept: application/json
4
X-Api-Version: 3
Terminal window
1
curl -g 'https://site-api.datocms.com/uploads' \
2
\
3
-H "Authorization: Bearer YOUR-API-TOKEN" \
4
-H "Accept: application/json" \
5
-H "X-Api-Version: 3"
1
await fetch("https://site-api.datocms.com/uploads", {
2
headers: {
3
Authorization: "Bearer YOUR-API-TOKEN",
4
Accept: "application/json",
5
"X-Api-Version": "3",
6
},
7
});
1
HTTP/1.1 200 OK
2
Content-Type: application/json
3
Cache-Control: cache-control: max-age=0, private, must-revalidate
4
X-RateLimit-Limit: 30
5
X-RateLimit-Remaining: 28
6
7
{
8
"data": [
9
{
10
"type": "upload",
11
"id": "q0VNpiNQSkG6z0lif_O1zg",
12
"attributes": {
13
"size": 444,
14
"width": 30,
15
"height": 30,
16
"path": "/45/1496845848-digital-cats.jpg",
17
"basename": "digital-cats",
18
"filename": "digital-cats.jpg",
19
"url": "https://www.datocms-assets.com/45/1496845848-digital-cats.jpg",
20
"format": "jpg",
21
"author": "Mark Smith",
22
"copyright": "2020 DatoCMS",
23
"notes": "Nyan the cat",
24
"md5": "873c296d0f2b7ee569f2d7ddaebc0d33",
25
"duration": 62,
26
"frame_rate": 30,
27
"blurhash": "LEHV6nWB2yk8pyo0adR*.7kCMdnj",
28
"thumbhash": "UhqCDQIkrHOfVG8wBa2v39z7CXeqZWFLdg==",
29
"mux_playback_id": "a1B2c3D4e5F6g7H8i9",
30
"mux_mp4_highest_res": "high",
31
"default_field_metadata": {
32
"en": {
33
"title": "this is the default title",
34
"alt": "this is the default alternate text",
35
"custom_data": {
36
"foo": "bar"
37
},
38
"focal_point": {
39
"x": 0.5,
40
"y": 0.5
41
}
42
}
43
},
44
"is_image": true,
45
"created_at": "2020-04-21T07:57:11.124Z",
46
"updated_at": "2020-04-21T07:57:11.124Z",
47
"mime_type": "image/jpeg",
48
"tags": [
49
"cats"
50
],
51
"smart_tags": [
52
"robot-cats"
53
],
54
"exif_info": {
55
"iso": 10000,
56
"model": "ILCE-7",
57
"flash_mode": 16,
58
"focal_length": 35,
59
"exposure_time": 0.0166667
60
},
61
"colors": [
62
{
63
"red": 206,
64
"green": 203,
65
"blue": 167,
66
"alpha": 255
67
},
68
{
69
"red": 158,
70
"green": 163,
71
"blue": 93,
72
"alpha": 255
73
}
74
]
75
},
76
"relationships": {
77
"creator": {
78
"data": {
79
"type": "account",
80
"id": "312"
81
}
82
},
83
"upload_collection": {
84
"data": {
85
"type": "upload_collection",
86
"id": "uinr2zfqQLeCo_1O0-ao-Q"
87
}
88
}
89
}
90
}
91
],
92
"meta": {
93
"total_count": 20
94
}
95
}