Get namespace usage
Counts the messages the namespace sent and received in the window that count toward usage, by channel, with the same statuses as `GET /v1/organizations/usage`.
GET
Counts the messages the namespace sent and received in the window that count toward usage, by channel, with the same statuses as GET /v1/organizations/usage. A message counts toward the namespace it was sent or received in: that of the sender, mailbox, or key it used. The organization is billed for every namespace; read this to charge your own customer.
apiKeyheader
x-api-key<token>id*stringMatch
^ns_[0-9a-hjkmnp-tv-z]{16,24}$after?stringbefore?stringNamespaceUsage
application/json- response
namespaceId*NamespaceIdMatch
^ns_[0-9a-hjkmnp-tv-z]{16,24}$periodStart*stringperiodEnd*stringemailCount*numbersmsCount*numberwhatsappCount*numbertotalMessages*numberimport { createClient } from "samva";
const samva = createClient({ apiKey: process.env.SAMVA_API_KEY! });
const result = await samva.namespaces.getUsage({
"id": "example"
});Example Response
{
"namespaceId": "string",
"periodStart": "string",
"periodEnd": "string",
"emailCount": 0,
"smsCount": 0,
"whatsappCount": 0,
"totalMessages": 0
}