# List variables

> The variables and secrets of the workspace in one region, newest first. A secret's value is never answered.

Source: https://docs.stacksync.com/api-reference/variables/list_variables

`GET https://api.stacksync.com/v1/workspaces/{workspace_id}/variables`

- Operation: `list_variables`
- Resource: Variables
- Access: read-only

## Authentication

- `Authorization: Bearer <key>`: A workspace API key (workspace_…, created by a workspace owner under Workspace settings > Stacksync API) acts with editor rights on that workspace only; a user API key (user_…, created under Profile > Stacksync API) acts as that user in every workspace they belong to. POST, PUT and PATCH requests must send Content-Type: application/json. Every authentication failure answers 403.

## Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `workspace_id` | integer | Yes | The workspace. List the ones your key can reach with GET /v1/workspaces. |

## Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `limit` | integer, 1 to 200, default 50 | No | Maximum number of items returned, at most 200 |
| `offset` | integer, at least 0, default 0 | No | Number of items skipped before the first one returned |
| `region` | string (besg \| usnv) | Yes | Data region of the resources: besg (Europe) or usnv (United States), as GET /v1/regions lists them. |

## Returns

### 200 OK

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | array of object (Variable) | Yes |  |
| `data[].variable_id` | string | Yes |  |
| `data[].variable_name` | string | Yes |  |
| `data[].variable_resource_id` | string | Yes |  |
| `data[].description` | string \| null | Yes |  |
| `data[].is_secret` | boolean | Yes | A secret's value is encrypted and never answered |
| `data[].value` | string \| null | Yes | The value as text (JSON text for object, array and json); null for a secret |
| `data[].value_type` | string (string \| number \| boolean \| object \| array \| json) \| null | Yes | How workflow steps read the value; for a secret, answered by GET /variables/<id> (stored encrypted with its value, not read by the list) |
| `data[].reference` | string | Yes | What a workflow step writes to read the variable |
| `data[].parent_folder_id` | string \| null | Yes |  |
| `data[].created_time` | string (date-time) | Yes |  |
| `data[].last_modified_time` | string (date-time) | Yes |  |
| `data[].region` | string (besg \| usnv) | Yes |  |
| `has_more` | boolean | Yes | Whether more items follow this page: request the next one with offset + limit |
| `limit` | integer | Yes |  |
| `offset` | integer | Yes |  |

## Example request

```bash
curl -X GET "https://api.stacksync.com/v1/workspaces/{workspace_id}/variables?region=besg" \
  -H "Authorization: Bearer $STACKSYNC_API_KEY"
```

## Example response (200)

```json
{
  "data": [
    {
      "variable_id": "<variable_id>",
      "variable_name": "<variable_name>",
      "variable_resource_id": "<variable_resource_id>",
      "description": "<description>",
      "is_secret": false,
      "value": "<value>",
      "value_type": "string",
      "reference": "<reference>",
      "parent_folder_id": "<parent_folder_id>",
      "created_time": "2027-01-15T09:00:00Z",
      "last_modified_time": "2027-01-15T09:00:00Z",
      "region": "besg"
    }
  ],
  "has_more": false,
  "limit": 0,
  "offset": 0
}
```

## Errors

| Status | Meaning | Body |
| --- | --- | --- |
| 400 | Bad Request | `{ "error": string, "msg": string, "field": string \| null }` |
| 403 | Forbidden | `{ "error": string, "msg": string, "field": string \| null }` |

## Related

- [API Reference overview](https://docs.stacksync.com/api-reference): base URLs, regions, pagination, idempotency and errors
- [Authentication](https://docs.stacksync.com/api-reference/authentication): API keys and the 403 answers
- OpenAPI document: https://docs.stacksync.com/openapi.json
- [Get a variable](https://docs.stacksync.com/api-reference/variables/get_variable)
- [Create a variable](https://docs.stacksync.com/api-reference/variables/create_variable)
- [Update a variable](https://docs.stacksync.com/api-reference/variables/update_variable)
- [Delete a variable](https://docs.stacksync.com/api-reference/variables/delete_variable)