Skip to content

Create prompt template

POST/ai/copilot/templates

Creates a new reusable prompt template with a body that may contain named variable placeholders using {{variable_name}} syntax. Templates can be scoped by category and referenced in copilot queries for consistency.

Request

Request body

Content type application/json (required).

FieldTypeRequiredDescription
namestringYes

Human-readable template name (must be unique within the tenant).

Max length: 255

categorystringNo

Optional category label.

prompt_bodystringYes

Prompt content with {{variable}} placeholders.

variablesarray of stringNo

Declared variable names used in the prompt_body.

is_activebooleanNo

Default: true

notesstringNo

Example

{
  "name": "Ticket Summary",
  "category": "support",
  "prompt_body": "Summarise the last {{n}} support tickets for {{customer_name}} and identify the most common issue.",
  "variables": [
    "n",
    "customer_name"
  ],
  "is_active": true,
  "notes": "Used by the support team for weekly customer reviews."
}

Responses

201 Prompt template created

Content type application/json, object · AiPromptTemplateV1.

FieldTypeRequiredDescription
idintegerNo

Auto-incremented primary key.

namestringNo

Human-readable template name.

categorystring, nullableNo

Category label for grouping (e.g. "sales", "support", "hr").

prompt_bodystringNo

The template prompt body with {{variable_name}} placeholders.

variablesarray of stringNo

List of variable names expected by this template.

is_activebooleanNo

Whether the template is available for use in copilot queries.

notesstring, nullableNo
created_atstring (date-time)No
updated_atstring (date-time)No

422 Validation failed — check name uniqueness or prompt_body length

Example request

curl -X POST "https://{tenant}.faciotech.net/api/v1/ai/copilot/templates" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{"name": "Ticket Summary", "category": "support", "prompt_body": "Summarise the last {{n}} support tickets for {{customer_name}} and identify the most common issue.", "variables": ["n", "customer_name"], "is_active": true, "notes": "Used by the support team for weekly customer reviews."}'
Loading