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": "sub_123abc",
"account_id": "acc_456def",
"tier": "free",
"spending_limit_cents": 5000,
"is_internal": false,
"created_at": "2025-01-01T00:00:00.000Z",
"updated_at": "2025-01-01T00:00:00.000Z"
},
"usage": {
"documents_count": 5,
"e_invoicing_send_count": 0,
"entities_active": 1,
"period_start": "2025-01-01T00:00:00.000Z",
"period_end": "2025-01-31T23:59:59.999Z"
},
"limits": {
"entities": 1,
"documents_per_month": 10
},
"is_over_limit": false
}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": 1,
"limit": 1
}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/sdk';
const sdk = new SpaceInvoices('YOUR_API_KEY');
const response = await sdk.subscriptions.update({
spending_limit_cents: 10000
}, {
entity_id: "YOUR_ENTITY_ID"
});
console.log(response);Response
Returns
spending_limit_centsnumbernullable
{
"spending_limit_cents": 10000
}