> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://developer.jelliu.co/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developer.jelliu.co/_mcp/server.

# Create a call

POST https://api.jelliu.co/api/calls
Content-Type: application/json

Places a real outbound phone call in which the agent `agentId` talks to the destination. Give either a raw `phoneNumber` (E.164) or a `contactId`; when both are present `phoneNumber` wins. The call is dialed synchronously: a `201` means the voice provider accepted it and the phone is ringing (`status: ringing`). Everything else about the conversation (transcript, outcome, duration) arrives after it ends; follow it with webhooks or `GET /api/calls/{callId}`.

The call is always filed under a contact. With a `contactId` whose number matches the destination, that contact is used; otherwise the oldest contact of the workspace with the destination number is used, and a campaign-less contact is created when none exists. If `phoneNumber` differs from the named contact's number, the named contact is ignored. With a `campaignId`, such a different destination must itself be a contact of that campaign, or the call is refused with 400.

**Checks before dialing, in order.** Each refusal happens before any money is spent:

1. The agent exists and is not paused (404 / 409 `AGENT_PAUSED`).
2. The destination resolves to a valid E.164 number (400).
3. **Compliance** (403 `COMPLIANCE_BLOCKED`): outside the allowed calling hours for the destination's country, in the workspace time zone (Settings → Compliance; `America/Bogota` when none is set); a blocked prefix; the number is on the opt-out suppression list; the contact or number is marked Do Not Call; the contact reached its daily or lifetime attempt cap.
4. **Destination policy** (403 `COMPLIANCE_BLOCKED`): premium-rate / high-risk (toll-fraud) prefixes, the workspace blocklist, and the allowed calling countries. Every refusal here writes an audit entry naming the masked number.
5. **Abuse guards**: more than 5 calls to the same number in an hour or 500 calls per hour in the workspace (429 `CALL_SPAM_DETECTED`); a number already called by another trial workspace (403 `TRIAL_ABUSE_DETECTED`).
6. **Minutes** (403 `BILLING_ERROR`): no active plan, trial minutes (15) used up, or the paid plan's pay-as-you-go ceiling reached.
7. The agent finished provisioning (409 `AGENT_PROVISIONING` with `Retry-After: 5`), and a paying workspace has its dedicated number (403 `PHONE_NUMBER_REQUIRED`).
8. **Concurrency** (429 `MAX_CONCURRENT_CALLS_REACHED`): the campaign's own `max_concurrent_calls` (message `Campaign concurrency limit reached`), then the workspace's plan cap on live calls (Starter 3, Growth 10, Business 25), message `Max concurrent calls reached`. A slot is freed when a call ends.

**Side effects.** Dials through the voice engine (over the telephony carrier, or the workspace's SIP trunk) using the workspace's own number for the agent as caller ID. For destinations that require it, a recording notice is prepended to the agent's greeting. The contact's `call_attempts` and `last_called_at` are incremented once the provider accepts the call. Talk time is billed when the call ends, rounded up to whole minutes per call, against included minutes and then overage; a trial call is cut at the remaining trial seconds. Writes an audit entry. If the provider refuses the call, the row is kept with `status: failed` and the error is returned (400 `NUMBER_UNVERIFIED` or 502); no webhook event is sent for that row.

**Idempotency.** Not idempotent and no idempotency key is honoured: retrying after a timeout or a network error can place a second real call to the same person. Check `GET /api/calls?agentId=...` for a recent row before retrying. Each attempt also counts towards the 5-calls-per-number-per-hour abuse guard.

**Webhook events.** When the call ends, `call.completed` (answered, voicemail and other analysed outcomes) or `call.failed` (technical failure, or a stale call closed by the reconciler as failed / no-answer) is delivered; when post-call analysis is still pending the event is held until it arrives. A campaign call can also trigger `campaign.completed`. Mutations also emit `audit.log_recorded` to subscribers. See [Webhooks](/webhooks).

**Access**

* **Required scope:** `write`.
* **Rate limit:** Outbound — 20 requests/min per workspace, shared by every `/api/calls` endpoint. See [Rate limits](/rate-limits).
* **Plan:** Available on every plan, including trial; requires an active subscription or remaining trial minutes. Concurrent calls are capped per plan.

Reference: https://developer.jelliu.co/api-reference/calls/post-calls

## Authentication

- `Authorization` header (bearer token, required) — Workspace API key: `jl_` followed by 64 lowercase hex characters, created by the workspace owner in the dashboard (**Settings → API Keys**) and sent as `Authorization: Bearer jl_...`. The plaintext is shown once, at creation; Jelliu stores only a SHA-256 hash. A workspace can hold up to 25 active keys. | Scope | GET / HEAD | POST / PUT / PATCH / DELETE | Admin-only routes | | --- | --- | --- | --- | | `read` | Yes | No | No | | `write` | Yes | Yes | No | | `full` | Yes | Yes | Yes | Operations restricted to admins or owners reject keys without the `full` scope with `403`, and say so in their description. No key, whatever its scope, can mint or revoke API keys or rotate a webhook secret — that requires a signed-in owner session. A revoked key stops authenticating within about 10 seconds. See [Authentication](/authentication).

## Request

### Body (application/json)

This endpoint expects an object.

- `agentId` (string, required) — The agent that talks. Must exist in this workspace, not be paused, and be provisioned with the voice provider.
- `phoneNumber` (string, optional) — Destination in E.164 (`Must be E.164 format` otherwise). When omitted, the contact's number is used. When it differs from the contact's number, the call is filed under the contact that owns this number instead.
- `campaignId` (string, optional) — File the call under this campaign of the workspace (its name, product context and target audience are passed to the agent, and its `max_concurrent_calls` applies). If `phoneNumber` overrides the contact's number, the destination must be one of the campaign's contacts.
- `contactId` (string, optional) — Contact to call. Its name and earlier conversations on any channel are given to the agent. Ignored when it does not exist and `phoneNumber` is present.
- `promptVariantId` (string, optional) — A/B test prompt variant this call belongs to; stored on the call as `prompt_variant_id` for reporting.
- `promptOverride` (string, optional) — Replaces the agent's prompt for this call only. Rejected when it contains prompt-injection patterns (`Prompt contains disallowed injection patterns`), e.g. "ignore previous instructions", "actúa como", `sistema:` or zero-width characters. Its use is logged.
- `firstMessageOverride` (string, optional) — Replaces the agent's opening line for this call. Same injection check as `promptOverride`. A legally required recording notice is still prepended when the destination needs one.

## Response

### 201

The provider accepted the call and it is ringing. The body is the stored row without the derived `analysis`, `has_recording`, `agent_name`, `campaign_name` and `contact_name`.

- `data` (object, required) — A call as the API serializes it. Field names are snake\_case (raw database columns); timestamps are ISO-8601 strings. Vendor identifiers (carrier call SID, voice-provider conversation id) are never returned. Which fields are present depends on the endpoint: * `GET /api/calls/{callId}` returns every field below. * `GET /api/calls` (list) returns a slimmer row: it omits `transcript`, `first_response_ms`, `transfer_call_sid`, `transferred_at`, `transferred_to`, `kpi_data`, `llm_cost_usd`, `llm_input_tokens`, `llm_output_tokens`, `sentiment_timeline`, `telemetry_fetched_at`, `tool_call_count`, `mcp_call_count`, `rag_lookup_count`, `tool_result_bytes` and `dnc_scanned_at`. * `POST /api/calls` returns the stored row without the derived fields (`analysis`, `has_recording`, `agent_name`, `campaign_name`, `contact_name`). Telemetry fields are `null` when not measured, which is not the same as 0. Every field is server-generated; calls cannot be edited through the API.
  - `id` (string, required) — Unique identifier of the call.
  - `tenant_id` (string, required) — The workspace that owns the call.
  - `phone_number` (string, required) — The other party's number (E.164).
  - `status` (enum, required) — Lifecycle state. `queued` (row created, not yet accepted by the provider), `ringing` (accepted; native voice-provider calls can stay here for the whole conversation), `in-progress` (answered, when the carrier reports it), and the terminal states `completed`, `failed`, `no-answer`, `busy`, `canceled`.
    - Allowed values: `queued`, `ringing`, `in-progress`, `completed`, `failed`, `no-answer`, `busy`, `canceled`
  - `call_direction` (enum, required) — `outbound` for calls placed by Jelliu, `inbound` for calls received on a workspace number.
    - Allowed values: `inbound`, `outbound`
  - `created_at` (datetime, required) — When the call row was created. Also the list's sort key and cursor.
  - `updated_at` (datetime, required) — Last change to the row.
  - `campaign_id` (string, optional, nullable) — Campaign the call is filed under. Null for manual and inbound calls.
  - `contact_id` (string, optional, nullable) — The contact at the dialed (or calling) number.
  - `agent_id` (string, optional, nullable) — The agent that served the call. Null on legacy rows.
  - `outcome` (string, optional, nullable) — Business outcome written by post-call analysis, e.g. `sale_closed`, `callback_scheduled`, `rejected`, `no_answer`, `voicemail`, `escalated_to_human`, `issue_resolved`, `appointment_booked`, `info_provided`. Null when not analysed or when no outcome was decisive.
  - `duration_seconds` (integer, optional, nullable) — Talk time in seconds. Billed minutes are this, rounded up per call. Null until the call ends.
  - `prompt_variant_id` (string, optional, nullable) — A/B prompt variant the call used.
  - `transcript` (list of object, optional, nullable) — Conversation turns, in order. Detail only. Null until post-call processing.
    - `role` (string, optional) — Who spoke, `agent` or `user`.
    - `message` (string, optional, nullable) — What was said. Null for turns without text (e.g. tool calls).
    - `time_in_call_secs` (double, optional, nullable) — Seconds from the start of the call.
  - `summary` (string, optional, nullable) — Short AI summary of the call, in the call's language.
  - `sentiment_score` (double, optional, nullable) — Overall sentiment, -1 (negative) to 1 (positive). Null when not measured.
  - `frustration_score` (double, optional, nullable) — Frustration, 0 to 1. Null when not measured; 0 means nobody was frustrated.
  - `sentiment_low` (double, optional, nullable) — The worst user turn's sentiment.
  - `objections` (list of string, optional, nullable) — Objections the person raised.
  - `evaluation_criteria_results` (map from string to object, optional) — Per-criterion verdicts from post-call analysis, keyed by criterion id. Empty object when none.
    - `result` (enum, optional) — Verdict: `success`, `failure` or `unknown`.
      - Allowed values: `success`, `failure`, `unknown`
    - `rationale` (string, optional) — Why.
  - `data_collection_results` (map from string to object, optional) — Values the agent extracted during the call, keyed by field id. Empty object when none.
    - `value` (any, optional) — The extracted value (any JSON type).
    - `rationale` (string, optional) — Where it came from.
  - `kpi_data` (map from string to any, optional, nullable) — Campaign KPIs computed from the call. Detail only.
  - `analysis` (object, optional, nullable) — Post-call analysis nested for display. Null when the call has no analysis signal yet. Not returned by `POST /api/calls`.
    - `summary` (string, required) — Same as the top-level `summary`, or empty string.
    - `outcome` (string, required, nullable) — Same as the top-level `outcome`.
    - `sentiment` (enum, required) — Label derived from `sentiment_score`: `positive` above 0.2, `negative` below -0.2, `neutral` otherwise; null when unmeasured.
      - Allowed values: `positive`, `neutral`, `negative`
    - `sentiment_score` (double, required, nullable) — Same as the top-level `sentiment_score`.
    - `key_topics` (list of string, required) — Currently always empty.
    - `qualification` (object, required, nullable) — Lead qualification derived from the collected data. Null when the call captured nothing to judge.
      - `score` (integer, required, nullable) — Qualification score, 0 to 100.
      - `interest` (enum, required) — Interest level: `high`, `medium` or `low`.
        - Allowed values: `high`, `medium`, `low`
      - `answered` (boolean, required, nullable) — Whether a person engaged in the conversation.
      - `next_step` (string, required, nullable) — Agreed next step, if any.
      - `objections` (list of string, required) — Objections raised.
      - `reasons` (list of string, required) — Why the score is what it is.
  - `has_recording` (boolean, optional) — True when a recording can be streamed from `GET /api/calls/{callId}/audio` (the call ended and had a conversation). Not returned by `POST /api/calls`.
  - `agent_name` (string, optional, nullable) — Name of the agent. Not returned by `POST /api/calls`.
  - `campaign_name` (string, optional, nullable) — Name of the campaign. Not returned by `POST /api/calls`.
  - `contact_name` (string, optional, nullable) — Name of the contact. Not returned by `POST /api/calls`.
  - `first_response_ms` (integer, optional, nullable) — Milliseconds until the agent first spoke. Detail only.
  - `transfer_call_sid` (string, optional, nullable) — Carrier id of the warm-transfer leg while a transfer is active. Detail only.
  - `transferred_at` (datetime, optional, nullable) — When a warm transfer started. Detail only.
  - `transferred_to` (string, optional, nullable) — E.164 number the call was transferred to. Detail only.
  - `cost_credits` (double, optional, nullable) — Voice-provider credits charged for the conversation.
  - `cost_usd` (string, optional, nullable) — Provider cost in USD as a decimal string. This is Jelliu's cost, not what the workspace is billed.
  - `llm_cost_usd` (string, optional, nullable) — LLM share of the cost, as a decimal string. Detail only.
  - `termination_reason` (string, optional, nullable) — Why the conversation ended, as reported by the voice provider (free text).
  - `main_language` (string, optional, nullable) — Main language detected in the conversation.
  - `initiation_source` (string, optional, nullable) — How the conversation was started, e.g. `twilio`, `sip_trunk`, `whatsapp`, `js_sdk`.
  - `call_success_score` (double, optional, nullable) — Voice provider's 0-100 confidence the call met its goal.
  - `agent_talk_seconds` (double, optional, nullable) — Seconds of agent audio.
  - `user_talk_seconds` (double, optional, nullable) — Seconds of the other party's audio.
  - `agent_turn_count` (integer, optional, nullable) — Number of agent turns.
  - `user_turn_count` (integer, optional, nullable) — Number of user turns.
  - `interruption_count` (integer, optional, nullable) — Agent turns the person cut off.
  - `avg_response_latency_ms` (double, optional, nullable) — Average silence-to-agent-audio latency, in milliseconds.
  - `max_response_latency_ms` (double, optional, nullable) — Worst agent-turn latency, in milliseconds.
  - `llm_input_tokens` (integer, optional, nullable) — LLM input tokens. Detail only.
  - `llm_output_tokens` (integer, optional, nullable) — LLM output tokens. Detail only.
  - `sentiment_timeline` (list of object, optional, nullable) — Per scored user turn - `t` seconds into the call, `s` sentiment, `f` frustration. Detail only.
    - `t` (double, optional) — Seconds into the call.
    - `s` (double, optional) — Sentiment, -1 to 1.
    - `f` (double, optional) — Frustration, 0 to 1.
  - `telemetry_fetched_at` (datetime, optional, nullable) — When telemetry was last fetched from the voice provider. Detail only.
  - `tool_call_count` (integer, optional, nullable) — Tools invoked during the conversation. Detail only.
  - `mcp_call_count` (integer, optional, nullable) — Tool calls that reached external software (MCP / webhook). Detail only.
  - `rag_lookup_count` (integer, optional, nullable) — Knowledge-base retrievals. Detail only.
  - `tool_result_bytes` (string, optional, nullable) — Characters returned by tool results, as an integer string. Detail only.
  - `dnc_scanned_at` (datetime, optional, nullable) — When the transcript was last scanned for an opt-out request. Detail only.
  - `started_at` (datetime, optional, nullable) — When the conversation started. Null until known.
  - `ended_at` (datetime, optional, nullable) — When the call ended. Null while live.
  - `deleted_at` (datetime, optional, nullable) — Always null on returned rows (deleted calls are not served).

## Errors

### 400 Bad Request Error

The call cannot be placed as requested: - invalid body: message `Invalid call input`, `details` = zod `flatten()` output (e.g. `fieldErrors.phoneNumber: ["Either phoneNumber or contactId is required"]`, `Must be E.164 format`, `Prompt contains disallowed injection patterns`); - the resolved destination is not E.164 (`Invalid or missing phone number (E.164 required)`); - with a `campaignId`, a destination that is not a contact of that campaign; - the telephony account refused the destination (`NUMBER_UNVERIFIED`; the row is kept as `failed`).

- `error` (object, required) — The error object. Always has `code` and `message`.
  - `code` (string, required) — Stable machine-readable error code (for example `VALIDATION_FAILED`, `UNAUTHORIZED`, `FORBIDDEN`, `NOT_FOUND`, `BILLING_ERROR`, `COMPLIANCE_BLOCKED`, `RATE_LIMIT_EXCEEDED`, `INTERNAL_ERROR`). Switch on this, not on `message`. See [Errors](/errors).
  - `message` (string, required) — Human-readable explanation. English or Spanish depending on the route; may change without notice.
  - `details` (object or list of object, optional) — Present on `VALIDATION_FAILED` only. Its shape depends on how the route validates: * a field map, either Zod's `flatten()` output (`{ "formErrors": [], "fieldErrors": { "name": ["..."] } }`) or just its `fieldErrors` part (`{ "name": ["..."] }`); * an issue list, where each issue has at least `path`, `message` and `code`. `path` is a dot-separated string on routes that let the schema throw, and an array of keys on routes that forward Zod's raw issues (those also carry Zod's extra issue fields).
    - Field map
      - `formErrors` (list of string, optional)
      - `fieldErrors` (map from string to list of string, optional)
  - `metadata` (map from string to any, optional) — Structured detail exposed for a small allowlist of codes only — for example `BILLING_ERROR` carries `limit`, `current` and `tier` (resource caps) or `tier` and `feature` (feature gates).

### 401 Unauthorized Error

No usable credential. Either the `Authorization` header is missing or is not a well-formed `Bearer jl_…` key, or the key is unknown, revoked or expired. Do not retry with the same key. See [Authentication](/authentication#401-unauthorized).

- `error` (object, required) — The error object. Always has `code` and `message`.
  - `code` (string, required) — Stable machine-readable error code (for example `VALIDATION_FAILED`, `UNAUTHORIZED`, `FORBIDDEN`, `NOT_FOUND`, `BILLING_ERROR`, `COMPLIANCE_BLOCKED`, `RATE_LIMIT_EXCEEDED`, `INTERNAL_ERROR`). Switch on this, not on `message`. See [Errors](/errors).
  - `message` (string, required) — Human-readable explanation. English or Spanish depending on the route; may change without notice.
  - `details` (object or list of object, optional) — Present on `VALIDATION_FAILED` only. Its shape depends on how the route validates: * a field map, either Zod's `flatten()` output (`{ "formErrors": [], "fieldErrors": { "name": ["..."] } }`) or just its `fieldErrors` part (`{ "name": ["..."] }`); * an issue list, where each issue has at least `path`, `message` and `code`. `path` is a dot-separated string on routes that let the schema throw, and an array of keys on routes that forward Zod's raw issues (those also carry Zod's extra issue fields).
    - Field map
      - `formErrors` (list of string, optional)
      - `fieldErrors` (map from string to list of string, optional)
  - `metadata` (map from string to any, optional) — Structured detail exposed for a small allowlist of codes only — for example `BILLING_ERROR` carries `limit`, `current` and `tier` (resource caps) or `tier` and `feature` (feature gates).

### 403 Forbidden Error

Refused before dialing: compliance or destination policy (`COMPLIANCE_BLOCKED`), no minutes (`BILLING_ERROR`), trial abuse (`TRIAL_ABUSE_DETECTED`), a paying workspace without its dedicated number (`PHONE_NUMBER_REQUIRED`), a key without the `write` scope (`FORBIDDEN`), or a suspended workspace (`TENANT_SUSPENDED`). `COMPLIANCE_BLOCKED` messages name the rule: `Outside allowed call hours (<start>-<end> <timezone>)`, `Phone number matches blocked prefix: <prefix>`, `Phone number is on the opt-out suppression list`, `Contact is on the Do Not Call list`, `Phone number is on the Do Not Call list`, `Max daily call attempts reached (<n>/day)`, `Max total call attempts reached (<n> total)`, or a destination-policy reason.

- `error` (object, required) — The error object. Always has `code` and `message`.
  - `code` (string, required) — Stable machine-readable error code (for example `VALIDATION_FAILED`, `UNAUTHORIZED`, `FORBIDDEN`, `NOT_FOUND`, `BILLING_ERROR`, `COMPLIANCE_BLOCKED`, `RATE_LIMIT_EXCEEDED`, `INTERNAL_ERROR`). Switch on this, not on `message`. See [Errors](/errors).
  - `message` (string, required) — Human-readable explanation. English or Spanish depending on the route; may change without notice.
  - `details` (object or list of object, optional) — Present on `VALIDATION_FAILED` only. Its shape depends on how the route validates: * a field map, either Zod's `flatten()` output (`{ "formErrors": [], "fieldErrors": { "name": ["..."] } }`) or just its `fieldErrors` part (`{ "name": ["..."] }`); * an issue list, where each issue has at least `path`, `message` and `code`. `path` is a dot-separated string on routes that let the schema throw, and an array of keys on routes that forward Zod's raw issues (those also carry Zod's extra issue fields).
    - Field map
      - `formErrors` (list of string, optional)
      - `fieldErrors` (map from string to list of string, optional)
  - `metadata` (map from string to any, optional) — Structured detail exposed for a small allowlist of codes only — for example `BILLING_ERROR` carries `limit`, `current` and `tier` (resource caps) or `tier` and `feature` (feature gates).

### 404 Not Found Error

The agent does not exist in this workspace or was deactivated, or `contactId` does not exist and no `phoneNumber` was given. An unknown `contactId` together with a `phoneNumber` is ignored, not refused.

- `error` (object, required) — The error object. Always has `code` and `message`.
  - `code` (string, required) — Stable machine-readable error code (for example `VALIDATION_FAILED`, `UNAUTHORIZED`, `FORBIDDEN`, `NOT_FOUND`, `BILLING_ERROR`, `COMPLIANCE_BLOCKED`, `RATE_LIMIT_EXCEEDED`, `INTERNAL_ERROR`). Switch on this, not on `message`. See [Errors](/errors).
  - `message` (string, required) — Human-readable explanation. English or Spanish depending on the route; may change without notice.
  - `details` (object or list of object, optional) — Present on `VALIDATION_FAILED` only. Its shape depends on how the route validates: * a field map, either Zod's `flatten()` output (`{ "formErrors": [], "fieldErrors": { "name": ["..."] } }`) or just its `fieldErrors` part (`{ "name": ["..."] }`); * an issue list, where each issue has at least `path`, `message` and `code`. `path` is a dot-separated string on routes that let the schema throw, and an array of keys on routes that forward Zod's raw issues (those also carry Zod's extra issue fields).
    - Field map
      - `formErrors` (list of string, optional)
      - `fieldErrors` (map from string to list of string, optional)
  - `metadata` (map from string to any, optional) — Structured detail exposed for a small allowlist of codes only — for example `BILLING_ERROR` carries `limit`, `current` and `tier` (resource caps) or `tier` and `feature` (feature gates).

### 409 Conflict Error

The agent is paused (`AGENT_PAUSED`; resume it under Agents) or still being provisioned with the voice provider (`AGENT_PROVISIONING`, sent with `Retry-After: 5`; retry shortly).

- `error` (object, required) — The error object. Always has `code` and `message`.
  - `code` (string, required) — Stable machine-readable error code (for example `VALIDATION_FAILED`, `UNAUTHORIZED`, `FORBIDDEN`, `NOT_FOUND`, `BILLING_ERROR`, `COMPLIANCE_BLOCKED`, `RATE_LIMIT_EXCEEDED`, `INTERNAL_ERROR`). Switch on this, not on `message`. See [Errors](/errors).
  - `message` (string, required) — Human-readable explanation. English or Spanish depending on the route; may change without notice.
  - `details` (object or list of object, optional) — Present on `VALIDATION_FAILED` only. Its shape depends on how the route validates: * a field map, either Zod's `flatten()` output (`{ "formErrors": [], "fieldErrors": { "name": ["..."] } }`) or just its `fieldErrors` part (`{ "name": ["..."] }`); * an issue list, where each issue has at least `path`, `message` and `code`. `path` is a dot-separated string on routes that let the schema throw, and an array of keys on routes that forward Zod's raw issues (those also carry Zod's extra issue fields).
    - Field map
      - `formErrors` (list of string, optional)
      - `fieldErrors` (map from string to list of string, optional)
  - `metadata` (map from string to any, optional) — Structured detail exposed for a small allowlist of codes only — for example `BILLING_ERROR` carries `limit`, `current` and `tier` (resource caps) or `tier` and `feature` (feature gates).

### 429 Too Many Requests Error

Too many requests or too many calls: the outbound request budget (`RATE_LIMIT_EXCEEDED`, 20 requests/min), the campaign or plan concurrency cap (`MAX_CONCURRENT_CALLS_REACHED`; wait for a live call to end), or the abuse guard (`CALL_SPAM_DETECTED`: more than 5 calls to one number per hour, or 500 calls per hour in the workspace).

- `error` (object, required) — The error object. Always has `code` and `message`.
  - `code` (string, required) — Stable machine-readable error code (for example `VALIDATION_FAILED`, `UNAUTHORIZED`, `FORBIDDEN`, `NOT_FOUND`, `BILLING_ERROR`, `COMPLIANCE_BLOCKED`, `RATE_LIMIT_EXCEEDED`, `INTERNAL_ERROR`). Switch on this, not on `message`. See [Errors](/errors).
  - `message` (string, required) — Human-readable explanation. English or Spanish depending on the route; may change without notice.
  - `details` (object or list of object, optional) — Present on `VALIDATION_FAILED` only. Its shape depends on how the route validates: * a field map, either Zod's `flatten()` output (`{ "formErrors": [], "fieldErrors": { "name": ["..."] } }`) or just its `fieldErrors` part (`{ "name": ["..."] }`); * an issue list, where each issue has at least `path`, `message` and `code`. `path` is a dot-separated string on routes that let the schema throw, and an array of keys on routes that forward Zod's raw issues (those also carry Zod's extra issue fields).
    - Field map
      - `formErrors` (list of string, optional)
      - `fieldErrors` (map from string to list of string, optional)
  - `metadata` (map from string to any, optional) — Structured detail exposed for a small allowlist of codes only — for example `BILLING_ERROR` carries `limit`, `current` and `tier` (resource caps) or `tier` and `feature` (feature gates).

### 502 Bad Gateway Error

The voice or telephony provider refused the call (`CALL_INITIATION_FAILED`). The row is kept with `status: failed`; the concurrency slot is released. The message is replaced by `Internal server error`. Safe to retry once the cause is gone, since no call was placed.

- `error` (object, required) — The error object. Always has `code` and `message`.
  - `code` (string, required) — Stable machine-readable error code (for example `VALIDATION_FAILED`, `UNAUTHORIZED`, `FORBIDDEN`, `NOT_FOUND`, `BILLING_ERROR`, `COMPLIANCE_BLOCKED`, `RATE_LIMIT_EXCEEDED`, `INTERNAL_ERROR`). Switch on this, not on `message`. See [Errors](/errors).
  - `message` (string, required) — Human-readable explanation. English or Spanish depending on the route; may change without notice.
  - `details` (object or list of object, optional) — Present on `VALIDATION_FAILED` only. Its shape depends on how the route validates: * a field map, either Zod's `flatten()` output (`{ "formErrors": [], "fieldErrors": { "name": ["..."] } }`) or just its `fieldErrors` part (`{ "name": ["..."] }`); * an issue list, where each issue has at least `path`, `message` and `code`. `path` is a dot-separated string on routes that let the schema throw, and an array of keys on routes that forward Zod's raw issues (those also carry Zod's extra issue fields).
    - Field map
      - `formErrors` (list of string, optional)
      - `fieldErrors` (map from string to list of string, optional)
  - `metadata` (map from string to any, optional) — Structured detail exposed for a small allowlist of codes only — for example `BILLING_ERROR` carries `limit`, `current` and `tier` (resource caps) or `tier` and `feature` (feature gates).

### 503 Service Unavailable Error

The agent's pause state could not be read, so the call is refused as a precaution (`AGENT_PAUSED`, message replaced by `Internal server error`). Retry shortly.

- `error` (object, required) — The error object. Always has `code` and `message`.
  - `code` (string, required) — Stable machine-readable error code (for example `VALIDATION_FAILED`, `UNAUTHORIZED`, `FORBIDDEN`, `NOT_FOUND`, `BILLING_ERROR`, `COMPLIANCE_BLOCKED`, `RATE_LIMIT_EXCEEDED`, `INTERNAL_ERROR`). Switch on this, not on `message`. See [Errors](/errors).
  - `message` (string, required) — Human-readable explanation. English or Spanish depending on the route; may change without notice.
  - `details` (object or list of object, optional) — Present on `VALIDATION_FAILED` only. Its shape depends on how the route validates: * a field map, either Zod's `flatten()` output (`{ "formErrors": [], "fieldErrors": { "name": ["..."] } }`) or just its `fieldErrors` part (`{ "name": ["..."] }`); * an issue list, where each issue has at least `path`, `message` and `code`. `path` is a dot-separated string on routes that let the schema throw, and an array of keys on routes that forward Zod's raw issues (those also carry Zod's extra issue fields).
    - Field map
      - `formErrors` (list of string, optional)
      - `fieldErrors` (map from string to list of string, optional)
  - `metadata` (map from string to any, optional) — Structured detail exposed for a small allowlist of codes only — for example `BILLING_ERROR` carries `limit`, `current` and `tier` (resource caps) or `tier` and `feature` (feature gates).

## Examples

### Calls_postCalls_example

**Request**

```json
undefined
```

**Response**

```json
{
  "data": {
    "id": "8d0f3c1e-5b7a-4c52-9d0e-2a6f1b3c4d5e",
    "tenant_id": "5a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d",
    "phone_number": "+573001234567",
    "status": "ringing",
    "call_direction": "outbound",
    "created_at": "2026-09-14T15:02:05.000Z",
    "updated_at": "2026-09-14T15:02:06.000Z",
    "campaign_id": "fbb7c4c9-0e1d-4f58-a3d7-6c3a99b8d7c0",
    "contact_id": "c3a1f2e4-7b6d-4e5f-9a8b-0c1d2e3f4a5b",
    "agent_id": "2f2d8b4d-aa6f-41e0-9d3e-4d61e1b07a11",
    "outcome": null,
    "duration_seconds": null,
    "prompt_variant_id": null,
    "transcript": null,
    "summary": null,
    "sentiment_score": null,
    "started_at": null,
    "ended_at": null,
    "deleted_at": null
  }
}
```

**SDK Code**

```python Calls_postCalls_example
import requests

url = "https://api.jelliu.co/api/calls"

headers = {"Authorization": "Bearer <token>"}

response = requests.post(url, headers=headers)

print(response.json())
```

```javascript Calls_postCalls_example
const url = 'https://api.jelliu.co/api/calls';
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Calls_postCalls_example
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.jelliu.co/api/calls"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Calls_postCalls_example
require 'uri'
require 'net/http'

url = URI("https://api.jelliu.co/api/calls")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java Calls_postCalls_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.jelliu.co/api/calls")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php Calls_postCalls_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.jelliu.co/api/calls', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp Calls_postCalls_example
using RestSharp;

var client = new RestClient("https://api.jelliu.co/api/calls");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift Calls_postCalls_example
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.jelliu.co/api/calls")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Call a number directly

**Request**

```json
{
  "agentId": "2f2d8b4d-aa6f-41e0-9d3e-4d61e1b07a11",
  "phoneNumber": "+573001234567"
}
```

**Response**

```json
{
  "data": {
    "id": "8d0f3c1e-5b7a-4c52-9d0e-2a6f1b3c4d5e",
    "tenant_id": "5a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d",
    "phone_number": "+573001234567",
    "status": "ringing",
    "call_direction": "outbound",
    "created_at": "2026-09-14T15:02:05.000Z",
    "updated_at": "2026-09-14T15:02:06.000Z",
    "campaign_id": "fbb7c4c9-0e1d-4f58-a3d7-6c3a99b8d7c0",
    "contact_id": "c3a1f2e4-7b6d-4e5f-9a8b-0c1d2e3f4a5b",
    "agent_id": "2f2d8b4d-aa6f-41e0-9d3e-4d61e1b07a11",
    "outcome": null,
    "duration_seconds": null,
    "prompt_variant_id": null,
    "transcript": null,
    "summary": null,
    "sentiment_score": null,
    "started_at": null,
    "ended_at": null,
    "deleted_at": null
  }
}
```

**SDK Code**

```python Call a number directly
import requests

url = "https://api.jelliu.co/api/calls"

payload = {
    "agentId": "2f2d8b4d-aa6f-41e0-9d3e-4d61e1b07a11",
    "phoneNumber": "+573001234567"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Call a number directly
const url = 'https://api.jelliu.co/api/calls';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"agentId":"2f2d8b4d-aa6f-41e0-9d3e-4d61e1b07a11","phoneNumber":"+573001234567"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Call a number directly
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.jelliu.co/api/calls"

	payload := strings.NewReader("{\n  \"agentId\": \"2f2d8b4d-aa6f-41e0-9d3e-4d61e1b07a11\",\n  \"phoneNumber\": \"+573001234567\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Call a number directly
require 'uri'
require 'net/http'

url = URI("https://api.jelliu.co/api/calls")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"agentId\": \"2f2d8b4d-aa6f-41e0-9d3e-4d61e1b07a11\",\n  \"phoneNumber\": \"+573001234567\"\n}"

response = http.request(request)
puts response.read_body
```

```java Call a number directly
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.jelliu.co/api/calls")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"agentId\": \"2f2d8b4d-aa6f-41e0-9d3e-4d61e1b07a11\",\n  \"phoneNumber\": \"+573001234567\"\n}")
  .asString();
```

```php Call a number directly
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.jelliu.co/api/calls', [
  'body' => '{
  "agentId": "2f2d8b4d-aa6f-41e0-9d3e-4d61e1b07a11",
  "phoneNumber": "+573001234567"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Call a number directly
using RestSharp;

var client = new RestClient("https://api.jelliu.co/api/calls");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"agentId\": \"2f2d8b4d-aa6f-41e0-9d3e-4d61e1b07a11\",\n  \"phoneNumber\": \"+573001234567\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Call a number directly
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "agentId": "2f2d8b4d-aa6f-41e0-9d3e-4d61e1b07a11",
  "phoneNumber": "+573001234567"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.jelliu.co/api/calls")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Call an existing contact

**Request**

```json
{
  "agentId": "2f2d8b4d-aa6f-41e0-9d3e-4d61e1b07a11",
  "contactId": "c3a1f2e4-7b6d-4e5f-9a8b-0c1d2e3f4a5b"
}
```

**Response**

```json
{
  "data": {
    "id": "8d0f3c1e-5b7a-4c52-9d0e-2a6f1b3c4d5e",
    "tenant_id": "5a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d",
    "phone_number": "+573001234567",
    "status": "ringing",
    "call_direction": "outbound",
    "created_at": "2026-09-14T15:02:05.000Z",
    "updated_at": "2026-09-14T15:02:06.000Z",
    "campaign_id": "fbb7c4c9-0e1d-4f58-a3d7-6c3a99b8d7c0",
    "contact_id": "c3a1f2e4-7b6d-4e5f-9a8b-0c1d2e3f4a5b",
    "agent_id": "2f2d8b4d-aa6f-41e0-9d3e-4d61e1b07a11",
    "outcome": null,
    "duration_seconds": null,
    "prompt_variant_id": null,
    "transcript": null,
    "summary": null,
    "sentiment_score": null,
    "started_at": null,
    "ended_at": null,
    "deleted_at": null
  }
}
```

**SDK Code**

```python Call an existing contact
import requests

url = "https://api.jelliu.co/api/calls"

payload = {
    "agentId": "2f2d8b4d-aa6f-41e0-9d3e-4d61e1b07a11",
    "contactId": "c3a1f2e4-7b6d-4e5f-9a8b-0c1d2e3f4a5b"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Call an existing contact
const url = 'https://api.jelliu.co/api/calls';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"agentId":"2f2d8b4d-aa6f-41e0-9d3e-4d61e1b07a11","contactId":"c3a1f2e4-7b6d-4e5f-9a8b-0c1d2e3f4a5b"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Call an existing contact
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.jelliu.co/api/calls"

	payload := strings.NewReader("{\n  \"agentId\": \"2f2d8b4d-aa6f-41e0-9d3e-4d61e1b07a11\",\n  \"contactId\": \"c3a1f2e4-7b6d-4e5f-9a8b-0c1d2e3f4a5b\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Call an existing contact
require 'uri'
require 'net/http'

url = URI("https://api.jelliu.co/api/calls")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"agentId\": \"2f2d8b4d-aa6f-41e0-9d3e-4d61e1b07a11\",\n  \"contactId\": \"c3a1f2e4-7b6d-4e5f-9a8b-0c1d2e3f4a5b\"\n}"

response = http.request(request)
puts response.read_body
```

```java Call an existing contact
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.jelliu.co/api/calls")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"agentId\": \"2f2d8b4d-aa6f-41e0-9d3e-4d61e1b07a11\",\n  \"contactId\": \"c3a1f2e4-7b6d-4e5f-9a8b-0c1d2e3f4a5b\"\n}")
  .asString();
```

```php Call an existing contact
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.jelliu.co/api/calls', [
  'body' => '{
  "agentId": "2f2d8b4d-aa6f-41e0-9d3e-4d61e1b07a11",
  "contactId": "c3a1f2e4-7b6d-4e5f-9a8b-0c1d2e3f4a5b"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Call an existing contact
using RestSharp;

var client = new RestClient("https://api.jelliu.co/api/calls");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"agentId\": \"2f2d8b4d-aa6f-41e0-9d3e-4d61e1b07a11\",\n  \"contactId\": \"c3a1f2e4-7b6d-4e5f-9a8b-0c1d2e3f4a5b\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Call an existing contact
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "agentId": "2f2d8b4d-aa6f-41e0-9d3e-4d61e1b07a11",
  "contactId": "c3a1f2e4-7b6d-4e5f-9a8b-0c1d2e3f4a5b"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.jelliu.co/api/calls")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Campaign call with a per-call greeting and prompt

**Request**

```json
{
  "agentId": "2f2d8b4d-aa6f-41e0-9d3e-4d61e1b07a11",
  "phoneNumber": "+573001234567",
  "campaignId": "fbb7c4c9-0e1d-4f58-a3d7-6c3a99b8d7c0",
  "promptVariantId": "0e6c1a2b-3d4f-4a5b-8c9d-7e6f5a4b3c2d",
  "promptOverride": "Confirma la cita del martes a las 10:00. Si la clienta no puede, ofrece el jueves a las 16:00. Sé breve y cordial.",
  "firstMessageOverride": "Hola Laura, te habla Sofía de Clínica Dental Sonrisas. ¿Tienes un minuto para confirmar tu cita?"
}
```

**Response**

```json
{
  "data": {
    "id": "8d0f3c1e-5b7a-4c52-9d0e-2a6f1b3c4d5e",
    "tenant_id": "5a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d",
    "phone_number": "+573001234567",
    "status": "ringing",
    "call_direction": "outbound",
    "created_at": "2026-09-14T15:02:05.000Z",
    "updated_at": "2026-09-14T15:02:06.000Z",
    "campaign_id": "fbb7c4c9-0e1d-4f58-a3d7-6c3a99b8d7c0",
    "contact_id": "c3a1f2e4-7b6d-4e5f-9a8b-0c1d2e3f4a5b",
    "agent_id": "2f2d8b4d-aa6f-41e0-9d3e-4d61e1b07a11",
    "outcome": null,
    "duration_seconds": null,
    "prompt_variant_id": null,
    "transcript": null,
    "summary": null,
    "sentiment_score": null,
    "started_at": null,
    "ended_at": null,
    "deleted_at": null
  }
}
```

**SDK Code**

```python Campaign call with a per-call greeting and prompt
import requests

url = "https://api.jelliu.co/api/calls"

payload = {
    "agentId": "2f2d8b4d-aa6f-41e0-9d3e-4d61e1b07a11",
    "phoneNumber": "+573001234567",
    "campaignId": "fbb7c4c9-0e1d-4f58-a3d7-6c3a99b8d7c0",
    "promptVariantId": "0e6c1a2b-3d4f-4a5b-8c9d-7e6f5a4b3c2d",
    "promptOverride": "Confirma la cita del martes a las 10:00. Si la clienta no puede, ofrece el jueves a las 16:00. Sé breve y cordial.",
    "firstMessageOverride": "Hola Laura, te habla Sofía de Clínica Dental Sonrisas. ¿Tienes un minuto para confirmar tu cita?"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Campaign call with a per-call greeting and prompt
const url = 'https://api.jelliu.co/api/calls';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"agentId":"2f2d8b4d-aa6f-41e0-9d3e-4d61e1b07a11","phoneNumber":"+573001234567","campaignId":"fbb7c4c9-0e1d-4f58-a3d7-6c3a99b8d7c0","promptVariantId":"0e6c1a2b-3d4f-4a5b-8c9d-7e6f5a4b3c2d","promptOverride":"Confirma la cita del martes a las 10:00. Si la clienta no puede, ofrece el jueves a las 16:00. Sé breve y cordial.","firstMessageOverride":"Hola Laura, te habla Sofía de Clínica Dental Sonrisas. ¿Tienes un minuto para confirmar tu cita?"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Campaign call with a per-call greeting and prompt
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.jelliu.co/api/calls"

	payload := strings.NewReader("{\n  \"agentId\": \"2f2d8b4d-aa6f-41e0-9d3e-4d61e1b07a11\",\n  \"phoneNumber\": \"+573001234567\",\n  \"campaignId\": \"fbb7c4c9-0e1d-4f58-a3d7-6c3a99b8d7c0\",\n  \"promptVariantId\": \"0e6c1a2b-3d4f-4a5b-8c9d-7e6f5a4b3c2d\",\n  \"promptOverride\": \"Confirma la cita del martes a las 10:00. Si la clienta no puede, ofrece el jueves a las 16:00. Sé breve y cordial.\",\n  \"firstMessageOverride\": \"Hola Laura, te habla Sofía de Clínica Dental Sonrisas. ¿Tienes un minuto para confirmar tu cita?\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Campaign call with a per-call greeting and prompt
require 'uri'
require 'net/http'

url = URI("https://api.jelliu.co/api/calls")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"agentId\": \"2f2d8b4d-aa6f-41e0-9d3e-4d61e1b07a11\",\n  \"phoneNumber\": \"+573001234567\",\n  \"campaignId\": \"fbb7c4c9-0e1d-4f58-a3d7-6c3a99b8d7c0\",\n  \"promptVariantId\": \"0e6c1a2b-3d4f-4a5b-8c9d-7e6f5a4b3c2d\",\n  \"promptOverride\": \"Confirma la cita del martes a las 10:00. Si la clienta no puede, ofrece el jueves a las 16:00. Sé breve y cordial.\",\n  \"firstMessageOverride\": \"Hola Laura, te habla Sofía de Clínica Dental Sonrisas. ¿Tienes un minuto para confirmar tu cita?\"\n}"

response = http.request(request)
puts response.read_body
```

```java Campaign call with a per-call greeting and prompt
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.jelliu.co/api/calls")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"agentId\": \"2f2d8b4d-aa6f-41e0-9d3e-4d61e1b07a11\",\n  \"phoneNumber\": \"+573001234567\",\n  \"campaignId\": \"fbb7c4c9-0e1d-4f58-a3d7-6c3a99b8d7c0\",\n  \"promptVariantId\": \"0e6c1a2b-3d4f-4a5b-8c9d-7e6f5a4b3c2d\",\n  \"promptOverride\": \"Confirma la cita del martes a las 10:00. Si la clienta no puede, ofrece el jueves a las 16:00. Sé breve y cordial.\",\n  \"firstMessageOverride\": \"Hola Laura, te habla Sofía de Clínica Dental Sonrisas. ¿Tienes un minuto para confirmar tu cita?\"\n}")
  .asString();
```

```php Campaign call with a per-call greeting and prompt
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.jelliu.co/api/calls', [
  'body' => '{
  "agentId": "2f2d8b4d-aa6f-41e0-9d3e-4d61e1b07a11",
  "phoneNumber": "+573001234567",
  "campaignId": "fbb7c4c9-0e1d-4f58-a3d7-6c3a99b8d7c0",
  "promptVariantId": "0e6c1a2b-3d4f-4a5b-8c9d-7e6f5a4b3c2d",
  "promptOverride": "Confirma la cita del martes a las 10:00. Si la clienta no puede, ofrece el jueves a las 16:00. Sé breve y cordial.",
  "firstMessageOverride": "Hola Laura, te habla Sofía de Clínica Dental Sonrisas. ¿Tienes un minuto para confirmar tu cita?"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Campaign call with a per-call greeting and prompt
using RestSharp;

var client = new RestClient("https://api.jelliu.co/api/calls");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"agentId\": \"2f2d8b4d-aa6f-41e0-9d3e-4d61e1b07a11\",\n  \"phoneNumber\": \"+573001234567\",\n  \"campaignId\": \"fbb7c4c9-0e1d-4f58-a3d7-6c3a99b8d7c0\",\n  \"promptVariantId\": \"0e6c1a2b-3d4f-4a5b-8c9d-7e6f5a4b3c2d\",\n  \"promptOverride\": \"Confirma la cita del martes a las 10:00. Si la clienta no puede, ofrece el jueves a las 16:00. Sé breve y cordial.\",\n  \"firstMessageOverride\": \"Hola Laura, te habla Sofía de Clínica Dental Sonrisas. ¿Tienes un minuto para confirmar tu cita?\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Campaign call with a per-call greeting and prompt
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "agentId": "2f2d8b4d-aa6f-41e0-9d3e-4d61e1b07a11",
  "phoneNumber": "+573001234567",
  "campaignId": "fbb7c4c9-0e1d-4f58-a3d7-6c3a99b8d7c0",
  "promptVariantId": "0e6c1a2b-3d4f-4a5b-8c9d-7e6f5a4b3c2d",
  "promptOverride": "Confirma la cita del martes a las 10:00. Si la clienta no puede, ofrece el jueves a las 16:00. Sé breve y cordial.",
  "firstMessageOverride": "Hola Laura, te habla Sofía de Clínica Dental Sonrisas. ¿Tienes un minuto para confirmar tu cita?"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.jelliu.co/api/calls")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```