{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/elocuenti-com/json-schema/elocuenti-com-call-create-body-schema.json",
  "title": "CallCreateBody",
  "description": "Who to call, with which script, and the values the script needs.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/elocuenti-com-calls-api-openapi.yml#/components/schemas/CallCreateBody",
  "type": "object",
  "properties": {
    "contact_id": {
      "description": "The contact to call, as returned by the contacts operations. Send this or `phone`.",
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$",
      "title": "Contact Id"
    },
    "phone": {
      "type": "string",
      "maxLength": 16,
      "pattern": "^\\+[1-9]\\d{6,14}$",
      "description": "The contact's phone number in international format (E.164): a plus sign, the country code and the number, with no spaces or dashes. The contact must already exist with that number.",
      "title": "Phone"
    },
    "purpose_id": {
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$",
      "description": "The script the agent follows in the call: one of the call scripts of your business, as returned by `GET /api/v1/calls/purposes`.",
      "title": "Purpose Id"
    },
    "variables": {
      "type": "object",
      "propertyNames": {
        "type": "string",
        "pattern": "^[a-z_]{1,40}$"
      },
      "additionalProperties": {
        "type": "string",
        "maxLength": 200,
        "pattern": "^[^\\u0000-\\u0008\\u000b-\\u001f\\u007f]*$"
      },
      "description": "Values for the script's placeholders, by name: a script writes `{{name|fallback}}` and the AI says your value, or the fallback. At most 10 values: a name is lowercase letters and `_` (up to 40 characters), a value a text of up to 200 characters. `nombre`, the contact's name, is filled in for you; a name the script does not use is refused.",
      "title": "Variables"
    },
    "call_window": {
      "$ref": "#/$defs/CallWindow"
    }
  },
  "required": [
    "purpose_id"
  ],
  "additionalProperties": false,
  "$defs": {
    "CallWindow": {
      "type": "object",
      "properties": {
        "start": {
          "type": "string",
          "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$",
          "description": "When calls may start, as HH:MM (24 hours) in your business's time zone.",
          "title": "Start"
        },
        "end": {
          "type": "string",
          "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$",
          "description": "When calls stop, as HH:MM (24 hours) in your business's time zone.",
          "title": "End"
        }
      },
      "required": [
        "start",
        "end"
      ],
      "additionalProperties": false,
      "description": "The hours in which this call is allowed, in your business's time zone. If the call is requested outside them it is refused (`409`) and nothing is dialed: ask again inside the window. Leave it out to place the call right away.",
      "title": "CallWindow"
    }
  }
}