Skip to content
einvoicing.dev

API/Billing

Manage a subscription

POST/v1/billing/portal-sessions· API key

Returns a link to Stripe's hosted customer portal, where the plan can be changed or cancelled, the payment method updated and invoices downloaded. There is no billing screen of our own, and this link is the whole of billing management.

Request
curl -X POST https://api.einvoicing.dev/v1/billing/portal-sessions \  -H "Authorization: Bearer $EINVOICING_API_KEY"

Response

201

A portal session was created.

FieldTypeDescription
datarequiredBillingSessionA link to a Stripe-hosted billing page.
Example responseapplication/json
{  "data": {    "url": "https://billing.stripe.com/p/session/bps_a1B2c3D4",    "expires_at": null  }}

Errors

Every error is application/problem+json (RFC 9457). Branch on type, which is stable, never on title or detail.

StatusWhen
401

No key, or a key that is unknown or revoked. Problem type is unauthenticated.

/problems/unauthenticated

403

A test key cannot manage keys or billing. Use a live key. Problem type is live-key-required.

409

The account is on the Free plan and has nothing to manage. Start one with a checkout session. Problem type is no-subscription.

/problems/no-subscription

429

Too many requests in a short window. Slow down and retry after the number of seconds in Retry-After. Problem type is rate-limited.

/problems/rate-limited

Schemas

BillingSession

A link to a Stripe-hosted billing page.

FieldTypeDescription
urlrequiredstring · uriOpen this in a browser.
expires_atrequiredstring or null · date-timeWhen the link stops working, if Stripe says.