Server API
Query customers, installs, orders, subscriptions and licenses, and grant or revoke access from your own backend with a secret key.
The Server API lets a backend you run read billing data and manage access. A plain extension never needs it, because the SDK uses your publishable key. Use it when your server must check a user’s access, validate a license key, or grant access outside of a purchase. To be notified when this data changes, use Webhooks.
Endpoints
| Method | Path | What it does |
|---|---|---|
GET | /v1/customers | List customers, or find one by email. |
GET | /v1/customers/:id | Retrieve a customer with orders, subscriptions, licenses, installs and entitlements. |
GET | /v1/installs/:installId | Retrieve an install and its access as a UserState. |
GET | /v1/orders | List orders, including renewal payments. |
GET | /v1/subscriptions | List subscriptions. |
GET | /v1/licenses/:key/validate | Validate a license key without using a seat. |
POST | /v1/entitlements | Grant access to an email or an install. |
DELETE | /v1/entitlements/:id | Revoke access. |
Base URL: https://api.extensionbill.com. Requests and responses are JSON over HTTPS. The most common use is to verify an extension user from your backend.
Authentication
Send a secret API key in the Authorization header of every request:
curl https://api.extensionbill.com/v1/orders \
-H "Authorization: Bearer sk_test_..."
sk_test_…keys use sandbox data andsk_live_…keys use live data. The environment comes from the key; there is no environment parameter.- Create keys in Developers → API keys, with the dashboard’s Sandbox/Live toggle set to the environment you want. Give each key a name (for example “Production backend”).
- The full secret is shown once, right after creation. ExtensionBill stores only a hash and afterwards shows the first 12 characters and when the key was last used.
- Revoke a key on the same page. Revoked keys stop working immediately (
401 invalid_api_key).
Conventions
Records use string ids and ISO 8601 timestamps. Money is an integer amount in minor units plus an uppercase ISO currency (499 + USD = $4.99; JPY, HUF and TWD have no minor unit). Secrets (install tokens, full license keys) are never returned.
Pagination
List endpoints accept:
| Parameter | Default | Description |
|---|---|---|
page | 1 | 1-based page number. |
limit | 20 | Items per page, maximum 100. |
q | none | Optional search text. |
They return { "items": [], "total": 0, "page": 1, "limit": 20 }. total counts matching records across all pages. Results are sorted newest first.
Errors
Errors use the same JSON shape as every ExtensionBill endpoint:
{
"statusCode": 401,
"code": "invalid_api_key",
"message": "The API key is invalid or has been revoked."
}
Branch on code, not on message. details adds context when present: validation_error lists the invalid fields, rate_limited includes retryAfterSec. Common codes here: invalid_api_key (401), validation_error (400), not_found (404), license_not_found (404), rate_limited (429). Full list and a retry helper: Error codes.
Customers
List customers
GET /v1/customers
| Parameter | Description |
|---|---|
email | Return only the customer with this email (case-insensitive exact match). |
page, limit, q | Pagination and free-text search on email and name. |
curl "https://api.extensionbill.com/v1/customers?email=buyer@example.com" \
-H "Authorization: Bearer sk_live_..."
{
"items": [
{
"id": "6703a7e0c9e4b2d5a1f0c381",
"appId": "66f1c2a9e4b0d3a1c8f7e210",
"env": "live",
"email": "buyer@example.com",
"name": "Sample Buyer",
"paypalPayerId": "QYR5Z8XDVJNXQ",
"country": "GB",
"note": null,
"lastSeenAt": "2026-10-12T09:41:10.220Z",
"createdAt": "2026-08-02T17:15:44.003Z",
"updatedAt": "2026-10-12T09:41:10.221Z"
}
],
"total": 1,
"page": 1,
"limit": 20
}
A customer is created the first time an email completes a checkout, restores purchases, or receives a grant. Emails are unique per environment.
Retrieve a customer
GET /v1/customers/:id
Returns the customer with its orders, subscriptions, licenses (key shown as keyLast4 only), linked installs and entitlements. Returns 404 not_found when the id does not exist in the key’s environment.
curl https://api.extensionbill.com/v1/customers/6703a7e0c9e4b2d5a1f0c381 \
-H "Authorization: Bearer sk_live_..."
{
"customer": {
"id": "6703a7e0c9e4b2d5a1f0c381",
"email": "buyer@example.com",
"name": "Sample Buyer",
"paypalPayerId": "QYR5Z8XDVJNXQ",
"country": "GB",
"env": "live"
},
"orders": [
{
"id": "6703a7f1c9e4b2d5a1f0c388",
"number": "EB-M1Q8Z4K7",
"productName": "Pro",
"priceType": "one_time",
"amounts": { "subtotal": 1900, "discount": 0, "tax": 0, "total": 1900, "currency": "USD" },
"status": "paid",
"paidAt": "2026-10-12T14:03:26.980Z"
}
],
"subscriptions": [],
"licenses": [
{
"id": "6703a7f2c9e4b2d5a1f0c38c",
"keyLast4": "7KQ2",
"productId": "66f1c3b2e4b0d3a1c8f7e2a4",
"status": "active",
"seatLimit": 3,
"expiresAt": null,
"activations": [
{ "id": "6703a8a0c9e4b2d5a1f0c3a1", "installId": "3f0b8f1e-6c1d-4f7a-9a52-1e7d0c4b9a21", "label": "Work laptop", "activatedAt": "2026-10-12T14:05:02.118Z", "lastValidatedAt": "2026-10-12T14:05:02.118Z" }
]
}
],
"installs": [
{
"installId": "3f0b8f1e-6c1d-4f7a-9a52-1e7d0c4b9a21",
"browser": "chrome",
"version": "2.4.0",
"lastSeenAt": "2026-10-12T14:05:02.118Z",
"uninstalledAt": null
}
],
"entitlements": [
{
"id": "6703a7f1c9e4b2d5a1f0c38a",
"productId": "66f1c3b2e4b0d3a1c8f7e2a4",
"entitlementKey": "pro",
"source": "order",
"sourceId": "6703a7f1c9e4b2d5a1f0c388",
"status": "active",
"startsAt": "2026-10-12T14:03:26.980Z",
"endsAt": null
}
]
}
Nested records are trimmed here; they have the same fields as the list endpoints and webhook payloads.
Installs
Retrieve an install and its access
GET /v1/installs/:installId
installId identifies one installation of your extension (read it in the extension with bill.getInstallId()). The response holds the install record and the exact UserState the SDK would receive right now. Returns 404 not_found for unknown install ids.
curl https://api.extensionbill.com/v1/installs/3f0b8f1e-6c1d-4f7a-9a52-1e7d0c4b9a21 \
-H "Authorization: Bearer sk_live_..."
{
"install": {
"installId": "3f0b8f1e-6c1d-4f7a-9a52-1e7d0c4b9a21",
"env": "live",
"extensionId": "abcdefghijklmnopabcdefghijklmnop",
"browser": "chrome",
"version": "2.4.0",
"locale": "en-GB",
"customerId": "6703a7e0c9e4b2d5a1f0c381",
"trialStartedAt": null,
"trialEndsAt": null,
"installedAt": "2026-08-02T17:12:09.540Z",
"lastSeenAt": "2026-10-12T14:05:02.118Z",
"uninstalledAt": null
},
"user": {
"installId": "3f0b8f1e-6c1d-4f7a-9a52-1e7d0c4b9a21",
"env": "live",
"paid": true,
"plan": {
"productId": "66f1c3b2e4b0d3a1c8f7e2a4",
"entitlementKey": "pro",
"name": "Pro",
"priceId": "66f1c3b2e4b0d3a1c8f7e2a6",
"type": "one_time"
},
"entitlements": ["pro"],
"trial": { "available": false, "active": false, "startedAt": null, "endsAt": null, "daysLeft": null },
"subscription": null,
"license": { "last4": "7KQ2", "status": "active", "seatLimit": 3, "seatsUsed": 1, "expiresAt": null },
"customer": { "email": "buyer@example.com", "name": "Sample Buyer" },
"entitlementToken": "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9...",
"checkedAt": "2026-10-12T14:06:40.017Z"
}
}
user has the same shape as UserState. Decide access with user.paid, user.entitlements and user.trial.active.
Orders
List orders
GET /v1/orders
Accepts page, limit and q (order number or customer email). Includes one-time purchases and subscription renewal payments (renewals have subscriptionId set). Order status is pending, paid, refunded, partially_refunded, failed or reversed.
curl "https://api.extensionbill.com/v1/orders?page=1&limit=50" \
-H "Authorization: Bearer sk_live_..."
{
"items": [
{
"id": "6703a7f1c9e4b2d5a1f0c388",
"number": "EB-M1Q8Z4K7",
"receiptNumber": "EB-M1Q8Z4K7",
"customerId": "6703a7e0c9e4b2d5a1f0c381",
"installId": "3f0b8f1e-6c1d-4f7a-9a52-1e7d0c4b9a21",
"productId": "66f1c3b2e4b0d3a1c8f7e2a4",
"priceId": "66f1c3b2e4b0d3a1c8f7e2a6",
"productName": "Pro",
"priceType": "one_time",
"amounts": { "subtotal": 1900, "discount": 0, "tax": 0, "total": 1900, "currency": "USD" },
"paypalFee": 85,
"net": 1815,
"status": "paid",
"paypalOrderId": "5O190127TN364715T",
"paypalCaptureId": "3C679366HH908993F",
"refunds": [],
"refundedAmount": 0,
"discountCode": null,
"customFields": {},
"paidAt": "2026-10-12T14:03:26.980Z",
"createdAt": "2026-10-12T14:02:51.104Z"
}
],
"total": 1,
"page": 1,
"limit": 50
}
Subscriptions
List subscriptions
GET /v1/subscriptions
Accepts page, limit and q (customer email or PayPal subscription id). Subscription status is approval_pending, active, past_due, suspended, canceled or expired. A canceled subscription keeps access until cancelAt. See Subscription lifecycle.
curl "https://api.extensionbill.com/v1/subscriptions?q=buyer@example.com" \
-H "Authorization: Bearer sk_live_..."
{
"items": [
{
"id": "6703b1c4c9e4b2d5a1f0c3d0",
"customerId": "6703a7e0c9e4b2d5a1f0c381",
"installId": "3f0b8f1e-6c1d-4f7a-9a52-1e7d0c4b9a21",
"productId": "66f1c3b2e4b0d3a1c8f7e2b0",
"priceId": "66f1c3b2e4b0d3a1c8f7e2b2",
"paypalSubscriptionId": "I-BW452GLLEP1G",
"paypalPlanId": "P-5ML4271244454362WXNWU5NQ",
"status": "active",
"trialEndsAt": null,
"currentPeriodEnd": "2026-11-12T10:00:00.000Z",
"cancelAt": null,
"canceledAt": null,
"lastPaymentAt": "2026-10-12T10:00:03.000Z",
"lastPaymentAmount": 499,
"failedPayments": 0,
"pastDueSince": null,
"createdAt": "2026-09-12T09:58:40.771Z"
}
],
"total": 1,
"page": 1,
"limit": 20
}
Licenses
Validate a license key
GET /v1/licenses/:key/validate
Checks a license key without activating it, for example when a buyer enters it in your web app or support tool. URL-encode the key (keys like ABCD-EFGH-JKMN-7KQ2 need no escaping). Validation does not use a seat; to use one from the extension, call bill.activateLicense(key) (see License keys).
curl https://api.extensionbill.com/v1/licenses/ABCD-EFGH-JKMN-7KQ2/validate \
-H "Authorization: Bearer sk_live_..."
{
"valid": true,
"status": "active",
"product": {
"id": "66f1c3b2e4b0d3a1c8f7e2a4",
"name": "Pro",
"entitlementKey": "pro"
},
"seatLimit": 3,
"seatsUsed": 1,
"expiresAt": null
}
validistrueonly when the license isactiveand not pastexpiresAt.statusisactive,revokedorexpired. Revoked and expired keys return200withvalid: false.seatLimitisnullfor unlimited seats.seatsUsedcounts current activations.- Unknown keys return
404 license_not_found.
Entitlements
Entitlements grant access. Purchases, subscriptions and licenses create them automatically. These endpoints add and remove manual ones, for example to comp a reviewer or to migrate users who paid before ExtensionBill.
Grant access
POST /v1/entitlements
| Field | Type | Description |
|---|---|---|
customerEmail | string | Grant to a customer by email, created if it does not exist. Every install that restores purchases with this email gets the access. |
installId | string | Grant to one install only. |
productId | string | Required. The product whose entitlementKey the user gets. |
endsAt | string | Optional ISO 8601 date. Omit for lifetime access. |
Send exactly one of customerEmail or installId.
curl https://api.extensionbill.com/v1/entitlements \
-X POST \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{
"customerEmail": "buyer@example.com",
"productId": "66f1c3b2e4b0d3a1c8f7e2a4",
"endsAt": "2027-10-12T00:00:00.000Z"
}'
Returns 201 with the entitlement:
{
"id": "6703c0d5c9e4b2d5a1f0c410",
"appId": "66f1c2a9e4b0d3a1c8f7e210",
"env": "live",
"customerId": "6703a7e0c9e4b2d5a1f0c381",
"installId": null,
"productId": "66f1c3b2e4b0d3a1c8f7e2a4",
"entitlementKey": "pro",
"source": "manual",
"sourceId": null,
"status": "active",
"startsAt": "2026-10-12T15:20:11.402Z",
"endsAt": "2027-10-12T00:00:00.000Z",
"revokedReason": null,
"createdAt": "2026-10-12T15:20:11.402Z",
"updatedAt": "2026-10-12T15:20:11.402Z"
}
The grant triggers entitlement.granted and is recorded in the audit log with the API key as the actor. Extensions pick it up on their next refresh.
Revoke access
DELETE /v1/entitlements/:id
Revokes the entitlement immediately and returns it with status: "revoked". Triggers entitlement.revoked.
curl https://api.extensionbill.com/v1/entitlements/6703c0d5c9e4b2d5a1f0c410 \
-X DELETE \
-H "Authorization: Bearer sk_live_..."
Verify an extension user from your backend
Your extension calls your own API (an AI or sync service, for example), and that API must only serve paying users. The extension sends its install id; your server asks ExtensionBill whether that install has access.
In the extension:
// popup.js
import { bill } from './bill.js'
async function summarize(text) {
const installId = await bill.getInstallId()
const response = await fetch('https://api.your-domain.example/summarize', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Install-Id': installId,
},
body: JSON.stringify({ text }),
})
if (response.status === 402) {
await bill.openCheckout()
return null
}
return response.json()
}
On your server (Node 18+, built-in fetch):
// access.js
const API_BASE = 'https://api.extensionbill.com'
const SECRET_KEY = process.env.EXTENSIONBILL_SECRET_KEY // sk_live_…
const cache = new Map()
const CACHE_TTL_MS = 60 * 1000
export async function getInstallAccess(installId) {
const cached = cache.get(installId)
if (cached && Date.now() - cached.at < CACHE_TTL_MS) return cached.user
const response = await fetch(`${API_BASE}/v1/installs/${encodeURIComponent(installId)}`, {
headers: { Authorization: `Bearer ${SECRET_KEY}` },
})
if (response.status === 404) return null
if (!response.ok) {
const error = await response.json().catch(() => ({}))
throw new Error(`ExtensionBill ${response.status} ${error.code ?? 'unknown_error'}`)
}
const { user } = await response.json()
cache.set(installId, { user, at: Date.now() })
return user
}
// Same rules as bill.hasAccess(): an active install trial unlocks every feature.
export async function hasFeature(installId, entitlementKey) {
const user = await getInstallAccess(installId)
if (!user) return false
if (user.trial.active) return true
return entitlementKey ? user.entitlements.includes(entitlementKey) : user.paid
}
// server.js
import express from 'express'
import { hasFeature } from './access.js'
const app = express()
app.use(express.json())
app.post('/summarize', async (req, res) => {
const installId = req.get('X-Install-Id')
if (!installId) return res.status(400).json({ error: 'missing_install_id' })
try {
if (!(await hasFeature(installId, 'pro'))) {
return res.status(402).json({ error: 'payment_required' })
}
} catch (err) {
console.error(err)
return res.status(503).json({ error: 'billing_unavailable' })
}
const text = String(req.body.text ?? '')
res.json({ summary: text.slice(0, 280) })
})
app.listen(3000)