---
title: "Get Variable By Name"
method: GET
path: "/v1/projects/{project_id}/variables/{name}/"
tags: ["Projects", "Variables"]
---

# Get Variable By Name

`GET /v1/projects/{project_id}/variables/{name}/`

## Request

- Base URL: `https://logfire-api.pydantic.dev/api`
- URL: `https://logfire-api.pydantic.dev/api/v1/projects/{project_id}/variables/{name}/`
- Auth: OAuth 2
  - Authorization code: `api/oauth/authorize`
  - Token URL: `/api/oauth/token` scopes: `project:read_variables`
- TypeScript: <https://skmtc.dev/pydantic/apis/pydantic-logfire-api/docs/v1/projects/:project_id/variables/:name/get.ts> (a function with typed inputs; its response is checked against the schema)

Get a variable definition by name with current labels and latest version.

Requires: User token with project:read_variables scope.

## Path parameters

- `name` string, required
- `project_id` string, uuid, required

## Response `200`

Successful Response

- VariableConfig: Configuration for a single managed variable including labels and rollout rules.
  - `name` string, required
  - `kind` 'general' | 'prompt'
  - `labels` object, required
  - `latest_version` LatestVersion: The latest version of a variable, always carrying its serialized value.
    - `version` integer, required
    - `serialized_value` string, required
  - `rollout` Rollout, required: Configuration for label selection with weighted probabilities.
    - `labels` object, required
  - `overrides` RolloutOverride[], required
    - `conditions` union[], required
      - union
        - ValueEquals: Condition that matches when an attribute equals a specific value.
          - `attribute` string, required
          - `value` unknown, required
          - `kind` 'value-equals'
        - ValueDoesNotEqual: Condition that matches when an attribute does not equal a specific value.
          - `attribute` string, required
          - `value` unknown, required
          - `kind` 'value-does-not-equal'
        - ValueIsIn: Condition that matches when an attribute value is in a set of values.
          - `attribute` string, required
          - `values` unknown[], required
            - unknown
          - `kind` 'value-is-in'
        - ValueIsNotIn: Condition that matches when an attribute value is not in a set of values.
          - `attribute` string, required
          - `values` unknown[], required
            - unknown
          - `kind` 'value-is-not-in'
        - ValueMatchesRegex: Condition that matches when an attribute value matches a regex pattern.
          - `attribute` string, required
          - `pattern` union, required
            - string
            - string, regex
          - `kind` 'value-matches-regex'
        - ValueDoesNotMatchRegex: Condition that matches when an attribute value does not match a regex pattern.
          - `attribute` string, required
          - `pattern` union, required
            - string
            - string, regex
          - `kind` 'value-does-not-match-regex'
        - KeyIsPresent: Condition that matches when an attribute key is present.
          - `attribute` string, required
          - `kind` 'key-is-present'
        - KeyIsNotPresent: Condition that matches when an attribute key is not present.
          - `attribute` string, required
          - `kind` 'key-is-not-present'
    - `rollout` Rollout, required: Configuration for label selection with weighted probabilities.
      - `labels` object, required
  - `description` string, nullable
  - `json_schema` object, nullable
  - `template_inputs_schema` object, nullable
  - `type_name` string, nullable
  - `aliases` string[], nullable
  - `example` string, nullable
  - `display_name` string, nullable
  - `prompt_slug` string, nullable

## Other responses

- `422`: Validation Error
- `429`: Rate limit exceeded

---

[API](https://skmtc.dev/pydantic/apis/pydantic-logfire-api.md) - [All operations](https://skmtc.dev/pydantic/apis/pydantic-logfire-api/llms.txt) - [OpenAPI document](https://skmtc.dev/pydantic/apis/pydantic-logfire-api/revisions/7996e45256f4?raw)
