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).
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Human-readable template name (must be unique within the tenant). Max length: 255 |
category | string | No | Optional category label. |
prompt_body | string | Yes | Prompt content with {{variable}} placeholders. |
variables | array of string | No | Declared variable names used in the prompt_body. |
is_active | boolean | No | Default: |
notes | string | No |
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.
| Field | Type | Required | Description |
|---|---|---|---|
id | integer | No | Auto-incremented primary key. |
name | string | No | Human-readable template name. |
category | string, nullable | No | Category label for grouping (e.g. "sales", "support", "hr"). |
prompt_body | string | No | The template prompt body with {{variable_name}} placeholders. |
variables | array of string | No | List of variable names expected by this template. |
is_active | boolean | No | Whether the template is available for use in copilot queries. |
notes | string, nullable | No | |
created_at | string (date-time) | No | |
updated_at | string (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."}'