Skip to content

Reference

API: Credits

Markdown version

MethodPathWhat it doesScope
GET/v1/creditsThe credit balance, today's top-up limit, auto top-up and agent top-up settings, and the free-model daily allowancebilling:read
POST/v1/credits/checkoutAdd credits (owners): returns a secure payment page to open. Credits arrive when the payment is confirmed; a bank transfer takes a few days (web app only)billing:write
PUT/v1/credits/controlsOwners, in the web app: auto top-up (off by default; a balance to top up at, an amount and a monthly limit), agent top-ups (off by default, with a monthly limit), the low-balance notice amount, or forget the saved card (web app only)billing:write
POST/v1/credits/invoiceOwners, in the web app: add credits on an invoice (accounts with payment terms). The invoice is emailed, with your purchase order number and tax IDs; the credits arrive when it's issued (web app only)billing:write
GET/v1/credits/invoicingWhether this account can add credits on an invoice: its payment terms (net days), its limit on unpaid invoices, what's owed now and whether any invoice is past duebilling:read
GET/v1/credits/quoteWhat a top-up costs: the credits, the fee (4.5% by card with an 80-cent minimum, 1% by bank transfer) and the total charged (no sign-in)—
GET/v1/credits/tax-idsThe tax IDs printed on this account's invoices and receiptsbilling:read
POST/v1/credits/tax-idsOwners, in the web app: add a tax ID to print on invoices (a VAT number, an EIN and the like) (web app only)billing:write
DELETE/v1/credits/tax-ids/:idOwners, in the web app: remove a tax ID from future invoices (web app only)billing:write
GET/v1/credits/topupsTop-ups, newest first: credits, fee, total, status and the receipt linkbilling:read
POST/v1/credits/topupsFor agents: add credits by charging the organization's saved card, within the monthly limit an owner set for agent top-ups. Refused when agent top-ups are off, over the limit, or no card is savedbilling:topup
GET/v1/credits/topups/:idOne top-up: its status, credits, fee, total and receipt linkbilling:read

Examples

GET /v1/credits

The credit balance, today's top-up limit, auto top-up and agent top-up settings, and the free-model daily allowance

curl -s "https://manage.restolayer.com/v1/credits" \
  -H "Authorization: Bearer $LG_API_KEY"
const res = await fetch(`https://manage.restolayer.com/v1/credits`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.LG_API_KEY}` },
});
const data = await res.json();

GET /v1/credits/invoicing

Whether this account can add credits on an invoice: its payment terms (net days), its limit on unpaid invoices, what's owed now and whether any invoice is past due

curl -s "https://manage.restolayer.com/v1/credits/invoicing" \
  -H "Authorization: Bearer $LG_API_KEY"
const res = await fetch(`https://manage.restolayer.com/v1/credits/invoicing`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.LG_API_KEY}` },
});
const data = await res.json();

GET /v1/credits/quote

What a top-up costs: the credits, the fee (4.5% by card with an 80-cent minimum, 1% by bank transfer) and the total charged. No sign-in, so it sends no key.

curl -s "https://manage.restolayer.com/v1/credits/quote"
const res = await fetch(`https://manage.restolayer.com/v1/credits/quote`, {
  method: "GET",
});
const data = await res.json();

GET /v1/credits/tax-ids

The tax IDs printed on this account's invoices and receipts

curl -s "https://manage.restolayer.com/v1/credits/tax-ids" \
  -H "Authorization: Bearer $LG_API_KEY"
const res = await fetch(`https://manage.restolayer.com/v1/credits/tax-ids`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.LG_API_KEY}` },
});
const data = await res.json();

GET /v1/credits/topups

Top-ups, newest first: credits, fee, total, status and the receipt link

curl -s "https://manage.restolayer.com/v1/credits/topups" \
  -H "Authorization: Bearer $LG_API_KEY"
const res = await fetch(`https://manage.restolayer.com/v1/credits/topups`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.LG_API_KEY}` },
});
const data = await res.json();

POST /v1/credits/topups

For agents: add credits by charging the organization's saved card, within the monthly limit an owner set for agent top-ups. Refused when agent top-ups are off, over the limit, or no card is saved

curl -s -X POST "https://manage.restolayer.com/v1/credits/topups" \
  -H "Authorization: Bearer $LG_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
const res = await fetch(`https://manage.restolayer.com/v1/credits/topups`, {
  method: "POST",
  headers: { authorization: `Bearer ${process.env.LG_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();

GET /v1/credits/topups/$ID

One top-up: its status, credits, fee, total and receipt link

curl -s "https://manage.restolayer.com/v1/credits/topups/$ID" \
  -H "Authorization: Bearer $LG_API_KEY"
const res = await fetch(`https://manage.restolayer.com/v1/credits/topups/${id}`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.LG_API_KEY}` },
});
const data = await res.json();

Request and response schemas: https://www.restolayer.com/openapi.json. All resources: API reference.

Send feedback

Tell us what's broken, confusing or missing on this page, or an idea. It goes to the team that builds the product.
Please don't include passwords or card numbers.
Only to reply about this. Never added to any mailing list.