Skip to main content
POST
/
api
/
v1
/
prompts
curl -X POST https://app.tracia.io/api/v1/prompts \
  -H "Authorization: Bearer tr_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Welcome Email",
    "description": "A welcome email template",
    "content": [
      {
        "id": "msg_1",
        "role": "system",
        "content": "You are a helpful assistant."
      },
      {
        "id": "msg_2",
        "role": "user",
        "content": "Write a welcome email for {{name}}."
      }
    ]
  }'
{
  "id": "clx1abc123",
  "slug": "welcome-email",
  "name": "Welcome Email",
  "description": "A welcome email template",
  "modelConfigurationId": null,
  "currentVersion": 1,
  "content": [
    {
      "id": "msg_1",
      "role": "system",
      "content": "You are a helpful assistant."
    },
    {
      "id": "msg_2",
      "role": "user",
      "content": "Write a welcome email for {{name}}."
    }
  ],
  "variables": ["name"],
  "createdAt": "2024-01-15T10:30:00.000Z",
  "updatedAt": "2024-01-15T10:30:00.000Z"
}

Request

Authorization
string
required
Bearer token with your API key: Bearer tr_your_api_key
name
string
required
Display name for the prompt
slug
string
URL-friendly identifier. Auto-generated from name if not provided.
description
string
Description of the prompt
content
array
required
Array of prompt messages. Each message must have:
  • id (string): Unique identifier
  • role (string): system, user, or assistant
  • content (string): Message content
modelConfigurationId
string
ID of a model configuration to use

Response

Returns the created prompt object.
curl -X POST https://app.tracia.io/api/v1/prompts \
  -H "Authorization: Bearer tr_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Welcome Email",
    "description": "A welcome email template",
    "content": [
      {
        "id": "msg_1",
        "role": "system",
        "content": "You are a helpful assistant."
      },
      {
        "id": "msg_2",
        "role": "user",
        "content": "Write a welcome email for {{name}}."
      }
    ]
  }'
{
  "id": "clx1abc123",
  "slug": "welcome-email",
  "name": "Welcome Email",
  "description": "A welcome email template",
  "modelConfigurationId": null,
  "currentVersion": 1,
  "content": [
    {
      "id": "msg_1",
      "role": "system",
      "content": "You are a helpful assistant."
    },
    {
      "id": "msg_2",
      "role": "user",
      "content": "Write a welcome email for {{name}}."
    }
  ],
  "variables": ["name"],
  "createdAt": "2024-01-15T10:30:00.000Z",
  "updatedAt": "2024-01-15T10:30:00.000Z"
}