# bulkPatch

## Overview

This endpoint is used for updating metadata on multiple variables within a dataset, workflow, or table.

## HTTP Request

```http
PATCH /api/v1/tables/:tableReference/variables
PATCH /api/v1/datasets/:datasetReference/variables
PATCH /api/v1/datasets/:workflowReference/variables
```

## Path parameters

| Parameter         |                                                                                                                                                                                                                                                                                                         |
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| tableReference    | A qualified reference to a table. See [referencing resources](/api/referencing-resources.md) for more information.                                                                                                                                                                                      |
| datasetReference  | <p>A qualified reference to a dataset. See <a href="/pages/-LzsPrAlHWxazTnhQQJE">referencing resources</a> for more information.<br><br>When bulk updating variables on a dataset, variables across <em>all</em> tables in the dataset will be updated, if their names match the update payload.</p>    |
| workflowReference | <p>A qualified reference to a workflow. See <a href="/pages/-LzsPrAlHWxazTnhQQJE">referencing resources</a> for more information.<br><br>When bulk updating variables on a workflow, variables across <em>all</em> tables in the workflow will be updated, if their names match the update payload.</p> |

{% hint style="info" %}
This endpoint extends the [general API structure](/api/rest-api/general-structure.md)
{% endhint %}

## Request body

Provide a JSON object with a `variables` array, where each entity in the array is an object corresponding to a variable whose properties you would like to update. All fields are optional. To unset a value, specify `null` for the given property.

<table><thead><tr><th width="249.46614583333331">Property name</th><th width="162.91015625">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>variables</strong></td><td><strong>array[object]</strong></td><td><p>An array of the variables that you'd like to update. </p><p></p><p>Each entry in the array is an object with with a <code>name</code> property (corresponding to the variable name) and any other metadata properties that you want to update.</p></td></tr><tr><td><strong>variables[].name</strong></td><td><strong>string</strong></td><td><strong>Required.</strong> The name (case-insensitive) of the variable to update. If the variable does not exist in the table, an error will be thrown.</td></tr><tr><td><strong>variables[].label</strong></td><td><strong>string</strong></td><td>A human-readable label for the variable. Must be less than or equal to 256 characters. </td></tr><tr><td><strong>variables[].description</strong></td><td><strong>string</strong></td><td>A longer description of the variable. Must be less than or equal to 5,000 characters.</td></tr><tr><td><strong>variables[].valueLabels</strong></td><td><strong>array[object]</strong></td><td>A mapping between values in the data and human readable labels. Passed as an array of objects, each with "value" and "label" properties. E.g., <br><code>[{</code> <br>  <code>"value": "1",</code> <br>  <code>"label": "Yes"</code><br><code>},{</code><br>  <code>"value": "2"</code><br>  <code>"label": "No"</code><br><code>}]</code>. <br><br>The total length of all values + labels cannot exceed 1 million characters.</td></tr></tbody></table>

## Authorization

Edit access to the corresponding dataset is required. Your access token must have the following scope:

* data.edit *(if updating dataset tables)*
* workflow\.write *(if updating workflow tables)*

[Learn more about authorization.](/api/rest-api/authorization.md)

## Response body

No body is returned in the bulkPatch response. You may call [variable.list](/api/rest-api/variables/list.md) to re-fetch any updated variables.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.redivis.com/api/rest-api/variables/bulkpatch.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
