Skip to Content

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
/v1/namespaces/{id}/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. 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.

Authorization

apiKey
headerx-api-key<token>

Path Parameters

id*string
Match^ns_[0-9a-hjkmnp-tv-z]{16,24}$

Query Parameters

after?string
before?string

Response Body

NamespaceUsage

application/json
  1. response
namespaceId*NamespaceId
Match^ns_[0-9a-hjkmnp-tv-z]{16,24}$
periodStart*string
periodEnd*string
emailCount*number
smsCount*number
whatsappCount*number
totalMessages*number
Example Request
import { 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
}

Related documentation