Skip to main content
Deepgram's Docs

Search documentation

Type to search this documentation.

Create an Agent Variable

POST/v1/projects/{project_id}/agent-variablesCreate an Agent Variable

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

Parameters

project_idstringpathrequired

The unique identifier of the project

Request body

Agent variable details

application/json
objectCreateAgentVariableV1Request

CreateAgentVariableV1Request

Request body for creating an agent variable

api_versioninteger

API version. Defaults to 1

default 1

keystringrequired

The variable name, following the DG_<VARIABLE_NAME> format

valuevaluerequired

The value to substitute. Can be any valid JSON type (string, number, boolean, object, or array)

Example request
{
  "api_version": 1,
  "key": "string",
  "value": null
}

Responses

200Agent variable created successfullyapplication/json
objectAgentVariableV1

AgentVariableV1

A template variable for agent configurations

created_atstring · date-time

Timestamp when the variable was created

keystringrequired

The variable name, following the DG_<VARIABLE_NAME> format

updated_atstring · date-time

Timestamp when the variable was last updated

valuevaluerequired

The value to substitute. Can be any valid JSON type

variable_idstringrequired

The unique identifier of the variable

Example response
{
  "created_at": "2026-06-09T00:00:00Z",
  "key": "string",
  "updated_at": "2026-06-09T00:00:00Z",
  "value": null,
  "variable_id": "string"
}
400Invalid Requestapplication/json
valueErrorResponse

ErrorResponse

oneOf · 3 options
Option 1stringErrorResponseTextError

ErrorResponseTextError

Option 2objectErrorResponseLegacyError

ErrorResponseLegacyError

err_codestring

The error code

err_msgstring

The error message

request_idstring

The request ID

Option 3objectErrorResponseModernError

ErrorResponseModernError

categorystring

The category of the error

detailsstring

A description of the error

messagestring

A message about the error

request_idstring

The unique identifier of the request

Example response
{
  "err_code": "string",
  "err_msg": "string",
  "request_id": "string"
}
Documentation menu