curl --request PATCH \
--url https://api.goyappr.com/billing \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"monthly_budget_cents": 5000
}
'import requests
url = "https://api.goyappr.com/billing"
payload = { "monthly_budget_cents": 5000 }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({monthly_budget_cents: 5000})
};
fetch('https://api.goyappr.com/billing', 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/billing",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'monthly_budget_cents' => 5000
]),
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/billing"
payload := strings.NewReader("{\n \"monthly_budget_cents\": 5000\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.goyappr.com/billing")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"monthly_budget_cents\": 5000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.goyappr.com/billing")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"monthly_budget_cents\": 5000\n}"
response = http.request(request)
puts response.read_body{
"monthly_budget_cents": 123,
"monthly_spend_cents": 123,
"monthly_budget_remaining_cents": 123,
"monthly_budget_reached": true,
"monthly_period_start": "2023-11-07T05:31:56Z"
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}Set Spending Limit
Sets, changes or removes the workspace’s own monthly spending limit — the one
writable field on the billing status. Required scope billing:manage.
Send monthly_budget_cents as a whole number of cents to limit this calendar
month’s spending to, or null to turn the limit off. 0 is a valid limit and
stops outbound calling immediately.
While the limit is reached, POST /calls answers 402 SPEND_BUDGET_REACHED and
queued outbound calls — campaigns included — are failed with the same sentence.
Three things keep working and are not exemptions that were forgotten: calls coming
in, browser rehearsals (POST /calls {"type":"web"}, which is what the dashboard’s
Test Call places) and the calls a shared link places. The limit lifts by itself at
the start of the next calendar month.
Balances, suspension and the auto top-up settings are not writable here: money moves through POST /billing/topup and the Stripe Checkout it returns.
curl --request PATCH \
--url https://api.goyappr.com/billing \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"monthly_budget_cents": 5000
}
'import requests
url = "https://api.goyappr.com/billing"
payload = { "monthly_budget_cents": 5000 }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({monthly_budget_cents: 5000})
};
fetch('https://api.goyappr.com/billing', 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/billing",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'monthly_budget_cents' => 5000
]),
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/billing"
payload := strings.NewReader("{\n \"monthly_budget_cents\": 5000\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.goyappr.com/billing")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"monthly_budget_cents\": 5000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.goyappr.com/billing")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"monthly_budget_cents\": 5000\n}"
response = http.request(request)
puts response.read_body{
"monthly_budget_cents": 123,
"monthly_spend_cents": 123,
"monthly_budget_remaining_cents": 123,
"monthly_budget_reached": true,
"monthly_period_start": "2023-11-07T05:31:56Z"
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}billing:manage. A key without that scope is 403 INSUFFICIENT_SCOPE.
A workspace can say what it is willing to spend in a calendar month. Until it
does, there is no limit — this is opt-in, and every workspace starts with it
off.
Setting it
curl -X PATCH https://api.goyappr.com/v1/billing \
-H "Authorization: Bearer $YAPPR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"monthly_budget_cents": 5000}'
{
"monthly_budget_cents": 5000,
"monthly_spend_cents": 1240,
"monthly_budget_remaining_cents": 3760,
"monthly_budget_reached": false,
"monthly_period_start": "2026-09-01T00:00:00.000Z"
}
| Value | What it means |
|---|---|
| A whole number of cents | Limit this month’s spending to that. 5000 is $50.00. The largest limit the field holds is 2147483647. |
0 | Place nothing this month. A real setting, not an error — it is how you prove the limit works without spending anything. |
null | No limit. This is the default. |
monthly_budget_cents is the workspace’s calendar-month limit: it covers
every outbound call in the workspace, campaigns included, and lifts by itself
on the first of the next month. A campaign’s own budget_cents (see
POST /campaigns) is a different number — a
lifetime budget for that one campaign, spent down once and never reset.
Either can pause a campaign, and both show it as paused_budget; the campaign’s
pause_reason says which — workspace_spend_limit for this limit,
campaign_budget for the campaign’s own.2147483647, a missing field — is 400 SPEND_BUDGET_INVALID, and the limit you
already had is untouched.
What the limit does
Spending is every charge completed since the first of the month, UTC: calls, phone-number rent, evaluation runs. A top-up is not spending, and neither is a refund. One window, everywhere.monthly_period_start on this response is the instant
the sum starts from, and it is the same instant the dashboard’s Spent this
month tile, the Billing card and the pause banner measure — the calendar
month from the 1st at 00:00 UTC, whatever the workspace’s own timezone is. A
Call Logs total or a GET /billing/consumption range is a different window
of the same money and will not match unless you ask for the same days.
Once the month’s charges reach the limit — reach, not pass; spending exactly
$50.00 of a $50.00 limit is enough — outbound phone calls stop. What that
covers, exactly:
| Paused while the limit is reached | Keeps working |
|---|---|
POST /calls — answers 402 SPEND_BUDGET_REACHED | Calls coming in |
Queued and campaign calls — failed with the same sentence on the call record rather than held, and the campaign is paused as paused_budget: a money stop, not a fault, so nothing is re-dialled | Browser rehearsals — POST /calls with "type": "web", which is what the dashboard’s Test Call places |
| A workflow agent’s call, and a call request already accepted and waiting for its call window | The calls a shared link places, which mint the same browser session |
null and the next call goes out
immediately.
Reading where you stand
GET /billing carries the same five fields
on every read, so a client that is about to place calls can check the limit and
the balance in one request. For what the month was actually spent on, day by
day or per agent, use
Billing consumption.
What this route is not
It changes the limit and nothing else. Balances, suspension and the auto top-up settings are not writable here: money is added throughPOST /billing/topup and the hosted Checkout it
returns. Auto top-up and this limit are opposite controls and work together
without contradiction — auto top-up keeps the balance able to pay for calls,
this says how many of them you want paid for. The limit is decided first: a
call refused for the limit never triggers a top-up, so the safeguard can never
charge your card on the way to saying no.
The workspace owner is emailed once per calendar month, the first time the
limit actually refuses a call. Every refusal after that is silent: one stopped
campaign must not become a hundred messages. The dashboard also carries a
banner on every page while the limit is reached, and the refusal on the call
names the limit and the month’s spend, so an integration never has to guess.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).