curl --request POST \
--url https://api.goyappr.com/agents/{id}/test-call \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"to": "+972501234567",
"variables": {
"FirstName": "Dana"
}
}
'import requests
url = "https://api.goyappr.com/agents/{id}/test-call"
payload = {
"to": "+972501234567",
"variables": { "FirstName": "Dana" }
}
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({to: '+972501234567', variables: {FirstName: 'Dana'}})
};
fetch('https://api.goyappr.com/agents/{id}/test-call', 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/agents/{id}/test-call",
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([
'to' => '+972501234567',
'variables' => [
'FirstName' => 'Dana'
]
]),
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/agents/{id}/test-call"
payload := strings.NewReader("{\n \"to\": \"+972501234567\",\n \"variables\": {\n \"FirstName\": \"Dana\"\n }\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/agents/{id}/test-call")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"to\": \"+972501234567\",\n \"variables\": {\n \"FirstName\": \"Dana\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.goyappr.com/agents/{id}/test-call")
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 \"to\": \"+972501234567\",\n \"variables\": {\n \"FirstName\": \"Dana\"\n }\n}"
response = http.request(request)
puts response.read_body{
"status": "<string>",
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"to": "<string>",
"from": "<string>",
"caller_line": "workspace",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"call_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"status": "<string>",
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"to": "<string>",
"from": "<string>",
"caller_line": "workspace",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"call_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"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>"
}
]
}Test an Agent by Phone
Requires calls:create. Rings the phone number in to with this agent, so you hear it the way a caller will. The call comes from the workspace’s own number when it has one, and from a Yappr test line when it has none, so a workspace without a number can still test on a real phone. The Yappr test line places calls only; it never answers one. A key limited to agents calls only from a number one of its agents answers or calls from, as on POST /calls; with none, the Yappr test line calls. GET on this path says which line it will be.
A test call is an ordinary outbound phone call for the workspace: billed per minute at the phone rate of the agent’s model, from the workspace’s credit, whichever line it comes from, and recorded with source “test” on GET /calls. It is checked like any other outbound call (a diallable number, the Do-Not-Call list, the outbound call window, the monthly spending limit and the credit floor, and capacity), with no limit of its own on how many you place. Two answers differ from POST /calls because someone is waiting on the phone: outside the call window, and when every line is busy, the test is refused rather than scheduled or queued.
For an agent that does not run a workflow the call is created at once (201, with its id). A workflow agent’s call is a phone call request (202, with request_id and call_id null) that the workflow prepares and dials within seconds; follow it with GET /call-requests/ until call_id is set, then GET /calls/.
curl --request POST \
--url https://api.goyappr.com/agents/{id}/test-call \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"to": "+972501234567",
"variables": {
"FirstName": "Dana"
}
}
'import requests
url = "https://api.goyappr.com/agents/{id}/test-call"
payload = {
"to": "+972501234567",
"variables": { "FirstName": "Dana" }
}
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({to: '+972501234567', variables: {FirstName: 'Dana'}})
};
fetch('https://api.goyappr.com/agents/{id}/test-call', 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/agents/{id}/test-call",
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([
'to' => '+972501234567',
'variables' => [
'FirstName' => 'Dana'
]
]),
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/agents/{id}/test-call"
payload := strings.NewReader("{\n \"to\": \"+972501234567\",\n \"variables\": {\n \"FirstName\": \"Dana\"\n }\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/agents/{id}/test-call")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"to\": \"+972501234567\",\n \"variables\": {\n \"FirstName\": \"Dana\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.goyappr.com/agents/{id}/test-call")
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 \"to\": \"+972501234567\",\n \"variables\": {\n \"FirstName\": \"Dana\"\n }\n}"
response = http.request(request)
puts response.read_body{
"status": "<string>",
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"to": "<string>",
"from": "<string>",
"caller_line": "workspace",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"call_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"status": "<string>",
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"to": "<string>",
"from": "<string>",
"caller_line": "workspace",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"call_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"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>"
}
]
}calls:create, to hear it the way a caller will. You send
only the number to ring; Yappr picks the number that calls:
- Your workspace’s own number, when it has one: a number the agent calls from first (including as the other half of an outbound split), then the from-number of a campaign it runs, then a number it answers on, then any other active number in the workspace. At each step a Yappr-hosted number comes before one on your own Telnyx account.
- A Yappr test line, when the workspace has no number yet. It places calls only and never answers one, so nobody can call your agent through it.
POST /calls: any other number is
another client’s caller ID. With none, the Yappr test line calls.
GET /agents/{id}/test-call tells you which one it will
be, without placing anything.
curl --request POST "$YAPPR_API_URL/agents/$AGENT_ID/test-call" \
--header "Authorization: Bearer $YAPPR_API_KEY" \
--header "Content-Type: application/json" \
--data '{"to": "+972501234567", "variables": {"FirstName": "Dana"}}'
| Field | Test call |
|---|---|
to | Required. The phone to ring, in E.164 format (+972501234567). There is no from: the number that calls is chosen for you. |
variables | Optional. Values for the agent’s template variables, as on POST /calls. |
What it costs
A test call is an ordinary outbound phone call for your workspace. It is billed per minute at the phone rate of the agent’s model, from your credit, whichever line it comes from. It appears in your call logs and onGET /calls with source: "test".
What is checked
The same things every outbound call is checked for: a number that can be dialled, your Do-Not-Call list, your outbound call window, your monthly spending limit and the $1.00 credit floor, and capacity. There is no limit on how many test calls you place. Two answers differ fromPOST /calls, because someone is waiting on the phone: outside
your call window the test is refused (422 OUTSIDE_CALL_WINDOW) instead of being scheduled for the
next opening, and when every line is busy it is refused (503 AT_CAPACITY) instead of being queued.
The answer
For an agent that does not run a workflow the call is placed at once:{
"id": "6f1c2d0e-4b8a-4e7f-9c3d-2a1b0c9d8e7f",
"call_id": "6f1c2d0e-4b8a-4e7f-9c3d-2a1b0c9d8e7f",
"request_id": null,
"status": "ringing",
"agent_id": "a1b2c3d4-0000-4000-8000-000000000001",
"to": "+972501234567",
"from": "+972555000111",
"caller_line": "workspace"
}
202 with request_id set and call_id
null. The workflow prepares and dials it within seconds: poll
GET /call-requests/{id} until call_id is set, then read the call
with GET /calls/{id}. Send an Idempotency-Key header to make a retry
return the same request instead of ringing again.
caller_line is workspace when one of your numbers called and yappr when a Yappr test line did.
Errors
| Status | Code | Meaning |
|---|---|---|
| 400 | invalid_destination | to cannot be dialled. Calls can only be placed to Israeli numbers: +972 followed by 8 or 9 digits. |
| 400 | SELF_CALL_NOT_ALLOWED | to is the number the test calls from. |
| 400 | TEST_CALL_INVALID | The body carried a field other than to and variables. |
| 402 | BILLING_ERROR, SPEND_BUDGET_REACHED | The workspace cannot pay for a call now, or its monthly limit is reached. |
| 404 | AGENT_NOT_FOUND | No agent with this id in this workspace. |
| 409 | AGENT_INACTIVE, WORKFLOW_UNPUBLISHED | Switch the agent on, or publish its workflow. |
| 422 | NO_CALLER_NUMBER | No number to call from: add a phone number, or test in the browser. |
| 422 | DESTINATION_ON_DNC | to is on your Do-Not-Call list. |
| 422 | OUTSIDE_CALL_WINDOW | Outside your outbound call window. |
| 422 | DESTINATION_OUTSIDE_PHONE_SYSTEM_COUNTRY | The number that would call goes out through your phone system in national dial format, which reaches Israeli numbers only, and to is outside Israel. |
| 503 | AT_CAPACITY | Every line is busy. Try again in a minute. |
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).
Headers
Body
Response
The call was placed (an agent that does not run a workflow).