---
title: "Create agent variable"
method: POST
path: "/public/v1/agents/{agentId}/variables"
tags: ["Flow Variables"]
---

# Create agent variable

`POST /public/v1/agents/{agentId}/variables`

Creates a variable for an agent. Requires a USER API key.

## Path parameters

- `agentId` string, required

## Request body

- PublicFlowVariableCreateInput
  - `name` string, required
  - `description` string, nullable
  - `pattern` string, nullable

## Response `201`

Created variable

- Variable
  - `id` number, required
  - `name` string, required
  - `description` string, nullable
  - `status` 'ACTIVE' | 'DELETED', required
  - `createdAt` string, required
  - `updatedAt` string, required
  - `assistantId` string, nullable
  - `automationId` number, nullable
  - `pattern` string, nullable
  - `defaultValue` string, nullable
  - `isDefault` boolean, required

---

[API](https://skmtc.net/getfrontline/apis/public-api.md) · [All operations](https://skmtc.net/getfrontline/apis/public-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/getfrontline/public-api/revisions/9d33b6aad674/schema)
