curl --request GET \
--url https://api.wave.sa/v1/usage \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.wave.sa/v1/usage"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.wave.sa/v1/usage', 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.wave.sa/v1/usage",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
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.wave.sa/v1/usage"
req, _ := http.NewRequest("GET", 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.get("https://api.wave.sa/v1/usage")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.wave.sa/v1/usage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"total_calls": 120,
"calls_answered": 84,
"calls_missed": 21,
"total_minutes": 312.5,
"credits": 412.5
},
"period": {
"from": "2023-11-07T05:31:56Z",
"to": "2023-11-07T05:31:56Z"
},
"groups": [
{
"key": "2026-09-01T00:00:00+03:00",
"total_calls": 120,
"calls_answered": 84,
"calls_missed": 21,
"total_minutes": 312.5,
"credits": 412.5
}
]
}{
"error_code": "INVALID_API_KEY",
"message": "<string>",
"message_ar": "<string>",
"request_id": "<string>",
"docs_url": "<string>"
}{
"error_code": "INVALID_API_KEY",
"message": "<string>",
"message_ar": "<string>",
"request_id": "<string>",
"docs_url": "<string>"
}{
"error_code": "INVALID_API_KEY",
"message": "<string>",
"message_ar": "<string>",
"request_id": "<string>",
"docs_url": "<string>"
}Get usage
Returns the usage of one project for a period: total calls, answered calls, missed calls, call minutes, and the credits charged. Requires the usage:read scope.
Counts. total_calls counts every call that matches the filters. calls_answered counts calls that connected (a finished answered call is still an answered call). calls_missed counts calls nobody picked up. Failed, cancelled and timed-out calls count only in total_calls, so answered plus missed can be lower than the total.
Period. from and to are inclusive and filter on the time the call was created. With neither, the period is all time and period shows null. from must not be later than to.
Queue. queue_id matches calls that carry a queue id. Only callback calls carry one; web-calling and inbound calls never match.
Credits. credits is the sum of the credits Wave charged on the calls, exact to 4 decimals (the portal rounds up to whole credits). Each production call is charged at its call class on the rate card; sandbox calls, beta calls and calls that nobody answered are not charged and add 0. See Billing.
Grouping. Add group_by to also get a groups list with the same metrics per group. day and hour use the Saudi calendar (Asia/Riyadh, UTC+03:00): each key is the start of the day or hour with a +03:00 offset, oldest first, and a day or hour with no calls is not listed. They need both from and to; the range can be at most 31 days for hour and 366 days for day. status groups by the raw call status and needs no range. queue lists the queues that have calls in the period (one group per queue id; calls without a queue are not listed) and needs no range; use it to fill a queue picker. api_key gives one group per API key (the key is the key id); calls that no key placed, such as inbound calls, are not a group, and it needs no range. The totals in data always cover the whole period.
Environments. A sandbox key gets the usage of sandbox calls only, and a production key of production calls only. Send environment with a key only as the key’s own value.
curl --request GET \
--url https://api.wave.sa/v1/usage \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.wave.sa/v1/usage"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.wave.sa/v1/usage', 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.wave.sa/v1/usage",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
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.wave.sa/v1/usage"
req, _ := http.NewRequest("GET", 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.get("https://api.wave.sa/v1/usage")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.wave.sa/v1/usage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"total_calls": 120,
"calls_answered": 84,
"calls_missed": 21,
"total_minutes": 312.5,
"credits": 412.5
},
"period": {
"from": "2023-11-07T05:31:56Z",
"to": "2023-11-07T05:31:56Z"
},
"groups": [
{
"key": "2026-09-01T00:00:00+03:00",
"total_calls": 120,
"calls_answered": 84,
"calls_missed": 21,
"total_minutes": 312.5,
"credits": 412.5
}
]
}{
"error_code": "INVALID_API_KEY",
"message": "<string>",
"message_ar": "<string>",
"request_id": "<string>",
"docs_url": "<string>"
}{
"error_code": "INVALID_API_KEY",
"message": "<string>",
"message_ar": "<string>",
"request_id": "<string>",
"docs_url": "<string>"
}{
"error_code": "INVALID_API_KEY",
"message": "<string>",
"message_ar": "<string>",
"request_id": "<string>",
"docs_url": "<string>"
}
