Subscriptions
Subscriptions
Get current subscription and usage
GET
/subscriptionsReturns the current account subscription tier, usage statistics, and limits
Response
Returns
is_over_limitboolean
{
"subscription": {
"id": "string",
"account_id": "string",
"tier": "free",
"spending_limit_cents": 0,
"is_internal": true,
"created_at": "string",
"updated_at": "string"
},
"usage": {
"documents_count": 0,
"entities_active": 0,
"period_start": "string",
"period_end": "string"
},
"limits": {
"entities": 0,
"documents_per_month": 0
},
"is_over_limit": true
}Check if account can create new entity
GET
/subscriptions/check-entity-limitReturns whether the account can create a new production entity based on subscription tier
Response
Returns
can_createboolean
current_countnumber
limitnumbernullable
{
"can_create": true,
"current_count": 0,
"limit": 0
}Update spending limit
PATCH
/subscriptions/spending-limitUpdate the spending limit for metered tier subscriptions. Only applicable for metered accounts.
Request
Body parameters
spending_limit_centsnumberrequirednullable
import SpaceInvoices from '@spaceinvoices/js-sdk';
const sdk = new SpaceInvoices('YOUR_API_KEY');
const response = await sdk.subscriptions.update({
spending_limit_cents: 0
});
console.log(response);Response
Returns
spending_limit_centsnumbernullable
{
"spending_limit_cents": 0
}