curl --request POST \
--url https://api.goyappr.com/calls \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "phone",
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"to": "+972501234567",
"from": "+972551234567",
"variables": {
"LeadName": "David Cohen",
"OrderNumber": "ORD-1234"
},
"metadata": {
"appointment_id": "ghl-apt-abc123",
"calendar_id": "ghl-cal-xyz789",
"contact_id": "ghl-contact-def456"
},
"allowed_origins": [
"https://app.example.com"
],
"lead_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"workflow_revision_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'import requests
url = "https://api.goyappr.com/calls"
payload = {
"type": "phone",
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"to": "+972501234567",
"from": "+972551234567",
"variables": {
"LeadName": "David Cohen",
"OrderNumber": "ORD-1234"
},
"metadata": {
"appointment_id": "ghl-apt-abc123",
"calendar_id": "ghl-cal-xyz789",
"contact_id": "ghl-contact-def456"
},
"allowed_origins": ["https://app.example.com"],
"lead_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"workflow_revision_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
type: 'phone',
agent_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
to: '+972501234567',
from: '+972551234567',
variables: {LeadName: 'David Cohen', OrderNumber: 'ORD-1234'},
metadata: {
appointment_id: 'ghl-apt-abc123',
calendar_id: 'ghl-cal-xyz789',
contact_id: 'ghl-contact-def456'
},
allowed_origins: ['https://app.example.com'],
lead_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
workflow_revision_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
})
};
fetch('https://api.goyappr.com/calls', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.goyappr.com/calls",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'type' => 'phone',
'agent_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'to' => '+972501234567',
'from' => '+972551234567',
'variables' => [
'LeadName' => 'David Cohen',
'OrderNumber' => 'ORD-1234'
],
'metadata' => [
'appointment_id' => 'ghl-apt-abc123',
'calendar_id' => 'ghl-cal-xyz789',
'contact_id' => 'ghl-contact-def456'
],
'allowed_origins' => [
'https://app.example.com'
],
'lead_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'workflow_revision_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.goyappr.com/calls"
payload := strings.NewReader("{\n \"type\": \"phone\",\n \"agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"to\": \"+972501234567\",\n \"from\": \"+972551234567\",\n \"variables\": {\n \"LeadName\": \"David Cohen\",\n \"OrderNumber\": \"ORD-1234\"\n },\n \"metadata\": {\n \"appointment_id\": \"ghl-apt-abc123\",\n \"calendar_id\": \"ghl-cal-xyz789\",\n \"contact_id\": \"ghl-contact-def456\"\n },\n \"allowed_origins\": [\n \"https://app.example.com\"\n ],\n \"lead_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"workflow_revision_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\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(string(body))
}HttpResponse<String> response = Unirest.post("https://api.goyappr.com/calls")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"phone\",\n \"agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"to\": \"+972501234567\",\n \"from\": \"+972551234567\",\n \"variables\": {\n \"LeadName\": \"David Cohen\",\n \"OrderNumber\": \"ORD-1234\"\n },\n \"metadata\": {\n \"appointment_id\": \"ghl-apt-abc123\",\n \"calendar_id\": \"ghl-cal-xyz789\",\n \"contact_id\": \"ghl-contact-def456\"\n },\n \"allowed_origins\": [\n \"https://app.example.com\"\n ],\n \"lead_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"workflow_revision_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.goyappr.com/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 \"type\": \"phone\",\n \"agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"to\": \"+972501234567\",\n \"from\": \"+972551234567\",\n \"variables\": {\n \"LeadName\": \"David Cohen\",\n \"OrderNumber\": \"ORD-1234\"\n },\n \"metadata\": {\n \"appointment_id\": \"ghl-apt-abc123\",\n \"calendar_id\": \"ghl-cal-xyz789\",\n \"contact_id\": \"ghl-contact-def456\"\n },\n \"allowed_origins\": [\n \"https://app.example.com\"\n ],\n \"lead_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"workflow_revision_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}"
response = http.request(request)
puts response.read_body{
"call_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "dnc_blocked",
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"to": "<string>",
"from": "<string>",
"message": "<string>",
"dnc_reason": "<string>",
"started_at": "2023-11-07T05:31:56Z",
"ended_at": "2023-11-07T05:31:56Z"
}{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "<string>",
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"to": "<string>",
"from": "<string>",
"created_at": "2023-11-07T05:31:56Z"
}{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "queued",
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"to": "<string>",
"from": "<string>",
"queue_position": 123,
"queued_at": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z",
"message": "<string>"
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}Create Outbound Call
Place an outbound phone call using a Yappr agent (default), or — with type: "web" — mint a short-lived browser session token for an in-browser voice call via the @goyappr/client SDK. A phone call needs a balance above the billing floor and an active Yappr phone number; if server capacity is fully utilized it is queued automatically and returns HTTP 202. A web session does not place a call and is not queued — it returns a token the visitor’s browser uses to connect. Minting always succeeds for a reachable active agent, and the response’s protocol says which exchange the browser must speak: offer for the one-shot connection most agents use, or call_request when the agent’s published workflow runs before-call steps or has follow-ups (After steps) - a one-shot connection has no workflow run for either, so a follow-up on it would never start - which the browser creates, polls and then starts. Follow protocol rather than inferring it from the workflow. A web channel alongside before-call steps publishes and works; only an older client that ignores protocol and sends a one-shot offer anyway is refused, with 409 workflow_preparation_required, and its token is not spent.
curl --request POST \
--url https://api.goyappr.com/calls \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "phone",
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"to": "+972501234567",
"from": "+972551234567",
"variables": {
"LeadName": "David Cohen",
"OrderNumber": "ORD-1234"
},
"metadata": {
"appointment_id": "ghl-apt-abc123",
"calendar_id": "ghl-cal-xyz789",
"contact_id": "ghl-contact-def456"
},
"allowed_origins": [
"https://app.example.com"
],
"lead_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"workflow_revision_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'import requests
url = "https://api.goyappr.com/calls"
payload = {
"type": "phone",
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"to": "+972501234567",
"from": "+972551234567",
"variables": {
"LeadName": "David Cohen",
"OrderNumber": "ORD-1234"
},
"metadata": {
"appointment_id": "ghl-apt-abc123",
"calendar_id": "ghl-cal-xyz789",
"contact_id": "ghl-contact-def456"
},
"allowed_origins": ["https://app.example.com"],
"lead_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"workflow_revision_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
type: 'phone',
agent_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
to: '+972501234567',
from: '+972551234567',
variables: {LeadName: 'David Cohen', OrderNumber: 'ORD-1234'},
metadata: {
appointment_id: 'ghl-apt-abc123',
calendar_id: 'ghl-cal-xyz789',
contact_id: 'ghl-contact-def456'
},
allowed_origins: ['https://app.example.com'],
lead_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
workflow_revision_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
})
};
fetch('https://api.goyappr.com/calls', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.goyappr.com/calls",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'type' => 'phone',
'agent_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'to' => '+972501234567',
'from' => '+972551234567',
'variables' => [
'LeadName' => 'David Cohen',
'OrderNumber' => 'ORD-1234'
],
'metadata' => [
'appointment_id' => 'ghl-apt-abc123',
'calendar_id' => 'ghl-cal-xyz789',
'contact_id' => 'ghl-contact-def456'
],
'allowed_origins' => [
'https://app.example.com'
],
'lead_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'workflow_revision_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.goyappr.com/calls"
payload := strings.NewReader("{\n \"type\": \"phone\",\n \"agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"to\": \"+972501234567\",\n \"from\": \"+972551234567\",\n \"variables\": {\n \"LeadName\": \"David Cohen\",\n \"OrderNumber\": \"ORD-1234\"\n },\n \"metadata\": {\n \"appointment_id\": \"ghl-apt-abc123\",\n \"calendar_id\": \"ghl-cal-xyz789\",\n \"contact_id\": \"ghl-contact-def456\"\n },\n \"allowed_origins\": [\n \"https://app.example.com\"\n ],\n \"lead_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"workflow_revision_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\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(string(body))
}HttpResponse<String> response = Unirest.post("https://api.goyappr.com/calls")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"phone\",\n \"agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"to\": \"+972501234567\",\n \"from\": \"+972551234567\",\n \"variables\": {\n \"LeadName\": \"David Cohen\",\n \"OrderNumber\": \"ORD-1234\"\n },\n \"metadata\": {\n \"appointment_id\": \"ghl-apt-abc123\",\n \"calendar_id\": \"ghl-cal-xyz789\",\n \"contact_id\": \"ghl-contact-def456\"\n },\n \"allowed_origins\": [\n \"https://app.example.com\"\n ],\n \"lead_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"workflow_revision_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.goyappr.com/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 \"type\": \"phone\",\n \"agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"to\": \"+972501234567\",\n \"from\": \"+972551234567\",\n \"variables\": {\n \"LeadName\": \"David Cohen\",\n \"OrderNumber\": \"ORD-1234\"\n },\n \"metadata\": {\n \"appointment_id\": \"ghl-apt-abc123\",\n \"calendar_id\": \"ghl-cal-xyz789\",\n \"contact_id\": \"ghl-contact-def456\"\n },\n \"allowed_origins\": [\n \"https://app.example.com\"\n ],\n \"lead_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"workflow_revision_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}"
response = http.request(request)
puts response.read_body{
"call_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "dnc_blocked",
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"to": "<string>",
"from": "<string>",
"message": "<string>",
"dnc_reason": "<string>",
"started_at": "2023-11-07T05:31:56Z",
"ended_at": "2023-11-07T05:31:56Z"
}{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "<string>",
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"to": "<string>",
"from": "<string>",
"created_at": "2023-11-07T05:31:56Z"
}{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "queued",
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"to": "<string>",
"from": "<string>",
"queue_position": 123,
"queued_at": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z",
"message": "<string>"
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}Letting the number choose the agent
agent_id is optional. Leave it out and the from number decides who calls:
its outbound agent, or — if that number is running an A/B test — whichever of
its two agents the split picks.
curl -X POST https://api.goyappr.com/calls \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "x-company-id: COMPANY_ID" \
-H "Idempotency-Key: lead-8817" \
-H "Content-Type: application/json" \
-d '{ "to": "+972501234567", "from": "+972551234567" }'
- An explicit
agent_idalways wins. Send one and no split is consulted. - A number with no agent attached is refused,
422 AGENT_NOT_RESOLVED: Attach an agent to this phone number or send agent_id. Nothing is queued and nothing is dialed. - Retrying is safe, even after you change the split. The split is resolved
from your
Idempotency-Key, so the same request always resolves to the same agent, and the agent is fixed on the call the moment it is accepted — a redial never re-rolls it. A retry under a key that was already accepted reuses the agent that call went out with, so editing the number’s split (or turning the losing version off) never turns an outstanding retry into a conflict. - The call says which version placed it. When a split resolved the agent,
the call carries
ab_variant("a"for the number’s own agent,"b"for the second one). You cannot set it yourself: a value sent inmetadatais dropped. Filter on it withGET /calls?ab_variant=b.
PATCH /phone-numbers/{id}.
Pinning a published version
Workflow agents accept an optionalworkflow_revision_id. It places the call on one exact published version of the agent instead of whichever version is current when the call goes out — useful when a batch must stay on the version you tested.
curl -X POST https://api.goyappr.com/calls \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "x-company-id: COMPANY_ID" \
-H "Idempotency-Key: batch-2026-09-15-0001" \
-H "Content-Type: application/json" \
-d '{
"agent_id": "AGENT_ID",
"to": "+972501234567",
"from": "+972551234567",
"workflow_revision_id": "REVISION_ID"
}'
null) to use the agent’s current published version. Sending it for an agent that is not a workflow agent is 422 WORKFLOW_PIN_INVALID.
A version id that this agent does not own fails later and differently: 404 WORKFLOW_AGENT_UNAVAILABLE, the same answer as an agent that is archived or not in this workspace. Take the id from the data[].id of GET /agents/{id}/workflow/versions and you will never see it.
Accepted, then placed
On a workflow agent this endpoint answers202, not 201 — every outbound call is accepted first and placed afterwards. That is the normal success response for those agents, not an overflow signal.
The body carries a request_id. Follow the call with GET /call-requests/{id} until call_id appears, then read the call itself with GET /calls/{id}. Stop a call that has not gone out yet with POST /call-requests/{id}/cancel — that is not a hang-up, and it stops working once placement has been claimed.
status is scheduled when the workspace’s calling window is not open yet and queued otherwise; scheduled_for is then the earliest moment the call can go out, and expires_at is when the request is abandoned.
Three other results also use 202, and none of them is a live call:
- Queued at capacity — every line was busy. It carries
queue_position, and the call is placed when a line frees up. - Deferred to the next calling window — the workspace is outside its outbound calling hours.
statusisscheduledandscheduled_foris the opening. This is the non-workflow version of thescheduledacceptance above. - Returned to the queue — the call was prepared and handed back before dialling, and will be retried automatically. It is the only
202with noid: it carriesstatus,messageand a short diagnosticreasonlabel. Do not place it again yourself.
status: request_id means the workflow acceptance, queue_position means at capacity, scheduled_for without request_id means the calling window, and no id at all means it was handed back.
Rejected before acceptance
A destination that cannot be dialled is400 invalid_destination, and that is the only code for it — whether the number is malformed (not E.164, or an Israeli number carrying a leading 0 after the country code or the wrong digit count) or well-formed but unreachable (an Israeli mobile, non-geographic or landline number with the wrong number of digits, a mobile prefix that is no longer in service, or a service number such as 1-800). Calls can only be placed to Israeli numbers (+972): any other country is refused the same way, with the error “Calls can only be placed to Israeli numbers (+972).” The error text names the problem. Nothing was accepted, placed or charged, and the same number will fail the same way every time, so fix the number rather than retrying.
The number you call from has its own code, 400 INVALID_FROM_NUMBER, and calling a number from itself is 400 SELF_CALL_NOT_ALLOWED.
from may also be your phone system’s business number: the phone_system number of an
extension endpoint with outbound calls
on. The call then goes out through your own phone system, on your phone plan. Before
anything is reserved it can be refused with 422:
code | Why |
|---|---|
PHONE_SYSTEM_OUTBOUND_OFF | Outbound calls are switched off on that endpoint. |
PHONE_SYSTEM_OUTBOUND_PAUSED | Your phone system refused the last calls, so they paused. Fix it, then send {"register": {"outbound": {"enabled": true}}} to the endpoint. |
PHONE_SYSTEM_NOT_CONNECTED | The endpoint is switched off or not registered. |
DESTINATION_OUTSIDE_PHONE_SYSTEM_COUNTRY | to is outside Israel and the endpoint dials in national format. |
max_concurrent_calls, incoming and
outgoing together), the call is queued (202) like at any other limit. A call your phone
system refuses before it rings fails with failure.code phone_system_refused.
A key limited to some agents names one of them in agent_id (403 AGENT_OUTSIDE_KEY_SCOPE otherwise) and calls from a number one of them answers or calls from. Any other from — another client’s number, or one no agent uses — is 403 API_KEY_AGENT_SCOPED, the same answer whether the number exists or not.
Leaving to or from out altogether is a different answer again:
422 WORKFLOW_REQUEST_INVALID, naming the field that is missing. An agent_id
that names no agent in this workspace is 404 AGENT_NOT_FOUND — the answer
every route gives a missing agent, a browser session included — and an agent
that is here but archived or switched off is 404 WORKFLOW_AGENT_UNAVAILABLE.
A phone call to an agent that runs a workflow reads agent_id, to, from,
variables, metadata, workflow_revision_id and type, and refuses anything
else with 422 WORKFLOW_REQUEST_INVALID, naming the field. A phone call to an
agent that does not run a workflow still ignores a field it does not read.
Paused by the workspace’s own spending limit
A workspace can set itself a monthly spending limit. While this calendar month’s charges have reached it, this endpoint answers402 SPEND_BUDGET_REACHED — before anything is dialled and before anything is charged.
Nothing is wrong with the account.
Every outbound phone call is covered, including a workflow agent’s call request and one
already accepted and waiting for its calling window. Three things are not, and keep working
while the limit is reached: calls coming in, browser rehearsals (type: "web", which is what
the dashboard’s Test Call places) and the calls a shared link places.
Do not retry the same request: the limit lifts when it is raised or turned off with
PATCH /billing, or by itself at the start of the
next calendar month. Read where the month stands — monthly_spend_cents,
monthly_budget_cents, monthly_budget_remaining_cents and monthly_budget_reached — with
GET /billing, and say so to your own users rather than
letting a paused workspace look like a silent one.
402 BILLING_ERROR is the other thing that shares this status and is not this: that one means
the call cannot be paid for at all. Branch on code, not on the status.
Browser calls and before-call steps
type: "web" mints a single-use session token; nothing is placed until the
visitor’s browser connects with it through the @goyappr/client SDK.
The call exists from the moment the mint answers — unless the mint
returns protocol: "call_request" (below): that session’s call_id is null,
and its call is created when the browser starts the request. Otherwise the
response carries call_id, and GET /calls/{id} answers for it at
once with status: "pending_connection" — minted, nobody connected yet. When
the browser connects, that same call turns ringing and runs; its id never
changes, so a rehearsal’s duration, cost, transcript and analysis are read with
the id you already hold. If nobody connects, the call settles no_answer, with
failure.code: "session_expired", ended_by: "system" and cost_cents: 0,
as soon as its token has expired unused: at once when you read it after
expires_at — with GET /calls/{id},
GET /calls or the export — and otherwise at the
next run of the sweep that settles such calls (every five minutes). A token a
browser did spend, on a connection that never came up, is given one more
minute past expires_at before it settles the same way. To end one
nobody will open, call POST /calls/{id}/end: it
settles at once, ended_by: "operator" and no failure. Mint when the person presses
the button, not on page load: every mint is a call record.
While it waits, the call reads as one that has not started: direction is
web_call (every browser call’s direction; "type": "web" is only the
request’s word for it), analysis is pending with reason: "call_in_progress",
and execution.owner is legacy until a browser connects and the call runs.
metadata sent with the mint is on that call — on
GET /calls rows too — and follows the same rules
as a phone call’s, so a reserved key is 400 INVALID_METADATA_RESERVED_KEY.
lead_id attaches the call to one of this workspace’s
leads: the call carries that lead, and what the
post-call pass learns is written to it, as it would be for a phone call to that
lead’s number. A lead_id that is not an id is 400; one that is not a lead in
this workspace, or a deleted one, is 404, rather than being dropped. An agent
whose workflow runs before-call steps (protocol: "call_request", below) cannot
take one: its call is created by the call request, which has no lead, so the
mint is refused with 422 WEB_LEAD_UNSUPPORTED and no token is issued.
A call_request session (below) returns call_id: null: its call is created
when the request starts, and the request reports that id. To follow that
session from your server, have the page pass you the request_id its call
request answered with, and read it with
GET /call-requests/{id} and your secret
key: it reports the before-call steps (preparation_steps: each step’s name,
status and, on one that failed, its error_code and http_status), the
call_id once the call starts, and how the request ended if it never did.
Discarding a session nobody will use
Every mint returnscancel_url, for either protocol. Send it a POST with
the session token as x-yappr-web-token and no body (or {}), from your server or from
the page you handed the token to, and the token is spent so no browser can use
it — the only way to take back a call_request session, which has no call to
end:
curl -X POST https://api.goyappr.com/web-call/cancel \
-H "x-yappr-web-token: wcs_…"
{ "status": "cancelled", "call_id": "75a8e137-…" }
offer session’s call settles at once, exactly as
POST /calls/{id}/end settles it (call_id names
it); a call_request session answers call_id: null. Sending it again answers
the same. A token that has already expired answers "status": "expired", and
nothing is left to take back.
Once a page has created a call request with the token, the same cancel_url
cancels that request, exactly as
POST /call-requests/{id}/cancel does,
and names it:
{ "status": "cancelled", "call_id": null, "request_id": "9f1c…" }
409 CALL_REQUEST_FINAL with its status,
error_code, call_id and request_id, and nothing is written. A token a
browser spent on a one-shot offer is refused with 409 WEB_SESSION_ALREADY_USED: end the call it started. A body with a
field in it, or one that is not JSON, is refused with 400 WEB_SESSION_CANCEL_INVALID — none, or {}, is the same request — and an
unknown token with 401. Like the other browser routes it takes the token,
never your secret key.
A cancelled token stays cancelled: a browser that still presents it is refused
403 WEB_SESSION_CANCELLED, whether it sends an offer or creates a call
request, so a page can tell a session you took back from one that ran out
(403 “This session token has expired”).
Browser sessions are rehearsals, so calling windows
do not apply to them: a web mint returns 201 immediately even when every
window is closed and both toggles are on. Windows gate telephony — the 202 scheduled deferral above, and inbound PSTN calls. To hold a browser call to
your hours, read GET /call-windows and decide in your own page before minting.
A browser session reads type, agent_id, metadata, variables,
allowed_origins and lead_id. Any other field is refused with 400 WEB_CALL_REQUEST_INVALID, naming it, before anything is minted — a misspelt
field used to mint a session that silently did not carry it. to,
from and workflow_revision_id belong to a phone call. A field of the
wrong type is refused the same way: metadata and variables are objects,
and allowed_origins is an array of origins — "allowed_origins": "https://example.com" used to mint a session with no allowlist at all.
A mint is refused, before any token is spent, when the agent cannot take the
call: 409 WORKFLOW_AGENT_INACTIVE when it is switched off — a copy made
with POST /agents/{id}/duplicate starts that way — and 409 WORKFLOW_UNPUBLISHED when it is a workflow agent whose workflow has never
been published. Both used to be wrong in opposite directions: the first was a
bare 400 with no code to branch on, and the second minted a token that could
only fail once a browser spent it. An agent of the retired prompt kind has no
publication and is never asked for one.
An agent whose workflow runs before-call steps, or has follow-ups (After
steps), needs a different exchange: a one-shot browser connection has no
workflow run, so it has nowhere to run the first and a follow-up on it never
starts. The mint says which one, in protocol — follow it rather than working
it out from the workflow.
protocol | What the browser does |
|---|---|
offer | Sends one SDP offer with the token. Unchanged, and what most agents use. |
call_request | Creates the call with Create Web Call Request, polls it, and starts it when it is ready. |
What connection contains
The mint also returns a connection block so your frontend hardcodes nothing:
host, base_url and the three data-plane URLs the browser calls
(web_call_url, call_requests_url, turn_credentials_url), plus api_key.
host is the origin those four URLs live on, named rather than left to be
parsed out of them, so you can pin it, proxy it or allow it through a content
policy deliberately. It is https://api.goyappr.com, the same host as the API
and as a call’s recording_url:
"connection": {
"host": "https://api.goyappr.com",
"base_url": "https://api.goyappr.com",
"web_call_url": "https://api.goyappr.com/web-call",
"call_requests_url": "https://api.goyappr.com/web-call/call-requests",
"turn_credentials_url": "https://api.goyappr.com/turn-credentials",
"api_key": "sb_publishable_…"
}
token (or a call request’s
capability), never your secret key, so the browser calls them directly. Read
host and the three URLs from this block rather than assembling them from the
API base: they are where the browser connects, and they can move without your
code changing.
api_key is a publishable key, the same class as a Stripe publishable key.
It identifies the data plane, grants nothing on its own, and belongs in the
browser. It is never a secret or service-role key: if this deployment’s data-plane key
is a secret-class one, the mint refuses with 503 WEB_CALL_UNAVAILABLE
rather than hand it over — no session is minted and no token is spent. A
deployment with no data-plane key at all is the other case, and it is not a
refusal: the session is minted and api_key comes back null, so the browser
has no key to present unless you give the SDK one yourself. The real per-call
credential is token, which is single-use and short-lived — that is the value
to keep out of logs and out of your page source.
Pass protocol through to @goyappr/client and the SDK follows it. An older
client that ignores it and sends a one-shot offer anyway is refused with
409 workflow_preparation_required — and the refusal costs nothing: the
token is not spent, no line is taken and no call record is created, so the same
token can then create the request instead. A call_request token lives 15
minutes — expires_at says so — against the five an offer token gets,
because it has to outlast the steps it is waiting for.
Retrying safely
Send anIdempotency-Key header (1–200 visible ASCII characters, ! through ~ — a space is rejected). An identical retry returns the original acceptance instead of placing a second call. Reusing the key with different call details is 409 WORKFLOW_IDEMPOTENCY_CONFLICT. “Different” means what you sent — to, from, an explicit agent_id, variables, metadata, workflow_revision_id. Anything the platform works out for you, such as which agent a split picked, is carried over from the accepted request and never counts as a change.
A 503 WORKFLOW_ADMISSION_UNAVAILABLE means no call was placed — retry the same request with the same key. The one cause that a retry will not clear is a pinned version with no usable build behind it: if the same workflow_revision_id fails every time while an unpinned call goes through, pin a different version or drop the pin. Every other code this endpoint can return is on the Error Codes page.Authorizations
Your Yappr API key (e.g. ypr_live_...). Generate one in the dashboard under Settings → API Keys. No key is 401 MISSING_KEY; a key that is not one of ours, or is revoked, is 401 INVALID_KEY; an expired one is 401 EXPIRED_KEY. A valid key without the scope an operation needs is 403 INSUFFICIENT_SCOPE on every operation, and the message names the scope. Every response, a 401 included, carries X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset: the budget is 60 requests a minute per API key. Every 429, whatever its code, carries Retry-After (whole seconds, never zero): the per-key budget's RATE_LIMIT asks for what is left of the minute, a route's daily cap (RATE_LIMITED) for the time until that cap resets. All four headers are listed in Access-Control-Expose-Headers, so a browser can read them. A path the API does not serve (an unknown sub-path, an id left empty) is 404 ROUTE_NOT_FOUND, and a method a served path does not take is 405 METHOD_NOT_ALLOWED with an Allow header; both are answered before any scope check, and nothing is read or changed. A trailing slash is ignored where it cannot be an id left empty (POST /calls/ is POST /calls) and refused where it can (GET /calls/). A doubled slash inside a path is merged into one before the request reaches the API (GET //calls is GET /calls).
Body
Call channel. Omit or "phone" places a normal outbound phone call (requires to and from).
"web" mints a short-lived, single-use browser session token instead of dialing — no call is
placed until the visitor's browser connects via the @goyappr/client SDK. For "web", only
agent_id is used (to/from are ignored) and the 201 response is a session object.
phone, web Optional for a phone call, required for type: "web".
Omit it and the from number decides: its outbound agent
places the call, or its outbound_split picks between two
agents. An explicit agent_id always wins over a split. If
the number has no agent attached, the call is refused with
422 AGENT_NOT_RESOLVED — "Attach an agent to this phone
number or send agent_id" — and nothing is queued or dialed.
When a split resolves the agent, the call record carries
metadata.ab_variant ("a" or "b"); retrying with the
same Idempotency-Key resolves to the same agent.
Destination phone number in strict E.164 format.
Validation rules (enforced at API and DB layers):
- Must match
^\+[1-9][0-9]{7,14}$— leading+, 8–15 digits, no spaces or dashes. - Israeli numbers (
+972…) must be exactly 12 or 13 characters total (+972followed by an 8-digit landline or 9-digit mobile). - Calls can only be placed to Israeli numbers (
+972); any other country is refused. - Must differ from
from.
Malformed numbers are rejected with 400 invalid_destination — no row is written to the database, no carrier dial is attempted, and no capacity is consumed.
"+972501234567"
An active number in your workspace, in strict E.164 format: bought from Yappr, or registered from your own Telnyx account on a carrier account — then the call runs on your Telnyx account, which bills you for its phone minutes — or the phone_system number of an extension endpoint with outbound calls on, when the call goes out through your own phone system on your phone plan. Same validation rules as to. Malformed numbers are rejected with 400 INVALID_FROM_NUMBER.
"+972551234567"
Arbitrary key-value data attached to the call log record. Forwarded in real-time to every tool webhook as call_metadata so tool receivers (Make.com scenarios, n8n workflows, custom edge functions) can route updates back to the right CRM record without a secondary GET /calls/{id} fetch. Ideal for carrying IDs like appointment_id, contact_id, calendar_id. Not injected into the agent's system prompt.
Flow agents — contract callout. Flow agents can reference {{metadata.<key>}} tokens inside args_template values. Missing keys render to an empty string at runtime with no save-time or dispatch-time warning, so always check the agent's flow_config.metadata.custom_metadata_keys before placing the call and ensure every key in that array is supplied here.
Reserved keys. The five platform-supplied tokens (id, direction, agent_number, user_number, agent_name) are emitted by the platform at call start and cannot be overridden — using any of them as a key here is a 400 INVALID_METADATA_RESERVED_KEY. Pick a different name for your custom field. recording_started_at and recording_ended_at are written by Yappr from the call's recording; a value sent under either name is dropped.
{
"appointment_id": "ghl-apt-abc123",
"calendar_id": "ghl-cal-xyz789",
"contact_id": "ghl-contact-def456"
}
Web sessions only (type: web). Attaches the call to one of this workspace's leads:
the call carries that lead, and what the post-call pass learns is written to it.
Not an id is 400; not a lead in this workspace, or a deleted one, is 404. An
agent whose workflow runs before-call steps (protocol: "call_request") cannot
take one: its call is created by the call request, which has no lead, so the mint
is 422 WEB_LEAD_UNSUPPORTED and no token is issued.
Workflow agents only. Places this call on one exact published version of the agent instead of whichever version is current when the call goes out. Use it when a batch must stay on the version you tested.
Omit it (or send null) to use the agent's current published version.
Sending a value for an agent that is not a workflow agent is a
422 WORKFLOW_PIN_INVALID. A version id that this agent does not own is
rejected later, as 404 WORKFLOW_AGENT_UNAVAILABLE — the same answer as an
agent that is not reachable — so take the id from the data[].id of
GET /agents/{id}/workflow/versions instead of guessing it.
Response
Call blocked because the destination is on the company's Do-Not-Call list.
A call_logs row is recorded with status: "dnc_blocked" (so analytics +
webhooks pick it up), but no carrier leg is established and no minutes
are charged. To allow this number again, remove its DNC entry via
DELETE /do-not-call/{id}.