younifyd
Menu

Post Data Mutate Dataset

Mutate documents

POST/data/mutate/{dataset}

Use it in a workflow

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

Request

Path parameters

datasetstringrequired

The dataset to mutate

Query parameters

returnIdsboolean

If true, the id's of modified documents are returned.

Default false

returnDocumentsboolean

If true, the entire content of changed documents is returned.

Default false

autoGenerateArrayKeysboolean

If true, adds a _key attribute to array items, unique within the array, to ensure each can be addressed uniquely in a real-time collaboration context, even if elements are inserted or removed elsewhere in the array.

Default false

transactionIdstring

By default every transaction gets a random ID. This is included in Listener mutation events and the History API. This parameter lets you set your own transaction ID. It must be unique in the dataset.

skipCrossDatasetReferencesValidationboolean

If true then any cross-dataset references will be considered weak for the purposes of this mutation.

Default false

visibilitystring

Can be: sync, async or deferred If sync the request will not return until the requested changes are visible to subsequent queries, if async the request will return immediately when the changes have been committed, but it might still be a second or so until you can see the change reflected in a query. For maximum performance, use async always, except when you need your next query to see the changes you made. deferred is the fastest way to write. It bypasses the real time indexing completely, and should be used in cases where you are bulk importing/mutating a large number of documents and don't need to see that data in a query for several tens of seconds.

Default "sync"

dryRunboolean

If true, the mutation will be validated but not executed

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](https://www.sanity.io/docs/platform-management/request-logs). Learn more in the [request tags documentation](https://www.sanity.io/docs/platform-management/reference-api-request-tags).

Request body

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

mutationsarray<object>required

Array of mutations to perform

json
{
  "mutations": [
    {}
  ]
}

Response

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

transactionIdstring

Unique identifier for the transaction

resultsarray<object>

Results of each mutation

operationstring

The type of mutation performed

documentIdstring

The ID of the affected document

json
{
  "transactionId": "string",
  "results": [
    {
      "operation": "string",
      "documentId": "string"
    }
  ]
}

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