# Variables

## List Variables

> Retrieves a paginated list of global variables for a specific connector. Can be filtered by \`label\`, \`key\`, and \`value\`.\
> Note: In the Patchworks dashboard, a \`system\` is known as a \`connector\`.

```json
{"openapi":"3.0.0","info":{"title":"Patchworks Core API","version":"1.0.0"},"tags":[{"name":"Variables"}],"servers":[{"url":"https://core.wearepatchworks.com"}],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"API key passed in the Authorization header. Format: `<api-key>`"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"OAuth 2 Bearer token obtained from POST /fabric/api/login"}},"schemas":{"VariablesListResponse":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Variables"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"},"links":{"$ref":"#/components/schemas/PaginationLinks"}}},"Variables":{"type":"object","properties":{"id":{"type":"integer","description":"Unique identifier"},"label":{"type":"string"},"key":{"type":"string"},"value":{"type":"string"},"secret":{"type":"string"},"locked":{"type":"string"},"configurable":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"modified":{"type":"string"},"pivot":{"type":"string"},"required":{"type":"boolean"},"advanced":{"type":"boolean"},"alias":{"type":"string"}}},"PaginationMeta":{"type":"object","properties":{"current_page":{"type":"integer"},"from":{"type":"integer","nullable":true},"last_page":{"type":"integer"},"path":{"type":"string"},"per_page":{"type":"integer"},"to":{"type":"integer","nullable":true},"total":{"type":"integer"}}},"PaginationLinks":{"type":"object","properties":{"first":{"type":"string","format":"uri"},"last":{"type":"string","format":"uri"},"prev":{"type":"string","format":"uri","nullable":true},"next":{"type":"string","format":"uri","nullable":true}}}}},"paths":{"/api/v1/variables":{"get":{"summary":"List Variables","description":"Retrieves a paginated list of global variables for a specific connector. Can be filtered by `label`, `key`, and `value`.\nNote: In the Patchworks dashboard, a `system` is known as a `connector`.","parameters":[{"name":"filter[label]","in":"query","required":false,"schema":{"type":"string"},"description":"Filter results by label."},{"name":"filter[key]","in":"query","required":false,"schema":{"type":"string"},"description":"Filter results by key."},{"name":"filter[value]","in":"query","required":false,"schema":{"type":"string"},"description":"Filter results by value."},{"name":"sort","in":"query","required":false,"schema":{"type":"string"},"description":"Sort field. Prefix with - for descending. Available: label, key, value"},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1},"description":"Page number for pagination."},{"name":"per_page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100},"description":"Number of results per page."}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VariablesListResponse"}}}},"401":{"description":"Unauthenticated"},"403":{"description":"Unauthorized"}},"tags":["Variables"]}}}}
```

## Create Variable

> Creates a new global variable for a connector.\
> Note: In the Patchworks dashboard, a \`system\` is known as a \`connector\`.\
> \
> \## Validation Rules\
> \
> These are the basic validation rules for the request. More detailed validation may apply depending on the data being sent. Please see the response for any extra requirements\
> \
> \| Field | Type | Required |\
> \|---|---|---|\
> \| label | string | \&#x2611; |\
> \| key | string | \&#x2611; |\
> \| value | string | |\
> \| secret | | |\
> \| locked | | |

```json
{"openapi":"3.0.0","info":{"title":"Patchworks Core API","version":"1.0.0"},"tags":[{"name":"Variables"}],"servers":[{"url":"https://core.wearepatchworks.com"}],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"API key passed in the Authorization header. Format: `<api-key>`"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"OAuth 2 Bearer token obtained from POST /fabric/api/login"}},"schemas":{"VariablesResponse":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Variables"}}},"Variables":{"type":"object","properties":{"id":{"type":"integer","description":"Unique identifier"},"label":{"type":"string"},"key":{"type":"string"},"value":{"type":"string"},"secret":{"type":"string"},"locked":{"type":"string"},"configurable":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"modified":{"type":"string"},"pivot":{"type":"string"},"required":{"type":"boolean"},"advanced":{"type":"boolean"},"alias":{"type":"string"}}},"ErrorResponse":{"type":"object","properties":{"message":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}}},"VariablesStoreRequest":{"type":"object","properties":{"label":{"type":"string"},"key":{"type":"string"},"value":{"type":"string","nullable":true},"secret":{"type":"string"},"locked":{"type":"string"}},"required":["key","label"]}}},"paths":{"/api/v1/variables":{"post":{"summary":"Create Variable","description":"Creates a new global variable for a connector.\nNote: In the Patchworks dashboard, a `system` is known as a `connector`.\n\n## Validation Rules\n\nThese are the basic validation rules for the request. More detailed validation may apply depending on the data being sent. Please see the response for any extra requirements\n\n| Field | Type | Required |\n|---|---|---|\n| label | string | &#x2611; |\n| key | string | &#x2611; |\n| value | string | |\n| secret | | |\n| locked | | |","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VariablesResponse"}}}},"401":{"description":"Unauthenticated"},"403":{"description":"Unauthorized"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VariablesStoreRequest"}}}},"tags":["Variables"],"parameters":[]}}}}
```

## Get Variable

> Retrieves the details of a specific global variable.\
> \
> \## Available Filters\
> \
> These are the filters that can be used to specific the data to return. Please see the section on using filters for more details.\
> \
> \- label\
> \- key\
> \- value\
> \
> \
> \
> \
> \## Available Sorts\
> \
> These are the sorts that can be used order the returned data. Please see the section on using sorting for more details.\
> \
> \- label\
> \- key\
> \- value

```json
{"openapi":"3.0.0","info":{"title":"Patchworks Core API","version":"1.0.0"},"tags":[{"name":"Variables"}],"servers":[{"url":"https://core.wearepatchworks.com"}],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"API key passed in the Authorization header. Format: `<api-key>`"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"OAuth 2 Bearer token obtained from POST /fabric/api/login"}},"schemas":{"VariablesResponse":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Variables"}}},"Variables":{"type":"object","properties":{"id":{"type":"integer","description":"Unique identifier"},"label":{"type":"string"},"key":{"type":"string"},"value":{"type":"string"},"secret":{"type":"string"},"locked":{"type":"string"},"configurable":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"modified":{"type":"string"},"pivot":{"type":"string"},"required":{"type":"boolean"},"advanced":{"type":"boolean"},"alias":{"type":"string"}}}}},"paths":{"/api/v1/variables/{variable}":{"get":{"summary":"Get Variable","description":"Retrieves the details of a specific global variable.\n\n## Available Filters\n\nThese are the filters that can be used to specific the data to return. Please see the section on using filters for more details.\n\n- label\n- key\n- value\n\n\n\n\n## Available Sorts\n\nThese are the sorts that can be used order the returned data. Please see the section on using sorting for more details.\n\n- label\n- key\n- value","parameters":[{"name":"variable","in":"path","required":true,"schema":{"type":"string"},"description":"The variable identifier."},{"name":"filter[label]","in":"query","required":false,"schema":{"type":"string"},"description":"Filter results by label."},{"name":"filter[key]","in":"query","required":false,"schema":{"type":"string"},"description":"Filter results by key."},{"name":"filter[value]","in":"query","required":false,"schema":{"type":"string"},"description":"Filter results by value."},{"name":"sort","in":"query","required":false,"schema":{"type":"string"},"description":"Sort field. Prefix with - for descending. Available: label, key, value"},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1},"description":"Page number for pagination."},{"name":"per_page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100},"description":"Number of results per page."}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VariablesResponse"}}}},"401":{"description":"Unauthenticated"},"403":{"description":"Unauthorized"}},"tags":["Variables"]}}}}
```

## Update Variable

> Updates an existing global variable.\
> \
> \## Validation Rules\
> \
> These are the basic validation rules for the request. More detailed validation may apply depending on the data being sent. Please see the response for any extra requirements\
> \
> \| Field | Type | Required |\
> \|---|---|---|\
> \| label | string | |\
> \| key | string | |\
> \| value | string | |\
> \| configurable | | |

```json
{"openapi":"3.0.0","info":{"title":"Patchworks Core API","version":"1.0.0"},"tags":[{"name":"Variables"}],"servers":[{"url":"https://core.wearepatchworks.com"}],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"API key passed in the Authorization header. Format: `<api-key>`"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"OAuth 2 Bearer token obtained from POST /fabric/api/login"}},"schemas":{"VariablesResponse":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Variables"}}},"Variables":{"type":"object","properties":{"id":{"type":"integer","description":"Unique identifier"},"label":{"type":"string"},"key":{"type":"string"},"value":{"type":"string"},"secret":{"type":"string"},"locked":{"type":"string"},"configurable":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"modified":{"type":"string"},"pivot":{"type":"string"},"required":{"type":"boolean"},"advanced":{"type":"boolean"},"alias":{"type":"string"}}},"ErrorResponse":{"type":"object","properties":{"message":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}}},"VariablesUpdateRequest":{"type":"object","properties":{"label":{"type":"string"},"key":{"type":"string"},"value":{"type":"string","nullable":true},"configurable":{"type":"string"}}}}},"paths":{"/api/v1/variables/{variable}":{"put":{"summary":"Update Variable","description":"Updates an existing global variable.\n\n## Validation Rules\n\nThese are the basic validation rules for the request. More detailed validation may apply depending on the data being sent. Please see the response for any extra requirements\n\n| Field | Type | Required |\n|---|---|---|\n| label | string | |\n| key | string | |\n| value | string | |\n| configurable | | |","parameters":[{"name":"variable","in":"path","required":true,"schema":{"type":"string"},"description":"The variable identifier."}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VariablesResponse"}}}},"401":{"description":"Unauthenticated"},"403":{"description":"Unauthorized"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VariablesUpdateRequest"}}}},"tags":["Variables"]}}}}
```

## Delete Variable

> Permanently deletes a specific global variable.

```json
{"openapi":"3.0.0","info":{"title":"Patchworks Core API","version":"1.0.0"},"tags":[{"name":"Variables"}],"servers":[{"url":"https://core.wearepatchworks.com"}],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"API key passed in the Authorization header. Format: `<api-key>`"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"OAuth 2 Bearer token obtained from POST /fabric/api/login"}},"schemas":{"MessageResponse":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/api/v1/variables/{variable}":{"delete":{"summary":"Delete Variable","description":"Permanently deletes a specific global variable.","parameters":[{"name":"variable","in":"path","required":true,"schema":{"type":"string"},"description":"The variable identifier."}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageResponse"}}}},"401":{"description":"Unauthenticated"},"403":{"description":"Unauthorized"}},"tags":["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://doc.wearepatchworks.com/product-documentation/api-reference/connector-endpoints/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.
