younifyd
Menu

Get Documents

Get one or more documents

GET/data/doc/{dataset}/{documentId}

Use it in a workflow

  1. Add a step and choose the Sanity connector.
  2. Pick the Get Documents action (under Documents).
  3. Fill in the fields below, then reference the result from later steps as {{getDocuments.response.data}}.

Request

Path parameters

datasetstringrequired
documentIdarray<string>required

Comma-separated list of document IDs. IDs aren't validated beyond UTF-8 encoding, so an ID that doesn't match any document is listed in `omitted` with the reason `existence`.

Query parameters

includeAllVersionsboolean

If true, also return the draft and every release version of each published document ID you request. This only applies to published IDs: a draft or version ID returns only that document. Drafts and release versions are returned even if the published document doesn't exist, in which case the published ID is also listed in `omitted` with the reason `existence`. The parameter can be passed without a value (`?includeAllVersions`), which is the same as `true`. Requires API version v2025-02-19 or later. Earlier API versions reject the parameter with a `400` error.

Default false

excludeContentboolean

If true, return `documents` as `null` and return only `omitted`. Use this to check whether documents exist without fetching their content. The parameter requires a value: `?excludeContent` without one returns a `400` error.

Default false

tagstring

A tag to identify the request in logs. Can be passed only once.

Response

Returns 200 with an object. Read it in later steps with {{getDocuments.response.data.<field>}}.

documentsarray | null

The documents the request can read. `null` when `excludeContent` is true.

omittedarray<object>

IDs that weren't returned, with the reason. `existence` means no document has that ID. `permission` means the request can't read the document.

idstring
reasonstring

One ofexistencepermission

json
{
  "documents": null,
  "omitted": [
    {
      "id": "string",
      "reason": "existence"
    }
  ]
}

Need more? See the Sanity guide for connection setup and behaviour shared by every action.