WhatsApp Funding
Get portfolio usage
Returns charges recorded for this project across the portfolio’s accounts, broken down by usage kind. Other partners’ activity on the same portfolio is not included.
GET
/
whatsapp
/
portfolios
/
{portfolio_id}
/
usage
Get portfolio usage
curl --request GET \
--url https://api.kapso.ai/platform/v1/whatsapp/portfolios/{portfolio_id}/usage \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.kapso.ai/platform/v1/whatsapp/portfolios/{portfolio_id}/usage"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.kapso.ai/platform/v1/whatsapp/portfolios/{portfolio_id}/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.kapso.ai/platform/v1/whatsapp/portfolios/{portfolio_id}/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 => [
"X-API-Key: <api-key>"
],
]);
$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.kapso.ai/platform/v1/whatsapp/portfolios/{portfolio_id}/usage"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
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.kapso.ai/platform/v1/whatsapp/portfolios/{portfolio_id}/usage")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.kapso.ai/platform/v1/whatsapp/portfolios/{portfolio_id}/usage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"data": {
"start_time": "2023-11-07T05:31:56Z",
"end_time": "2023-11-07T05:31:56Z",
"time_basis": "recorded_at",
"currency": "USD",
"charge_scope": "kapso_recorded_charges",
"totals": {
"customer_charge_micro_usd": 115000
},
"breakdown": [
{
"usage_kind": "messaging",
"customer_charge_micro_usd": 90000,
"sync": {
"status": "synced",
"last_synced_at": "2023-11-07T05:31:56Z",
"usage_through": "2023-11-07T05:31:56Z"
},
"billable_messages": 1,
"coverage": {
"status": "supported",
"reason": "calling_requires_usd_waba"
}
}
]
}
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Authorizations
Path Parameters
Meta Business Portfolio ID.
Query Parameters
Inclusive start of the window, ISO 8601 with an offset or Z.
Exclusive end of the window. At most 31 days after start_time.
Response
Recorded usage
Show child attributes
Show child attributes
Was this page helpful?
⌘I
Get portfolio usage
curl --request GET \
--url https://api.kapso.ai/platform/v1/whatsapp/portfolios/{portfolio_id}/usage \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.kapso.ai/platform/v1/whatsapp/portfolios/{portfolio_id}/usage"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.kapso.ai/platform/v1/whatsapp/portfolios/{portfolio_id}/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.kapso.ai/platform/v1/whatsapp/portfolios/{portfolio_id}/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 => [
"X-API-Key: <api-key>"
],
]);
$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.kapso.ai/platform/v1/whatsapp/portfolios/{portfolio_id}/usage"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
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.kapso.ai/platform/v1/whatsapp/portfolios/{portfolio_id}/usage")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.kapso.ai/platform/v1/whatsapp/portfolios/{portfolio_id}/usage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"data": {
"start_time": "2023-11-07T05:31:56Z",
"end_time": "2023-11-07T05:31:56Z",
"time_basis": "recorded_at",
"currency": "USD",
"charge_scope": "kapso_recorded_charges",
"totals": {
"customer_charge_micro_usd": 115000
},
"breakdown": [
{
"usage_kind": "messaging",
"customer_charge_micro_usd": 90000,
"sync": {
"status": "synced",
"last_synced_at": "2023-11-07T05:31:56Z",
"usage_through": "2023-11-07T05:31:56Z"
},
"billable_messages": 1,
"coverage": {
"status": "supported",
"reason": "calling_requires_usd_waba"
}
}
]
}
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}
