Get one subscription's period statement
const url = 'https://api.nsin.ir/wallet/period-statement';const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url https://api.nsin.ir/wallet/period-statement \ --header 'Authorization: Bearer <token>'The period statement of one of your subscriptions, named by
subscription_id or domain: the running estimate
(is_estimate: true) while the subscription is active, otherwise its
latest closed statement, or null when it has neither. For a domain,
the subscription in force is used, else the most recent one.
Plans are per domain, so an account has no single billing period:
without subscription_id or domain the answer is
{"statement": null}. List your subscriptions with
GET /subscriptions; closed periods are in
GET /wallet/period-statements.
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Query Parameters
Section titled “Query Parameters ”One of your subscriptions (GET /subscriptions).
A domain name; its subscription in force, else the most recent one you held on it.
Responses
Section titled “ Responses ”The statement, or null.
object
One billing period’s cost. For the period in progress the traffic figures are a running estimate.
object
What the plan cost for this period.
Bytes served from cache in the period.
Bytes fetched through the edge proxy.
Bytes on the direct path.
Legacy two-tier column, on historical periods only.
What the period’s traffic cost.
Price per GB of cached traffic in force for the period.
Price per GB of proxied traffic.
Price per GB of direct traffic.
Legacy two-tier price, on historical periods only.
Per-domain split. Only on an estimate for a running period.
One domain’s traffic in a period estimate.
object
Bytes served from cache.
Bytes fetched through the edge proxy.
Bytes sent directly to the origin path.
Estimated cost of this traffic at current rates.
When the statement was closed.
true for a running period’s estimate; false for a closed period.
This is a statement, not a tax invoice.
Present (true) on an estimate whose traffic figures run up to now.
Example
{ "statement": { "not_a_tax_invoice": true }}Missing, malformed, revoked or expired API key. (A valid key whose
account has been deactivated gets 403 account is inactive instead.)
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
Examples
{ "error": "invalid API key"}No subscription of yours matches subscription_id / domain.
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
Example
{ "error": "read-only API key"}The key exceeded its request budget (300 requests per minute by default).
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
Examples
{ "error": "rate limit exceeded"}