Operations
Operations

Create alert

Create a workspace alert rule that watches a metric and fires when it moves. Pick the shape: alertType='trend' (a statistically significant move vs the rolling baseline, set sensitivityPreset) or alertType='threshold' (the value crosses a fixed bound, set condition + threshold params). The metricKey must be a numeric/continuous/workflow-adherence metric from the catalogue (call list_metrics first). The rule is workspace-scoped and evaluated by the alert cron; delivery defaults to in-app only. Creating an alert requires workspace-admin rights (delivery can reach Slack/email). Use list_alerts first to avoid duplicating an existing rule.

POST
/operations/create_alert

Authorization

bearerAuth
AuthorizationBearer <token>

A personal access token from Settings > API tokens.

In: header

Header Parameters

Idempotency-Key?string

A key you choose, such as a UUID, that makes this POST safe to retry. Within 24 hours the same key and request answers with the first successful answer and runs nothing, the same key with a different request answers 422 idempotency_key_reused, and a key whose request is still running answers 409 idempotency_key_in_use. A failed request keeps nothing, so the same key runs it again.

Length1 <= length <= 255

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

curl -X POST "https://example.com/operations/create_alert" \  -H "Content-Type: application/json" \  -d '{    "name": "string",    "metricKey": "string",    "metricType": "numeric",    "agent": "string"  }'
{}
{
  "type": "http://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "code": "string",
  "errors": [
    {
      "path": "string",
      "message": "string"
    }
  ],
  "estimate": {},
  "retryAfterSeconds": 0
}
{
  "type": "http://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "code": "string",
  "errors": [
    {
      "path": "string",
      "message": "string"
    }
  ],
  "estimate": {},
  "retryAfterSeconds": 0
}
{
  "type": "http://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "code": "string",
  "errors": [
    {
      "path": "string",
      "message": "string"
    }
  ],
  "estimate": {},
  "retryAfterSeconds": 0
}
{
  "type": "http://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "code": "string",
  "errors": [
    {
      "path": "string",
      "message": "string"
    }
  ],
  "estimate": {},
  "retryAfterSeconds": 0
}
{
  "type": "http://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "code": "string",
  "errors": [
    {
      "path": "string",
      "message": "string"
    }
  ],
  "estimate": {},
  "retryAfterSeconds": 0
}
{
  "type": "http://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "code": "string",
  "errors": [
    {
      "path": "string",
      "message": "string"
    }
  ],
  "estimate": {},
  "retryAfterSeconds": 0
}
{
  "type": "http://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "code": "string",
  "errors": [
    {
      "path": "string",
      "message": "string"
    }
  ],
  "estimate": {},
  "retryAfterSeconds": 0
}

Create agent from template POST

Create a new agent in a workspace as a copy of an agent template (list_agent_templates), and return its handle. The copy takes the template's latest version as an unpublished draft version 1: system prompt, greetings, tools, workflow, model, voice and call settings. The template's prompt and greetings read {{variables}} for the business's facts. A variable a workspace Shared setting holds comes from that set, which is attached to the new agent; every other plain variable is created on the copy with no value, and the template's secret variables are not created. `variablesToSet` lists both: set each plain one with set_plain_variable and each secret with set_secret_variable before publishing. Tests, phone numbers and knowledge-base sources are not copied.

Create call alert POST

Create a new CUSTOM real-time call alert. This ALWAYS creates a free-form alert (reason stays unset), it can never mint one of the 6 built-in reason alerts (new_lead/urgent/missed/message_taken/booking/all_calls); those only come into existence when an operator turns one on in the portal. A custom alert fires on the calls its `firesOn` trigger matches (default all_calls = every finished call), delivered to its own typed recipients, not a logged-in portal member's account, so a shared mailbox, phone number or Slack channel can get a copy of every call without being invited as a platform user. `skipTeamCallers` drops calls from the team's own numbers, for a feed that should only carry real callers. Optional email/SMS templates support {{caller_name}}, {{caller_number}}, {{did}}, {{call_time}}, {{business_name}}, {{summary}}, {{transcript}}, and {{call_link}}, leave blank to use the default "every call" copy. SCOPE: a new alert applies to the agent you addressed. Name other agents in `agentIds`, or pass `allAgents: true` for the whole workspace. The success summary states the scope it landed on, so read it back.