Saltar para o conteúdo principal
POST
/
public
/
api
/
v1
/
agents
/
{agentPublicId}
/
prompt
/
variables
Create variable
curl --request POST \
  --url https://api.gennia.ai/public/api/v1/agents/{agentPublicId}/prompt/variables \
  --header 'Content-Type: application/json' \
  --header 'X-Api-Key: <api-key>' \
  --data '
{
  "booleanTextWhenFalse": "no",
  "booleanTextWhenTrue": "yes",
  "defaultValue": "Ada",
  "description": "Full name of the customer being assisted.",
  "label": "Customer name",
  "multiChoiceSeparator": ", ",
  "name": "customer_name",
  "options": [
    {
      "injectedText": "the customer is on the Pro plan",
      "label": "Pro plan",
      "sortOrder": 1
    }
  ],
  "required": true,
  "sortOrder": 10
}
'
{
  "booleanTextWhenFalse": "<string>",
  "booleanTextWhenTrue": "<string>",
  "createdAt": "2023-11-07T05:31:56Z",
  "defaultValue": {},
  "description": "<string>",
  "label": "<string>",
  "multiChoiceSeparator": "<string>",
  "name": "<string>",
  "options": [
    {
      "injectedText": "<string>",
      "label": "<string>",
      "publicId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "sortOrder": 123
    }
  ],
  "publicId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "required": true,
  "sortOrder": 123,
  "updatedAt": "2023-11-07T05:31:56Z"
}

Autorizações

X-Api-Key
string
header
obrigatório

Parâmetros de caminho

agentPublicId
string<uuid>
obrigatório

Corpo

application/json

Body for creating a new dynamic prompt variable on an agent.

type
enum<string>
obrigatório

Type of the variable, controlling shape and validation of values.

Opções disponíveis:
text_short,
text_long,
number,
date,
time,
datetime,
single_choice,
multi_choice,
bool
booleanTextWhenFalse
string

Text to inject when a boolean variable resolves to false.

Exemplo:

"no"

booleanTextWhenTrue
string

Text to inject when a boolean variable resolves to true.

Exemplo:

"yes"

defaultValue
object

Default value. Polymorphic: shape depends on type (string, number, boolean, choice).

Exemplo:

"Ada"

description
string

Optional help text shown next to the variable.

Maximum string length: 500
Exemplo:

"Full name of the customer being assisted."

label
string

Human-readable label shown in the prompt editor.

Maximum string length: 200
Exemplo:

"Customer name"

multiChoiceSeparator
string

Separator used when concatenating multi_choice options into a single string.

Maximum string length: 10
Exemplo:

", "

name
string

Stable identifier of the variable. Lowercase ASCII; must start with a letter and may contain digits and underscores. Up to 50 characters.

Minimum string length: 1
Pattern: ^[a-z][a-z0-9_]{0,49}$
Exemplo:

"customer_name"

options
object[]

Required (and validated 1..50) for single_choice / multi_choice variables.

required
boolean

Whether the variable must be set before the agent can respond.

Exemplo:

true

sortOrder
integer<int32>

Sort order of this variable in the prompt editor.

Exemplo:

10

Resposta

Created

Dynamic-prompt variable definition (per agent).

booleanTextWhenFalse
string

Prompt fragment when bool variable is false.

booleanTextWhenTrue
string

Prompt fragment when bool variable is true.

createdAt
string<date-time>
defaultValue
object

Default value (shape depends on type).

description
string
label
string

Display label shown in the Hub form.

multiChoiceSeparator
string

Joiner for multi_choice rendered values (default ,).

name
string

Slug used in {{name}} references inside the systemPrompt.

options
object[]

Options for single_choice / multi_choice (null otherwise).

publicId
string<uuid>
required
boolean

Whether the Hub form must submit this field.

sortOrder
integer<int32>
type
enum<string>
Opções disponíveis:
text_short,
text_long,
number,
date,
time,
datetime,
single_choice,
multi_choice,
bool
updatedAt
string<date-time>