# Working with variables

## Adding/managing variables

A **variable** is a value that can change, depending on conditions or information supplied by the user. Using the Patchworks connector builder, variables can be defined at different levels:

| Level                                                                                                                                                                                                        | Summary                                                                                                                                                                                                                                                                                                                                                                                                                         |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Connector instance (connector variables)](/product-documentation/developer-hub/connector-builder/building-your-own-connector/3-authentication-methods/authentication-method-options/connector-variables.md) | **Connector instance variables** defined here can be used when you [configure authentication methods](/product-documentation/developer-hub/connector-builder/building-your-own-connector/3-authentication-methods/authentication-method-options.md). If you're defining multiple authentication methods which share common variables, define them once here and then choose to 'use' them in subsequent authentication methods. |
| [Authentication method (auth variables)](/product-documentation/developer-hub/connector-builder/building-your-own-connector/3-authentication-methods/authentication-method-options/auth-variables.md)        | **Auth variables** (whether added directly or picked up and 'used' from predefined **connector instance variables**) are displayed as fields for your users to complete whenever the associated authentication method is used to [add a connector instance](/product-documentation/connectors-and-instances/working-with-instances/adding-an-instance.md).                                                                      |
| [Endpoint variables](/product-documentation/developer-hub/connector-builder/building-your-own-connector/4-endpoints/endpoint-options/endpoint-variables.md)                                                  | **Endpoint variables** are displayed as fields for your users to complete whenever they configure a process flow connection shape to use an associated endpoint.                                                                                                                                                                                                                                                                |

When a [process flow](/product-documentation/process-flows/about-process-flows.md) runs, any associated API requests are injected with user-provided variable values wherever a corresponding `{{variable}}` is found. &#x20;

{% hint style="info" %}
All variables added to connector builder API requests should be placed within double-curly brackets - for example: `{{product_type}}`.
{% endhint %}

The sections below explain the use of variables in general terms - for specific guidance in a particular context, please use the links provided [above](#about-parameters).

## Adding a variable

When you choose to add or edit a variable, the **add variable** or **manage variable** page is displayed:

<div align="left"><figure><img src="/files/IDxqZO4xq9yvc1fVZn4O" alt="" width="563"><figcaption></figcaption></figure></div>

Options on this page are the same, irrespective of whether you're adding/managing [connector variables](/product-documentation/developer-hub/connector-builder/building-your-own-connector/3-authentication-methods/authentication-method-options/connector-variables.md), [auth variables](/product-documentation/developer-hub/connector-builder/building-your-own-connector/3-authentication-methods/authentication-method-options/auth-variables.md) or [endpoint variables](/product-documentation/developer-hub/connector-builder/building-your-own-connector/4-endpoints/endpoint-options/endpoint-variables.md). Use the table below as a guide for completing this page:

| Field         | Summary                                                                                                                      |
| ------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| Key           | The name to be used by Patchworks internally, when referencing this variable.                                                |
| Display name  | The field label that users will see if they are asked to enter a value for this variable.                                    |
| Alias         | The name used by the actual system when referencing this variable.                                                           |
| Default value | Enter a default value to be shown when this field is displayed to users. The maximum number of characters permitted is 1024. |

The remaining fields on this page determine if/how your users will interact with this variable when [adding an instance](/product-documentation/connectors-and-instances/working-with-instances/adding-an-instance.md) of this connector:

| Field                            | Summary                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Is this required?                | <p>Toggle this option <strong>on</strong> to make this a mandatory field when a user either:</p><ul><li><a href="/pages/8b0V4AbjjCtqyMhraqE5">is asked to provide credentials for a new instance</a> (in the case of <a href="/pages/tOP1jgrOac0C81gWWJux">connector</a> and <a href="/pages/O6WRM5jEvEnuXAg0Kurw">auth variables</a>) </li><li>configures a <a href="/pages/ksVeuo8Bz6ah8fn0PpJx">connection shape</a> with a given endpoint (in the case of <a href="/pages/NkagMrYpKNNL9YbPDcsq">endpoint variables</a>).  </li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| Is this configurable             | <p>Toggle this option <strong>on</strong> to make this an optional field when a user either:</p><ul><li><a href="/pages/8b0V4AbjjCtqyMhraqE5">is asked to provide credentials for a new instance</a> (in the case of <a href="/pages/tOP1jgrOac0C81gWWJux">connector</a> and <a href="/pages/O6WRM5jEvEnuXAg0Kurw">auth variables</a>) </li><li>configures a <a href="/pages/ksVeuo8Bz6ah8fn0PpJx">connection shape</a> with a given endpoint (in the case of <a href="/pages/NkagMrYpKNNL9YbPDcsq">endpoint variables</a>).  </li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| Is this for advanced users only? | <p>Advanced variables are those which 'regular' users would not typically need to see or change, but which advanced users might want to change in exceptional cases. </p><p></p><p>With this option toggled <strong>on</strong>, the field for this variable is hidden in an <strong>advanced</strong> section </p><p>when a user either:</p><ul><li><a href="/pages/8b0V4AbjjCtqyMhraqE5">is asked to provide credentials for a new instance</a> (in the case of <a href="/pages/tOP1jgrOac0C81gWWJux">connector</a> and <a href="/pages/O6WRM5jEvEnuXAg0Kurw">auth variables</a>) </li><li>configures a <a href="/pages/ksVeuo8Bz6ah8fn0PpJx">connection shape</a> with a given endpoint (in the case of <a href="/pages/NkagMrYpKNNL9YbPDcsq">endpoint variables</a>).  </li></ul><p>Only select this option if this is a variable that 'regular' users would NOT typically need to see or change - but which advanced users might want to change in exceptional cases. </p><p></p><p>For example, the <code>content-type</code> variable might typically be set too <code>application/json</code> but you need to allow for edge cases in NetSuite, where an advanced user might want to change it to <code>application/xml</code>. </p> |
| Is this variable a secret?       | Toggle this option **on** if values entered for this field are sensitive. Secret variables are encrypted and displayed as asterisks within the dashboard UI.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |

## Editing a variable

To edit a variable, simply click the variable name to open the standard variable settings page - for example:

<div align="left"><figure><img src="/files/4f68JEkOoIS1NJMCEUbq" alt="" width="563"><figcaption></figcaption></figure></div>

From here, you can make your required changes and click the **save** button.

{% hint style="info" %}
In some cases, a variable may be locked - these are variables which are required by Patchworks to perform a particular function (for example, default variables associated with [authentication methods](/product-documentation/developer-hub/connector-builder/building-your-own-connector/3-authentication-methods/authentication-method-options.md)). In this case, you can't change settings or remove the variable, but you can [change the display name](#renaming-a-locked-variable).
{% endhint %}

## Renaming a locked variable

In the case of a locked variable, you can change the name that users see for the associated field when they are asked to provide a value.

As such, we need to rename the To do this, click the field name and update the **display name** as appropriate - for example:

<div align="left"><figure><img src="/files/OkCvbM3q4qFIKVv0HgB8" alt=""><figcaption></figcaption></figure></div>

<details>

<summary><img src="/files/JOYoP4EdSu7WJ3CMdAAS" alt="" data-size="line"> Show me</summary>

![](/files/qI4DZz7lnlg1DLO2UzOq)

</details>


---

# 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://doc.wearepatchworks.com/product-documentation/developer-hub/connector-builder/building-your-own-connector/techniques-for-working-with-variables-and-parameters/working-with-variables.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.
