Skip to content

The published documents of a collection, newest first

GET
/collections/{collection}/documents
curl --request GET \
--url 'http://localhost:3000/api/v1/collections/example/documents?limit=20&sort=-publishedDate'
collection
required
string
/^[a-z][a-z0-9-]*$/
limit
integer
default: 20 >= 1 <= 100
cursor
string

The nextCursor of the previous page. Opaque.

tag
string

Only the documents with this tag in a tags field.

sort
string

publishedAt or a simple field (text, textarea, slug, date, number, select, boolean). A leading - reverses the order. Default: the order of the collection.

One page of documents.

Media typeapplication/json
object
documents
required
Array<object>
object
id
required
string format: uuid
collection
required
string
slug
required
string
path
required

The URL of the document on the site.

string
versionId
required

The published version. Null in a preview.

string | null format: uuid
publishedAt
required
string | null format: date-time
data
required

The field values. A media field is a Media object or null. A richText field is the TipTap JSON plus html, the sanitized HTML, or null. A blocks field is a list of objects with _id, _type and the block fields. A relation field is a RelatedDocument or null, or with multiple a list of RelatedDocument: published targets only.

object
key
additional properties
any
total
required

The number of documents that match, on all pages.

integer
nextCursor
required
string | null

Example generated

{
"documents": [
{
"id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"collection": "example",
"slug": "example",
"path": "example",
"versionId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"publishedAt": "2026-04-15T12:00:00Z",
"data": {}
}
],
"total": 1,
"nextCursor": "example"
}
ETag
string

Send it back in If-None-Match to get a 304.

The ETag in If-None-Match is current. No body.

A query parameter is not valid.

Media typeapplication/json
object
error
required
string
Allowed values: bad_request invalid_token not_found method_not_allowed rate_limited internal moved unavailable cursor_expired
message
required
string

Example

{
"error": "bad_request"
}

No such collection, published document or media.

Media typeapplication/json
object
error
required
string
Allowed values: bad_request invalid_token not_found method_not_allowed rate_limited internal moved unavailable cursor_expired
message
required
string

Example

{
"error": "bad_request"
}

Too many requests from this address.

Media typeapplication/json
object
error
required
string
Allowed values: bad_request invalid_token not_found method_not_allowed rate_limited internal moved unavailable cursor_expired
message
required
string

Example

{
"error": "bad_request"
}
Retry-After
integer