# SDK variables

> Use `x-fern-sdk-variables` to set common path parameters across all requests

The `x-fern-sdk-variables` extension allows you to define variables that are set once during SDK client initialization and automatically used in path parameters across all endpoint calls. This is useful for common parameters like tenant IDs, organization IDs, or environment identifiers that appear in many endpoint paths.

<Note>
  SDK variables are supported in TypeScript (v2.6.3+), Python (v4.24.0+), and Java (v3.6.3+). Only string types are supported.
</Note>

## Configuration

Define variables at the document level using `x-fern-sdk-variables`, then mark path parameters as variables using `x-fern-sdk-variable`:

```yaml {1-7,17,23} title="openapi.yml"
x-fern-sdk-variables:
  gardenId:
    type: string
    description: The unique identifier for your garden
  zoneId:
    type: string
    description: The zone within the garden

paths:
  /gardens/{gardenId}/zones/{zoneId}/plants:
    get:
      operationId: list_plants_in_zone
      parameters:
        - name: gardenId
          in: path
          required: true
          x-fern-sdk-variable: gardenId
          schema:
            type: string
        - name: zoneId
          in: path
          required: true
          x-fern-sdk-variable: zoneId
          schema:
            type: string
```

## SDK usage

Variables become required constructor parameters instead of being passed to individual method calls:

<CodeBlocks>
  ```typescript {2-3}
  const client = new PlantClient({
    gardenId: "garden_123",
    zoneId: "zone_456",
    apiKey: "your-api-key"
  });

  const plants = await client.listPlantsInZone();
  ```

  ```python {2-3}
  client = PlantClient(
      garden_id="garden_123",
      zone_id="zone_456",
      api_key="your-api-key"
  )

  plants = client.list_plants_in_zone()
  ```

  ```java {2-3}
  PlantClient client = PlantClient.builder()
      .gardenId("garden_123")
      .zoneId("zone_456")
      .apiKey("your-api-key")
      .build();

  List<Plant> plants = client.listPlantsInZone();
  ```
</CodeBlocks>