curl --request POST \
--url https://api.goyappr.com/phone-numbers/{id}/keep \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.goyappr.com/phone-numbers/{id}/keep"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.goyappr.com/phone-numbers/{id}/keep', 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/phone-numbers/{id}/keep",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.goyappr.com/phone-numbers/{id}/keep"
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(string(body))
}HttpResponse<String> response = Unirest.post("https://api.goyappr.com/phone-numbers/{id}/keep")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.goyappr.com/phone-numbers/{id}/keep")
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{
"phone_number_id": "c0ffee00-0000-4000-8000-000000000001",
"released": false,
"release_at": null
}{
"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>"
}
]
}Keep Number
Undo a scheduled release: the number renews as before, and scheduled_release_at is
null again. Requires phone_numbers:purchase. Keeping a number that is not scheduled to
be released, but still has its subscription, answers the same and changes nothing. A
number already released cannot be kept: buy a new one. It takes no body and no query
parameters.
curl --request POST \
--url https://api.goyappr.com/phone-numbers/{id}/keep \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.goyappr.com/phone-numbers/{id}/keep"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.goyappr.com/phone-numbers/{id}/keep', 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/phone-numbers/{id}/keep",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.goyappr.com/phone-numbers/{id}/keep"
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(string(body))
}HttpResponse<String> response = Unirest.post("https://api.goyappr.com/phone-numbers/{id}/keep")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.goyappr.com/phone-numbers/{id}/keep")
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{
"phone_number_id": "c0ffee00-0000-4000-8000-000000000001",
"released": false,
"release_at": null
}{
"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>"
}
]
}phone_numbers:purchase. In the dashboard, the same undo is Keep this number
on a number that shows “Releases on”.
curl -X POST "$YAPPR_API_URL/phone-numbers/c0ffee00-0000-4000-8000-000000000001/keep" \
--header "Authorization: Bearer $YAPPR_API_KEY"
400 PHONE_NUMBER_REQUEST_INVALID, and nothing is changed.
A released number is kept until the end of the period already paid for
(scheduled_release_at on GET /phone-numbers),
so keep works until that moment. Afterwards the number is gone and cannot be
kept: buy a new one. Keeping a number whose release is not scheduled, while its
subscription runs, answers the same and changes nothing.
Response
{
"phone_number_id": "c0ffee00-0000-4000-8000-000000000001",
"released": false,
"release_at": null
}
released is false and release_at is null, as the number’s
scheduled_release_at now is. Its next_renewal_at is back too.
Errors
| HTTP | Code | When |
|---|---|---|
400 | PHONE_NUMBER_REQUEST_INVALID | A body field or query parameter was sent. It takes neither; issues[] names each one. Nothing was changed. |
403 | INSUFFICIENT_SCOPE | The key does not hold phone_numbers:purchase. |
403 | API_KEY_AGENT_SCOPED | The key is limited to some agents. Numbers belong to the whole workspace. |
404 | NOT_FOUND | No such number in this workspace, or it was released already. |
404 | RESOURCE_ID_INVALID | The id in the path is not an id. |
409 | RELEASE_NOT_SCHEDULED | The number has no subscription to keep: a number from your own carrier, one that calls out through your phone system, or one Yappr set up for you. Nothing was changed. |
409 | SUBSCRIPTION_ENDED | The number’s subscription has already ended, so it can no longer be kept. Buy a new number. |
503 | BILLING_UNAVAILABLE | Billing could not be reached. Nothing was changed. 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).
Response
Kept. released is false and release_at null.