---
title: "Create an Agent Variable"
method: POST
path: "/v1/projects/{project_id}/agent-variables"
tags: ["variables"]
---

# Create an Agent Variable

`POST /v1/projects/{project_id}/agent-variables`

Creates a new template variable. Variables follow the `DG_<VARIABLE_NAME>` naming format and can substitute any JSON value in an agent configuration.

## Path parameters

- `project_id` string, required

## Headers

- `Authorization` string, required

## Request body

- CreateAgentVariableV1Request — Request body for creating an agent variable
  - `key` string, required — The variable name, following the DG_<VARIABLE_NAME> format
  - `value` unknown, required
  - `api_version` integer — API version. Defaults to 1

## Response `200`

Agent variable created successfully

- AgentVariableV1 — A template variable for agent configurations
  - `variable_id` string, required — The unique identifier of the variable
  - `key` string, required — The variable name, following the DG_<VARIABLE_NAME> format
  - `value` unknown, required
  - `created_at` string, date-time — Timestamp when the variable was created
  - `updated_at` string, date-time — Timestamp when the variable was last updated

## Other responses

- `400` — Invalid Request

---

[API](https://skmtc.net/deepgram/apis/rest-api.md) · [All operations](https://skmtc.net/deepgram/apis/rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/deepgram/rest-api/versions/bd7ba5c18a6b/schema)
