List all records
Query parameters
For Modular Content, Structured Text and Single Block fields. If set, returns full payload for nested blocks instead of IDs
Attributes to filter records
Record (or block record) IDs to fetch, comma separated. If you use this filter, you must not use filter[type]. You can combine it with meta fields (like _published_at, _status), but must not use model-specific fields
"c89tCUarTvGKxA37acCEWA,aCiWeOsUT3mxY0KIzUfAhw"
Model/Block model ID or api_key to filter. If you use this filter, you must not use filter[ids]. When passing a single element, you can use both meta fields and model-specific fields (note: model-specific fields only work with models, not block models). When passing multiple comma-separated values, you can use meta fields but must not use model-specific fields
"cat,dog"
Textual query to match. Can be combined with other filters. When used, only records (not blocks) are returned. If locale is defined, search within that locale. Otherwise environment's main locale will be used.
"foo"
Filter by record fields. Meta fields (like _published_at, _status) can be used in most cases. Model-specific fields (like title, name) require filter[type] to specify a single model, and only work with models (not block models). Same syntax as GraphQL API records filters: use square brackets to indicate nesting levels. E.g. filter[fields][parent][eq]=<ID_VALUE>. Use snake_case for field names. If locale is defined, search within that locale. Otherwise environment's main locale will be used.
{ name: { eq: "Buddy" } }
When set, only valid records are included in the results.
"true"
When filter[query] or field[fields] is defined, filter by this locale. Default: environment's main locale
"it"
Parameters to control offset-based pagination
The (zero-based) offset of the first entity returned in the collection (defaults to 0)
200
The maximum number of entities to return (defaults to 30, maximum is 500)
Fields used to order results. You must specify also filter[type] with one element only to be able use this option. Format: <field_name>_(ASC|DESC), where <field_name> can be either the API key of a model's field, or one of the following meta columns: id, _updated_at, _created_at, _status, _published_at, _first_published_at, _publication_scheduled_at, _unpublishing_scheduled_at, _is_valid, position (only for sortable models). You can pass multiple comma separated rules.
"name_DESC"
Whether you want the currently published versions (published, default) of your records, or the latest available (current)
"current"
Returns
Returns an array of resource objects of type item.
Other examples
To fetch a specific page, you can use the page object in the query params together with its offset and limit parameters. They will still be from any model in your project.
To get 2 records starting from position 4, we should use: ?page[limit]=2page[offset]=3 (because record counting starts from 0)
GET https://site-api.datocms.com/items?page[limit]=2page[offset]=3 HTTP/1.1Authorization: Bearer YOUR-API-TOKENAccept: application/jsonX-Api-Version: 3To get 2 records starting from position 4, we should use: ?page[limit]=2page[offset]=3 (because record counting starts from 0)
curl -g 'https://site-api.datocms.com/items?page[limit]=2page[offset]=3' \ \ -H "Authorization: Bearer YOUR-API-TOKEN" \ -H "Accept: application/json" \ -H "X-Api-Version: 3"To get 2 records starting from position 4, we should use: ?page[limit]=2page[offset]=3 (because record counting starts from 0)
await fetch("https://site-api.datocms.com/items?page[limit]=2page[offset]=3", { headers: { Authorization: "Bearer YOUR-API-TOKEN", Accept: "application/json", "X-Api-Version": "3", },});HTTP/1.1 200 OKContent-Type: application/jsonCache-Control: cache-control: max-age=0, private, must-revalidateX-RateLimit-Limit: 30X-RateLimit-Remaining: 28
{ "data": [ { "id": "VDd0Ig2WTZukQ8DU9ZskXg", "type": "item", "attributes": { "name": "Shout" }, "relationships": { "item_type": { "data": { "id": "ZHiqi1KiTAuLf8GFN4k1Hg", "type": "item_type" } }, "creator": { "data": { "id": "254268", "type": "access_token" } } }, "meta": { "created_at": "2024-03-12T20:08:33.887+00:00", "updated_at": "2024-03-12T20:08:33.895+00:00", "published_at": "2024-03-12T20:08:33.945+00:00", "publication_scheduled_at": null, "unpublishing_scheduled_at": null, "first_published_at": "2024-03-12T20:08:33.945+00:00", "is_valid": true, "is_current_version_valid": true, "is_published_version_valid": true, "status": "published", "current_version": "LPlwzflrSYyH4FQhCubRgQ", "stage": null } }, { "id": "fPW3GwaCTAaCfHWr9C1RrQ", "type": "item", "attributes": { "name": "Coming Up" }, "relationships": { "item_type": { "data": { "id": "ZHiqi1KiTAuLf8GFN4k1Hg", "type": "item_type" } }, "creator": { "data": { "id": "254268", "type": "access_token" } } }, "meta": { "created_at": "2024-03-12T20:08:33.841+00:00", "updated_at": "2024-03-12T20:08:33.850+00:00", "published_at": "2024-03-12T20:08:33.882+00:00", "publication_scheduled_at": null, "unpublishing_scheduled_at": null, "first_published_at": "2024-03-12T20:08:33.882+00:00", "is_valid": true, "is_current_version_valid": true, "is_published_version_valid": true, "status": "published", "current_version": "IiCnty-tSdGnvBUZPd_g4A", "stage": null } } ], "meta": { "total_count": 264 }}You can retrieve a list of records (or blocks) by their record IDs. They can be from the same or different models.
Filtering by 2 specific record IDs, across different models (one dog record, and one song record). Note that filter[ids] must be comma-separated, with no spaces.
GET https://site-api.datocms.com/items?filter[ids]=QHr0FFO0Ro6DtNBrFCwV0A,cSp-WX-_R7m_r_hG0D0Ekg HTTP/1.1Authorization: Bearer YOUR-API-TOKENAccept: application/jsonX-Api-Version: 3Filtering by 2 specific record IDs, across different models (one dog record, and one song record). Note that filter[ids] must be comma-separated, with no spaces.
curl -g 'https://site-api.datocms.com/items?filter[ids]=QHr0FFO0Ro6DtNBrFCwV0A,cSp-WX-_R7m_r_hG0D0Ekg' \ \ -H "Authorization: Bearer YOUR-API-TOKEN" \ -H "Accept: application/json" \ -H "X-Api-Version: 3"Filtering by 2 specific record IDs, across different models (one dog record, and one song record). Note that filter[ids] must be comma-separated, with no spaces.
await fetch( "https://site-api.datocms.com/items?filter[ids]=QHr0FFO0Ro6DtNBrFCwV0A,cSp-WX-_R7m_r_hG0D0Ekg", { headers: { Authorization: "Bearer YOUR-API-TOKEN", Accept: "application/json", "X-Api-Version": "3", }, },);Showing two records from different models: dog and song. The returned record order is random, not the order of the record IDs you specified.
HTTP/1.1 200 OKContent-Type: application/jsonCache-Control: cache-control: max-age=0, private, must-revalidateX-RateLimit-Limit: 30X-RateLimit-Remaining: 28
{ "data": [ { "id": "cSp-WX-_R7m_r_hG0D0Ekg", "type": "item", "attributes": { "name": "One of Us" }, "relationships": { "item_type": { "data": { "id": "ZHiqi1KiTAuLf8GFN4k1Hg", "type": "item_type" } }, "creator": { "data": { "id": "254268", "type": "access_token" } } }, "meta": { "created_at": "2024-03-12T20:08:33.743+00:00", "updated_at": "2024-03-12T20:08:33.755+00:00", "published_at": "2024-03-12T20:08:34.240+00:00", "publication_scheduled_at": null, "unpublishing_scheduled_at": null, "first_published_at": "2024-03-12T20:08:34.240+00:00", "is_valid": true, "is_current_version_valid": true, "is_published_version_valid": true, "status": "published", "current_version": "SjWxQjSCRy-g_B7t1GcnPw", "stage": null } }, { "id": "QHr0FFO0Ro6DtNBrFCwV0A", "type": "item", "attributes": { "name": "Maji", "breed": "mixed" }, "relationships": { "item_type": { "data": { "id": "MtzQYUvbS-S0LM2LZ5QlkQ", "type": "item_type" } }, "creator": { "data": { "id": "104280", "type": "account" } } }, "meta": { "created_at": "2024-01-26T20:24:36.462+00:00", "updated_at": "2024-01-26T20:24:36.618+00:00", "published_at": "2024-01-26T20:24:36.779+00:00", "publication_scheduled_at": null, "unpublishing_scheduled_at": null, "first_published_at": "2024-01-26T20:24:36.779+00:00", "is_valid": true, "is_current_version_valid": true, "is_published_version_valid": true, "status": "published", "current_version": "YmES_iXOT3GguMQXoFZcWw", "stage": null } } ], "meta": { "total_count": 2 }}You can filter the records by one or more model types. You can use either the model's api_key (that you define) or its unique ID (generated by DatoCMS). Multiple comma-separated values are accepted:
Filtering by the model with api_key cat and the model with ID of dog:
GET https://site-api.datocms.com/items?filter[type]=cat,MtzQYUvbS-S0LM2LZ5QlkQ HTTP/1.1Authorization: Bearer YOUR-API-TOKENAccept: application/jsonX-Api-Version: 3Filtering by the model with api_key cat and the model with ID of dog:
curl -g 'https://site-api.datocms.com/items?filter[type]=cat,MtzQYUvbS-S0LM2LZ5QlkQ' \ \ -H "Authorization: Bearer YOUR-API-TOKEN" \ -H "Accept: application/json" \ -H "X-Api-Version: 3"Filtering by the model with api_key cat and the model with ID of dog:
await fetch( "https://site-api.datocms.com/items?filter[type]=cat,MtzQYUvbS-S0LM2LZ5QlkQ", { headers: { Authorization: "Bearer YOUR-API-TOKEN", Accept: "application/json", "X-Api-Version": "3", }, },);HTTP/1.1 200 OKContent-Type: application/jsonCache-Control: cache-control: max-age=0, private, must-revalidateX-RateLimit-Limit: 30X-RateLimit-Remaining: 28
{ "data": [ { "id": "QHr0FFO0Ro6DtNBrFCwV0A", "type": "item", "attributes": { "name": "Maji", "breed": "mixed" }, "relationships": { "item_type": { "data": { "id": "MtzQYUvbS-S0LM2LZ5QlkQ", "type": "item_type" } }, "creator": { "data": { "id": "104280", "type": "account" } } }, "meta": { "created_at": "2024-01-26T20:24:36.462+00:00", "updated_at": "2024-01-26T20:24:36.618+00:00", "published_at": "2024-01-26T20:24:36.779+00:00", "publication_scheduled_at": null, "unpublishing_scheduled_at": null, "first_published_at": "2024-01-26T20:24:36.779+00:00", "is_valid": true, "is_current_version_valid": true, "is_published_version_valid": true, "status": "published", "current_version": "YmES_iXOT3GguMQXoFZcWw", "stage": null } }, { "id": "RGLUGlQiTKiAQuB3D9C_1g", "type": "item", "attributes": { "name": "Higgins", "breed": "hovawart" }, "relationships": { "item_type": { "data": { "id": "MtzQYUvbS-S0LM2LZ5QlkQ", "type": "item_type" } }, "creator": { "data": { "id": "104280", "type": "account" } } }, "meta": { "created_at": "2024-01-26T20:23:49.239+00:00", "updated_at": "2024-01-26T20:23:49.247+00:00", "published_at": "2024-01-26T20:23:49.267+00:00", "publication_scheduled_at": null, "unpublishing_scheduled_at": null, "first_published_at": "2024-01-26T20:23:49.267+00:00", "is_valid": true, "is_current_version_valid": true, "is_published_version_valid": true, "status": "published", "current_version": "WvWbSB9iQfG8o2mg_f5K5A", "stage": null } } ], "meta": { "total_count": 2 }}Within a specified model, you can further filter its records by their field values.
You must specify a single model using filter[type]. You cannot filter by field value across multiple models at once.
Valid filters are documented at GraphQL API records filters, so please check there. However, you cannot use deep filtering on Modular Content and Structured Text fields at the moment.
- You may add an optional
localeparameter if you are filtering by a localized field. - You may add an optional
order_byparameter.
In this example, we are filtering the model dog by:
- A single-line string field,
name in ['Buddy','Rex'](matchingBuddyORRex) - A single-line string field,
breed eq 'mixed'(matching exactlymixed) - A date field (
_updated_at) (and ordering the results by the same)
Note the special handling of the in filter for the name field. Instead of a comma-separated string, it's two separate [fields][name][in][] parameters.
GET https://site-api.datocms.com/items?filter[type]=dog&filter[fields][name][in][]=Buddy&filter[fields][name][in][]=Rex&filter[fields][breed][eq]=mixed&filter[fields][_updated_at][gt]=2020-04-18T00:00:00&order_by=_updated_at_ASC HTTP/1.1Authorization: Bearer YOUR-API-TOKENAccept: application/jsonX-Api-Version: 3Note the special handling of the in filter for the name field. Instead of a comma-separated string, it's two separate [fields][name][in][] parameters.
curl -g 'https://site-api.datocms.com/items?filter[type]=dog&filter[fields][name][in][]=Buddy&filter[fields][name][in][]=Rex&filter[fields][breed][eq]=mixed&filter[fields][_updated_at][gt]=2020-04-18T00:00:00&order_by=_updated_at_ASC' \ \ -H "Authorization: Bearer YOUR-API-TOKEN" \ -H "Accept: application/json" \ -H "X-Api-Version: 3"Note the special handling of the in filter for the name field. Instead of a comma-separated string, it's two separate [fields][name][in][] parameters.
await fetch( "https://site-api.datocms.com/items?filter[type]=dog&filter[fields][name][in][]=Buddy&filter[fields][name][in][]=Rex&filter[fields][breed][eq]=mixed&filter[fields][_updated_at][gt]=2020-04-18T00:00:00&order_by=_updated_at_ASC", { headers: { Authorization: "Bearer YOUR-API-TOKEN", Accept: "application/json", "X-Api-Version": "3", }, },);HTTP/1.1 200 OKContent-Type: application/jsonCache-Control: cache-control: max-age=0, private, must-revalidateX-RateLimit-Limit: 30X-RateLimit-Remaining: 28
{ "data": [ { "id": "EA4kSeoVQqKSR88cVq2kqQ", "type": "item", "attributes": { "name": "Rex", "breed": "mixed" }, "relationships": { "item_type": { "data": { "id": "MtzQYUvbS-S0LM2LZ5QlkQ", "type": "item_type" } }, "creator": { "data": { "id": "104280", "type": "account" } } }, "meta": { "created_at": "2024-03-12T22:30:44.137+00:00", "updated_at": "2024-03-12T22:30:44.146+00:00", "published_at": "2024-03-12T22:30:44.178+00:00", "publication_scheduled_at": null, "unpublishing_scheduled_at": null, "first_published_at": "2024-03-12T22:30:44.178+00:00", "is_valid": true, "is_current_version_valid": true, "is_published_version_valid": true, "status": "published", "current_version": "QIjEZ8glRkix0gt9uz0Pfg", "stage": null } }, { "id": "B1E0yYBORgmRpa_oK5LrOw", "type": "item", "attributes": { "name": "Buddy", "breed": "mixed" }, "relationships": { "item_type": { "data": { "id": "MtzQYUvbS-S0LM2LZ5QlkQ", "type": "item_type" } }, "creator": { "data": { "id": "104280", "type": "account" } } }, "meta": { "created_at": "2024-01-30T00:11:04.310+00:00", "updated_at": "2024-03-12T22:31:26.455+00:00", "published_at": "2024-03-12T22:31:26.491+00:00", "publication_scheduled_at": null, "unpublishing_scheduled_at": null, "first_published_at": "2024-01-30T00:11:04.340+00:00", "is_valid": true, "is_current_version_valid": true, "is_published_version_valid": true, "status": "published", "current_version": "KhshsDnyRVi3aMzBBs7QMQ", "stage": null } } ], "meta": { "total_count": 2 }}You can retrieve a list of records filtered by a textual query match. It will search in block records content too. Set the nested parameter to true to retrieve embedded block content as well.
Please note that you need to wait at least 30 seconds after creating or updating content before expecting to see results in textual queries.
You can narrow your search to some models by specifying the filter[type] parameter. You can use either the model's api_key or its unique ID. Multiple comma-separated values are accepted.
You should specify the locale attribute, or the environment's default locale will be used.
Returned records are ordered by rank.
GET https://site-api.datocms.com/items?filter[type]=dog,cat&filter[query]=chicken&locale=en&order_by=_rank_DESC HTTP/1.1Authorization: Bearer YOUR-API-TOKENAccept: application/jsonX-Api-Version: 3curl -g 'https://site-api.datocms.com/items?filter[type]=dog,cat&filter[query]=chicken&locale=en&order_by=_rank_DESC' \ \ -H "Authorization: Bearer YOUR-API-TOKEN" \ -H "Accept: application/json" \ -H "X-Api-Version: 3"await fetch( "https://site-api.datocms.com/items?filter[type]=dog,cat&filter[query]=chicken&locale=en&order_by=_rank_DESC", { headers: { Authorization: "Bearer YOUR-API-TOKEN", Accept: "application/json", "X-Api-Version": "3", }, },);HTTP/1.1 200 OKContent-Type: application/jsonCache-Control: cache-control: max-age=0, private, must-revalidateX-RateLimit-Limit: 30X-RateLimit-Remaining: 28
{ "data": [ { "id": "B1E0yYBORgmRpa_oK5LrOw", "type": "item", "attributes": { "name": "Buddy", "breed": "mixed", "description": "Buddy loves chicken. Just make sure it's cooked and doesn't have any seasonings or bones!" }, "relationships": { "item_type": { "data": { "id": "MtzQYUvbS-S0LM2LZ5QlkQ", "type": "item_type" } }, "creator": { "data": { "id": "104280", "type": "account" } } }, "meta": { "created_at": "2024-01-30T00:11:04.310+00:00", "updated_at": "2024-03-12T22:31:26.455+00:00", "published_at": "2024-03-12T22:31:26.491+00:00", "publication_scheduled_at": null, "unpublishing_scheduled_at": null, "first_published_at": "2024-01-30T00:11:04.340+00:00", "is_valid": true, "is_current_version_valid": true, "is_published_version_valid": true, "status": "published", "current_version": "KhshsDnyRVi3aMzBBs7QMQ", "stage": null } }, { "id": "c89tCUarTvGKxA37acCEWA", "type": "item", "attributes": { "name": "Sheriff", "breed": "domestic_longhair", "description": "Sheriff loves salmon, sweet potatoes and chicken." }, "relationships": { "item_type": { "data": { "id": "JwCG35JtS_y92WZoOq1Ujw", "type": "item_type" } }, "creator": { "data": { "id": "104280", "type": "account" } } }, "meta": { "created_at": "2024-01-26T20:23:31.721+00:00", "updated_at": "2024-01-30T00:24:16.370+00:00", "published_at": "2024-01-30T00:24:16.393+00:00", "publication_scheduled_at": null, "unpublishing_scheduled_at": null, "first_published_at": "2024-01-26T20:23:31.752+00:00", "is_valid": true, "is_current_version_valid": true, "is_published_version_valid": true, "status": "published", "current_version": "Uh_nr0kWRZy54W91MWrdLg", "stage": null } } ], "meta": { "total_count": 2 }}