Skip to main content
POST
/
v1
/
models
/
{model_id}
/
variables
Create a new variable in an analysis model
curl --request POST \
  --url https://api.example.com/v1/models/{model_id}/variables \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "key": "greeting_quality",
  "readable_name": "Greeting Quality",
  "description": "Evaluates the quality and professionalism of the greeting",
  "type": "INTEGER",
  "weight": 10,
  "required": true,
  "order_number": 1,
  "category_id": 1
}
'
import requests

url = "https://api.example.com/v1/models/{model_id}/variables"

payload = {
"key": "greeting_quality",
"readable_name": "Greeting Quality",
"description": "Evaluates the quality and professionalism of the greeting",
"type": "INTEGER",
"weight": 10,
"required": True,
"order_number": 1,
"category_id": 1
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
key: 'greeting_quality',
readable_name: 'Greeting Quality',
description: 'Evaluates the quality and professionalism of the greeting',
type: 'INTEGER',
weight: 10,
required: true,
order_number: 1,
category_id: 1
})
};

fetch('https://api.example.com/v1/models/{model_id}/variables', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/v1/models/{model_id}/variables",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'key' => 'greeting_quality',
'readable_name' => 'Greeting Quality',
'description' => 'Evaluates the quality and professionalism of the greeting',
'type' => 'INTEGER',
'weight' => 10,
'required' => true,
'order_number' => 1,
'category_id' => 1
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.example.com/v1/models/{model_id}/variables"

payload := strings.NewReader("{\n \"key\": \"greeting_quality\",\n \"readable_name\": \"Greeting Quality\",\n \"description\": \"Evaluates the quality and professionalism of the greeting\",\n \"type\": \"INTEGER\",\n \"weight\": 10,\n \"required\": true,\n \"order_number\": 1,\n \"category_id\": 1\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.example.com/v1/models/{model_id}/variables")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"key\": \"greeting_quality\",\n \"readable_name\": \"Greeting Quality\",\n \"description\": \"Evaluates the quality and professionalism of the greeting\",\n \"type\": \"INTEGER\",\n \"weight\": 10,\n \"required\": true,\n \"order_number\": 1,\n \"category_id\": 1\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.example.com/v1/models/{model_id}/variables")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"key\": \"greeting_quality\",\n \"readable_name\": \"Greeting Quality\",\n \"description\": \"Evaluates the quality and professionalism of the greeting\",\n \"type\": \"INTEGER\",\n \"weight\": 10,\n \"required\": true,\n \"order_number\": 1,\n \"category_id\": 1\n}"

response = http.request(request)
puts response.read_body
{
  "id": 1,
  "client_prompt_template_id": 1,
  "client_prompt_template_category_id": 1,
  "key": "greeting_quality",
  "readable_name": "Greeting Quality",
  "description": "Evaluates greeting professionalism",
  "type": "INTEGER",
  "weight": 10,
  "required": true,
  "order_number": 1,
  "enabled": true,
  "created_at": "2026-01-11T10:00:00Z",
  "created_by": "client_abc123"
}
{
"code": "001-001-0001",
"message": "The requested resource was not found"
}
{
"code": "001-001-0001",
"message": "The requested resource was not found"
}
{
"code": "001-001-0001",
"message": "The requested resource was not found"
}
{
"code": "001-001-0001",
"message": "The requested resource was not found"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

model_id
integer
required

The analysis model ID

Body

application/json

Request body for creating or updating a variable.

key
string
required

Unique identifier key for this variable within the model

Required string length: 1 - 128
Example:

"greeting_quality"

type
enum<string>
required

Data type: STRING, INTEGER, DECIMAL, BOOLEAN, DATE, TIME, or DATETIME

Available options:
STRING,
INTEGER,
DECIMAL,
BOOLEAN,
DATE,
TIME,
DATETIME
required
boolean
required

Whether this variable must have a value in analysis results

Example:

true

readable_name
string

Human-readable display name for UI presentation

Maximum string length: 128
Example:

"Greeting Quality"

description
string

Description of what this variable measures

Maximum string length: 256
Example:

"Evaluates the quality and professionalism of the greeting"

weight
integer

Weight for scoring calculations. Higher weight = more impact on score.

Required range: x >= 0
Example:

10

order_number
integer

Display order within the category or model

Required range: x >= 0
Example:

1

category_id
integer

ID of the category this variable belongs to. Must exist in the same model.

Example:

1

Response

Successful Response

Response model for variable.

id
integer
required

Unique identifier

Example:

1

client_prompt_template_id
integer
required

Parent model ID

Example:

1

key
string
required

Variable key

Example:

"greeting_quality"

type
enum<string>
required

Data type

Available options:
STRING,
INTEGER,
DECIMAL,
BOOLEAN,
DATE,
TIME,
DATETIME
required
boolean
required

Whether this variable is required

enabled
boolean
required

Whether the variable is active

created_at
string<date-time>
required

Creation timestamp

created_by
string
required

Creator identifier

client_prompt_template_category_id
integer

Category ID if assigned

readable_name
string

Human-readable display name

description
string

Variable description

weight
integer

Scoring weight

order_number
integer

Display order

updated_at
string<date-time>

Last update timestamp

updated_by
string

Last updater identifier