younifyd
Menu

Post Data Query Dataset

Query using POST method

POST/data/query/{dataset}

Use it in a workflow

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

Request

Path parameters

datasetstringrequired

Dataset name

Query parameters

explainoneOf

Whether to include the query execution plan as plain text in an `explain` field. Set to `only` to return the plan without running the query; `result` is then `null`.

resultSourceMaponeOf

If true, the response includes a `resultSourceMap` field with content source map metadata. Set to `withKeyArraySelector` to use `_key`-based array selectors in source paths.

perspectivestring

Runs the query against the selected perspective: * `drafts`: Query runs as if all draft documents and changes were published. * `published`: Query runs as if no draft documents or changes exist. * `raw`: Query runs without distinguishing between drafts, release versions, or published documents. * Release stack: A comma-separated list of release IDs, optionally including `drafts`, to create a custom perspective. Earlier entries take precedence. The list can contain up to 200 entries. Requires API version `v2025-02-19` or later; earlier versions return a 400 error. Defaults to `published` in API version `v2025-02-19` and later. Earlier API versions default to `raw`. The CDN endpoint only accepts `published` and `raw`. Any other perspective returns a 400 error. For POST requests, pass `perspective` as a URL query parameter. The request body doesn't accept it.

Default "published"

tagstring

Request tags are values assigned to API and CDN requests that can be used to filter and aggregate log data within request logs from your Sanity Content Lake. Learn more in the request tags documentation.

returnQueryboolean

If false, the response will not include the submitted query

Default true

cacheModestring

Set to `noStale` to disable stale-while-revalidate on CDN responses. Use it for live queries that must not serve stale data after the cache expires.

One ofnoStale

lastLiveEventIdstring

The ID of the last event received from the Live Content API. The CDN uses it to serve a response that is at least as fresh as that event.

Request body

Enter the body as JSON in the step's Body field.

querystringrequired

The GROQ query

paramsobject

The params-part is optional. You don't use the $-prefixes when submitting as json

returnQueryboolean

If false, the response will not include the submitted query

Default true

json
{
  "query": "string",
  "params": {},
  "returnQuery": true
}

Response

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

msnumber

Server-side processing time

querystring

Submitted query. Omitted when `returnQuery` is false.

resultany

Query result (can be any valid JSON value)

syncTagsarray<string>
explainstring

Query execution plan as plain text. Only present when `explain` is set.

resultSourceMapobject

Content source map metadata for the result. Only present when `resultSourceMap` is set.

json
{
  "ms": 0,
  "query": "string",
  "result": null,
  "syncTags": [
    "string"
  ],
  "explain": "string",
  "resultSourceMap": {}
}

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