# 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](https://docs.redivis.com/api/referencing-resources) for more information.                                                                                                                                                                 |
| datasetReference  | <p>A qualified reference to a dataset. See <a href="../../referencing-resources">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="../../referencing-resources">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](https://docs.redivis.com/api/rest-api/general-structure)
{% 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.](https://docs.redivis.com/api/rest-api/authorization)

## Response body

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