# Tag Manager Variables

> Manage reusable variables that tags and triggers reference inside a tag manager: data-layer lookups, constants, lookup tables, and derived values.

Source: https://docs.oursprivacy.com/docs/platform-api/tag-manager-variables

Variables are reusable lookups that [tags](https://docs.oursprivacy.com/docs/platform-api/tag-manager-tags) and [triggers](https://docs.oursprivacy.com/docs/platform-api/tag-manager-triggers) reference instead of hardcoding values. Call `GET /rest/v1/tag-manager-variables/types` for the full set of supported `type` values (`DataLayer`, `Constant`, `UrlParameter`, `Cookie`, `JavaScript`, etc.) and the per-type `parameters` schema.

For variable types where `supportsVariables` is `true`, the variable's own `parameters` fields can contain `{{OtherVariable}}` references that resolve at runtime.

Folder assignment goes through `POST /rest/v1/tag-manager-asset-folders`, so `folderId` is read-only on this endpoint.

## GET /rest/v1/tag-manager-variables

List variables inside a single tag manager. Requires the `tagManagerId` query parameter — variables are always scoped to one parent container. Supports cursor pagination via `limit` and `cursor`; the limit clamp is 1000 so a single request can return the full set (the web-app workspace renders all variables in one shot). Requires API-key scope or current OAuth user permission: tagManagers:find

Request URL: `GET https://app.oursprivacy.com/rest/v1/tag-manager-variables`

Authentication: apiKey or oauth2.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `limit` | query | integer \| null | No | Maximum number of variables to return. Defaults to 25; values below 1 are clamped to 1 and values above 1000 are clamped to 1000. Maximum number of variables to return. Defaults to 25; values below 1 are clamped to 1 and values above 1000 are clamped to 1000. |
| `cursor` | query | string | No | Opaque pagination cursor from pagination.nextCursor in the previous response. Do not decode or modify it. Malformed cursors return 400 Bad Request. Opaque pagination cursor from pagination.nextCursor in the previous response. Do not decode or modify it. Malformed cursors return 400 Bad Request. |
| `tagManagerId` | query | string | Yes | Parent tag manager whose variables should be returned. Variables are always scoped to one tag manager; discover ids with `GET /tag-managers`. Parent tag manager whose variables should be returned. Variables are always scoped to one tag manager; discover ids with `GET /tag-managers`. |

### Responses

- `200`: Variables scoped to a parent tag manager
- `400`: Bad Request
- `401`: Unauthorized — missing, invalid, or expired API key or OAuth access token
- `403`: Forbidden — credential does not have the required current Ours permission
- `404`: Not Found
- `500`: Internal Server Error

#### `200` response body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `entities` | object[] | Yes |  |
| `entities[].id` | string | Yes |  |
| `entities[].tagManagerId` | string | Yes |  |
| `entities[].accountId` | string | Yes |  |
| `entities[].name` | string | Yes |  |
| `entities[].type` | string | Yes | Variable type discriminator. Examples that exist today: `DataLayer`, `Constant`, `Cookie`, `Url`, `UrlParameter`, `Weekday`, `RandomNumber`. Pick from `GET /tag-manager-variables/types` for the canonical set. |
| `entities[].parameters` | object | Yes | Type-specific configuration. |
| `entities[].defaultValue` | string \| null \| number \| boolean \| (string \| JsonValue[] \| object)[] \| object | No | Default value returned when no rule matches. JSON value — type depends on `type`. |
| `entities[].lookUpTable` | string \| null \| number \| boolean \| (string \| JsonValue[] \| object)[] \| object | No | Optional lookup table for `LookUpTable`-style variables. JSON value. |
| `entities[].enabled` | boolean \| null | No |  |
| `entities[].folderId` | string \| null | No | Folder this variable belongs to. Read-only here; assign or remove folder membership with `POST /tag-manager-asset-folders`. |
| `entities[].createdAt` | string \| null | No |  |
| `entities[].updatedAt` | string \| null | No |  |
| `pagination` | object | Yes |  |
| `pagination.nextCursor` | string \| null | No |  |
| `pagination.hasMore` | boolean | Yes |  |

Full schema: [OpenAPI specification](https://docs.oursprivacy.com/openapi-platform.json).

## POST /rest/v1/tag-manager-variables

Create a new variable inside a tag manager. `tagManagerId` is required in the body. Known input failures (e.g. duplicate variable name within the tag manager) are returned as HTTP 409 with the reason in the response `error` field. Requires API-key scope or current OAuth user permission: tagManagers:update

Request URL: `POST https://app.oursprivacy.com/rest/v1/tag-manager-variables`

Authentication: apiKey or oauth2.

### Request body (`application/json`, required)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `tagManagerId` | string | Yes | Parent tag manager that will own the new variable. |
| `name` | string | Yes |  |
| `type` | string | Yes | Variable type discriminator. Pick from `GET /tag-manager-variables/types` for the canonical set (e.g. `DataLayer`, `Constant`, `Cookie`, `Url`). |
| `parameters` | object | Yes | Type-specific JSON configuration. |
| `defaultValue` | string \| null \| number \| boolean \| (string \| JsonValue[] \| object)[] \| object | No | Optional default value. JSON value of any type. |
| `lookUpTable` | string \| null \| number \| boolean \| (string \| JsonValue[] \| object)[] \| object | No | Optional lookup table for `LookUpTable` variables. |
| `enabled` | boolean \| null | No |  |

### Responses

- `200`: Created variable
- `400`: Bad Request
- `401`: Unauthorized — missing, invalid, or expired API key or OAuth access token
- `403`: Forbidden — credential does not have the required current Ours permission
- `404`: Not Found
- `409`: Conflict — variable name collides with another variable in the same tag manager, or another business-rule validation failed. Reason is in the response `error` field.
- `500`: Internal Server Error

#### `200` response body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | Yes |  |
| `tagManagerId` | string | Yes |  |
| `accountId` | string | Yes |  |
| `name` | string | Yes |  |
| `type` | string | Yes | Variable type discriminator. Examples that exist today: `DataLayer`, `Constant`, `Cookie`, `Url`, `UrlParameter`, `Weekday`, `RandomNumber`. Pick from `GET /tag-manager-variables/types` for the canonical set. |
| `parameters` | object | Yes | Type-specific configuration. |
| `defaultValue` | string \| null \| number \| boolean \| (string \| JsonValue[] \| object)[] \| object | No | Default value returned when no rule matches. JSON value — type depends on `type`. |
| `lookUpTable` | string \| null \| number \| boolean \| (string \| JsonValue[] \| object)[] \| object | No | Optional lookup table for `LookUpTable`-style variables. JSON value. |
| `enabled` | boolean \| null | No |  |
| `folderId` | string \| null | No | Folder this variable belongs to. Read-only here; assign or remove folder membership with `POST /tag-manager-asset-folders`. |
| `createdAt` | string \| null | No |  |
| `updatedAt` | string \| null | No |  |

Full schema: [OpenAPI specification](https://docs.oursprivacy.com/openapi-platform.json).

## GET /rest/v1/tag-manager-variables/{id}

Fetch one variable by id, including its type-specific `parameters`, `defaultValue`, `lookUpTable`, and read-only `folderId`. A missing id and an id this credential cannot access return the same 404. Requires API-key scope or current OAuth user permission: tagManagers:find

Request URL: `GET https://app.oursprivacy.com/rest/v1/tag-manager-variables/{id}`

Authentication: apiKey or oauth2.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | Yes | Variable UUID from the list or create response. Variable UUID from the list or create response. |

### Responses

- `200`: Variable details
- `400`: Bad Request
- `401`: Unauthorized — missing, invalid, or expired API key or OAuth access token
- `403`: Forbidden — credential does not have the required current Ours permission
- `404`: Not Found
- `500`: Internal Server Error

#### `200` response body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | Yes |  |
| `tagManagerId` | string | Yes |  |
| `accountId` | string | Yes |  |
| `name` | string | Yes |  |
| `type` | string | Yes | Variable type discriminator. Examples that exist today: `DataLayer`, `Constant`, `Cookie`, `Url`, `UrlParameter`, `Weekday`, `RandomNumber`. Pick from `GET /tag-manager-variables/types` for the canonical set. |
| `parameters` | object | Yes | Type-specific configuration. |
| `defaultValue` | string \| null \| number \| boolean \| (string \| JsonValue[] \| object)[] \| object | No | Default value returned when no rule matches. JSON value — type depends on `type`. |
| `lookUpTable` | string \| null \| number \| boolean \| (string \| JsonValue[] \| object)[] \| object | No | Optional lookup table for `LookUpTable`-style variables. JSON value. |
| `enabled` | boolean \| null | No |  |
| `folderId` | string \| null | No | Folder this variable belongs to. Read-only here; assign or remove folder membership with `POST /tag-manager-asset-folders`. |
| `createdAt` | string \| null | No |  |
| `updatedAt` | string \| null | No |  |

Full schema: [OpenAPI specification](https://docs.oursprivacy.com/openapi-platform.json).

## PATCH /rest/v1/tag-manager-variables/{id}

Partially update a variable. Only the fields you send are changed. Name collisions with other variables in the same tag manager return 409 with the reason in the response `error` field. To assign a variable to a folder, use `POST /rest/v1/tag-manager-asset-folders`. Requires API-key scope or current OAuth user permission: tagManagers:update

Request URL: `PATCH https://app.oursprivacy.com/rest/v1/tag-manager-variables/{id}`

Authentication: apiKey or oauth2.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | Yes | Variable UUID from the list or create response. Variable UUID from the list or create response. |

### Request body (`application/json`, required)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | No | Updated variable name. |
| `type` | string | No | Updated variable type. Pick from `GET /tag-manager-variables/types`. |
| `parameters` | object | No | Updated type-specific JSON configuration. |
| `defaultValue` | string \| null \| number \| boolean \| (string \| JsonValue[] \| object)[] \| object | No | Updated default value. JSON value of any type. |
| `lookUpTable` | string \| null \| number \| boolean \| (string \| JsonValue[] \| object)[] \| object | No | Updated lookup table payload. |
| `enabled` | boolean \| null | No | Pause/resume the variable without changing other fields. |

### Responses

- `200`: Updated variable
- `400`: Bad Request
- `401`: Unauthorized — missing, invalid, or expired API key or OAuth access token
- `403`: Forbidden — credential does not have the required current Ours permission
- `404`: Not Found
- `409`: Conflict — name collision or other business-rule validation failure. Reason is in the response `error` field.
- `500`: Internal Server Error

#### `200` response body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | Yes |  |
| `tagManagerId` | string | Yes |  |
| `accountId` | string | Yes |  |
| `name` | string | Yes |  |
| `type` | string | Yes | Variable type discriminator. Examples that exist today: `DataLayer`, `Constant`, `Cookie`, `Url`, `UrlParameter`, `Weekday`, `RandomNumber`. Pick from `GET /tag-manager-variables/types` for the canonical set. |
| `parameters` | object | Yes | Type-specific configuration. |
| `defaultValue` | string \| null \| number \| boolean \| (string \| JsonValue[] \| object)[] \| object | No | Default value returned when no rule matches. JSON value — type depends on `type`. |
| `lookUpTable` | string \| null \| number \| boolean \| (string \| JsonValue[] \| object)[] \| object | No | Optional lookup table for `LookUpTable`-style variables. JSON value. |
| `enabled` | boolean \| null | No |  |
| `folderId` | string \| null | No | Folder this variable belongs to. Read-only here; assign or remove folder membership with `POST /tag-manager-asset-folders`. |
| `createdAt` | string \| null | No |  |
| `updatedAt` | string \| null | No |  |

Full schema: [OpenAPI specification](https://docs.oursprivacy.com/openapi-platform.json).

## DELETE /rest/v1/tag-manager-variables/{id}

Permanently delete a variable and return `{ id, deleted }`. Tags and triggers that reference it by name stop resolving it; use PATCH with `enabled: false` to pause it instead. A missing id and an id this credential cannot access return the same 404. Requires API-key scope or current OAuth user permission: tagManagers:update

Request URL: `DELETE https://app.oursprivacy.com/rest/v1/tag-manager-variables/{id}`

Authentication: apiKey or oauth2.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | Yes | Variable UUID from the list or create response. Variable UUID from the list or create response. |

### Responses

- `200`: Deleted successfully
- `400`: Bad Request
- `401`: Unauthorized — missing, invalid, or expired API key or OAuth access token
- `403`: Forbidden — credential does not have the required current Ours permission
- `404`: Not Found
- `500`: Internal Server Error

#### `200` response body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | Yes | The id of the variable that was deleted. |
| `deleted` | boolean | Yes | True when the variable was deleted. |

Full schema: [OpenAPI specification](https://docs.oursprivacy.com/openapi-platform.json).

## GET /rest/v1/tag-manager-variables/types

Lists every variable template the platform supports — what `type` discriminator to send on create/patch, the shape of the type-specific `parameters` payload, and `supportsVariables` (whether the variable's own parameter fields may reference `{{OtherVariable}}` at runtime). Account-agnostic: the response is the same for every API key. Requires API-key scope or current OAuth user permission: tagManagers:find

Request URL: `GET https://app.oursprivacy.com/rest/v1/tag-manager-variables/types`

Authentication: apiKey or oauth2.

### Responses

- `200`: Variable template descriptors
- `400`: Bad Request
- `401`: Unauthorized — missing, invalid, or expired API key or OAuth access token
- `403`: Forbidden — credential does not have the required current Ours permission
- `404`: Not Found
- `500`: Internal Server Error

#### `200` response body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `entities` | object[] | Yes |  |
| `entities[].id` | string | Yes | Type discriminator — pass this as `type` on create/patch. |
| `entities[].name` | string | Yes | Human-readable display name. |
| `entities[].category` | string | Yes | Grouping label. |
| `entities[].description` | string \| null | No |  |
| `entities[].fields` | object[] | Yes |  |
| `entities[].fields[].id` | string | Yes | Parameter key that goes in the `parameters` payload at create/patch. |
| `entities[].fields[].type` | string | Yes | Underlying data type of the parameter value. One of: `"STRING"`, `"BOOLEAN"`, `"INTEGER"`, `"FLOAT"`, `"TABLE"`. |
| `entities[].fields[].title` | string | Yes | Human-readable title for the field. |
| `entities[].fields[].description` | string \| null | No |  |
| `entities[].fields[].required` | boolean \| null | No | When `true`, omitting or sending an empty value for this parameter on create/patch returns HTTP 400. |
| `entities[].fields[].default` | string \| null \| number \| boolean \| (string \| JsonValue[] \| object)[] \| object | No | Default value when the caller omits the parameter on create. |
| `entities[].fields[].availableValues` | object[] \| null | No | When present, the field accepts only one of these values. Send the `value` string in `parameters`; the `label` is for display. |
| `entities[].fields[].availableValues[].value` | string | Yes |  |
| `entities[].fields[].availableValues[].label` | string | Yes |  |
| `entities[].fields[].allowedKeys` | string[] \| null | No | For TABLE-typed fields, the predefined keys each row may contain. |
| `entities[].fields[].validators` | object[] \| null | No | Server-enforced rules applied to this field at create and patch. |
| `entities[].fields[].validators[].type` | string | Yes | One of: `"NotEmpty"`, `"CharacterLength"`, `"Url"`, `"Email"`, `"Number"`, `"Range"`. |
| `entities[].fields[].validators[].min` | number \| null | No |  |
| `entities[].fields[].validators[].max` | number \| null | No |  |
| `entities[].supportsVariables` | boolean \| null | No | When `true`, this variable type's parameter fields can themselves contain `{{OtherVariable}}` references that the SDK resolves at runtime. |

Full schema: [OpenAPI specification](https://docs.oursprivacy.com/openapi-platform.json).
