Skip to main content

Public API reference

This is the stable part of the API: the routes a partner app, an integration or a script can build on and keep. Version 1.6. The same document, as OpenAPI, is served by your installation at /api/v1/openapi.public.json and committed as docs/_generated/public-openapi.json; the typed TypeScript SDK (@erp/sdk) is generated from it. Everything else under /api/v1 is the product's own and may change in any release — the full index is The API.

Authentication​

Send Authorization: Bearer <credential> on every call.

  • An API key (erpapi.…) — issued by an administrator on Settings → Integrations → API clients, bound to a role and narrowed by scopes. For a system of your own: a till, a webstore, a script.
  • An OAuth access token (erpoat_…) — granted to a partner app by a person on the consent screen, through the authorization-code flow with PKCE. It acts as that person in that company, narrowed to the scopes they approved, and never more. It lasts an hour; refresh it with its refresh token (erport_…, thirty days, rotated on every use). See The developer platform.

Pagination​

A list answers {items, total, limit, offset, next_offset}. Ask for the next page with offset=next_offset; next_offset is null on the last page. limit is at most 200. The SDK's paginate() does this for you.

Money​

An amount is a string of digits, never a JSON number, in the shape its schema shows: "12.50" or {"amount": "12.50", "currency": "USD"}. A receipt's amounts and an invoice line's unit price also take a plain "12.50", in the customer's or invoice's currency; a supplier payment's amount also takes {"amount", "currency"} beside the payment's own currency when the two are the same. An amount in a currency the document is not in is refused, never converted or ignored.

Idempotency keys​

Send Idempotency-Key: <a unique string> on any POST, PUT, PATCH or DELETE and a retried request is performed once. The retry is answered with the first answer and the header Idempotent-Replay: true. The same key with a different body is refused (409). The SDK sends one for you and keeps it across its retries.

A retry sent while the first attempt is still running waits up to three seconds for it and then answers as it did. Every endpoint behaves the same way; a slower one, such as splitting a bank deposit across several customers, can still be running after three seconds, and the retry is then answered 409 idempotency_key_in_flight. Nothing was done twice: send it again in a moment with the same key.

Errors​

Every refusal is JSON with a stable code, a message written for a person, and the request_id to quote when you ask for help:

{ "code": "permission_denied", "message": "…", "permission": "customer.read", "request_id": "…" }

A refusal for want of a permission names it as permission, for a program to act on; the SDK's ErpApiError carries it.

StatusMeans
400, 422The request needs fixing; message says what
401The credential is not valid: refresh the token, or ask for a new key
403The credential lacks the permission, or the company has switched that app off
404No such record, in this company
409Somebody changed it first, or a reused idempotency key
429Over the rate limit: wait Retry-After seconds

Rate limits​

Per API key and per partner app in each company, 120 requests a minute unless the company's administrator changed it. Over it the answer is 429 with Retry-After in seconds, and nothing else is done. The SDK waits and retries.

Versioning​

Within /api/v1 a public route only grows: new optional parameters, new response fields, new routes. Ignore fields you do not know. A route marked beta is published but outside that promise.

Routes​

POST /api/v1/oauth/revoke​

Revoke a token. Revoke an access or refresh token (RFC 7009). A refresh token takes its family.

Since 1.0 · stable · authentication: none — anybody may read it

Answers 200 with any.

POST /api/v1/oauth/token​

Exchange a code or a refresh token for tokens. Exchange an authorization code, or a refresh token, for tokens (RFC 6749 §4.1.3, §6).

Since 1.0 · stable · authentication: none — anybody may read it

Answers 200 with OAuthAppTokenResponse.

GET /api/v1/public/customers​

List customers. Customers, by name, a page at a time.

Since 1.0 · stable · authentication: bearer

ParameterInTypeRequiredWhat it is
qquerystring or nullnoName, number or tax id.
statusqueryCustomerStatus or nullnoOnly customers in this status.
limitqueryintegernoAt most 200.
offsetqueryintegernoWhere the page starts.

Answers 200 with PublicApiCustomerPage.

GET /api/v1/public/customers/{customer_id}​

Get a customer. One customer.

Since 1.0 · stable · authentication: bearer

ParameterInTypeRequiredWhat it is
customer_idpathstringyes—

Answers 200 with PublicApiCustomer.

GET /api/v1/public/whoami​

Who am I. Who this credential is, in which company, holding what.

Since 1.0 · stable · authentication: bearer

Answers 200 with PublicApiWhoAmI.

POST /api/v1/tax/quote​

Quote tax on lines. What these lines would be taxed — as an order of them would charge.

Since 1.0 · stable · authentication: bearer

Body: QuoteRequest.

Answers 200 with QuoteResponse.

GET /api/v1/webhooks/catalogue​

Webhook event catalogue. Every event a webhook can be told, with its version and payload schema (A7, E1).

Since 1.0 · stable · authentication: none — anybody may read it

Answers 200 with WebhookCatalogue.

Schemas​

AmountLimitResponse​

The floor or cap that decided a tax's amount.

FieldTypeAlways sentWhat it is
kindLimitKindyes—
perstringyes—
countstringyes—
unlimitedstringyes—

AppliedTaxResponse​

FieldTypeAlways sentWhat it is
tax_code_idstringyes—
codestringyes—
namestringyes—
jurisdiction_idstringyes—
jurisdiction_namestringyes—
kindTaxKindyes—
basisTaxBasisyes—
burdenExciseBurdenyes—
ratestringyes—
taxableMoneySchema-Outputyes—
amountMoneySchema-Outputyes—
measured_quantitystring or nullyes—
measurestring or nullyes—
exempted_bystring or nullyes—
exemption_reasonExemptionReason or nullyes—
limitAmountLimitResponse or nullno—
percent_ofPercentOf or nullno—
bracketQuoteBracketResponse or nullno—
reliefQuoteReliefResponse or nullno—
discountMoneySchema-Output or nullno—

CustomerKind​

The legal nature of a customer.

one of organisation, individual.

CustomerStatus​

Where an account is in its life.

one of prospect, pending_approval, active, on_hold, inactive.

ExciseBurden​

Who ends up paying an excise tax.

one of passed_on, absorbed.

ExemptionReason​

Why a customer is not charged tax.

one of resale, exempt_organisation, manufacturing, export, licensed_distributor, other.

HTTPValidationError​

FieldTypeAlways sentWhat it is
detaillist of ValidationErrorno—

JurisdictionLevel​

How far down a taxing authority sits.

one of country, state, county, city, special.

JurisdictionResponse​

FieldTypeAlways sentWhat it is
idstringyes—
codestringyes—
namestringyes—
levelJurisdictionLevelyes—
country_codestringyes—
subdivisionstring or nullyes—
subdivision_codestring or nullno—
citystring or nullyes—
postal_codestring or nullyes—
county_fipsstring or nullno—
countystring or nullyes—
registration_numberstring or nullyes—
is_activebooleanyes—
versionintegeryes—

LicenceStatus​

What the regulator says about a licence today.

one of unverified, verified, suspended, revoked.

LicenceType​

What a licence permits.

one of tobacco, cigarette, vape, kratom, atc, resale, sales_tax, drivers_licence, hemp, distributor, manufacturer, other.

LimitKind​

Which bound decided a tax's amount.

one of floor, cap.

MoneySchema-Input​

A monetary amount in an API request or response.

FieldTypeAlways sentWhat it is
amountnumber or stringyes—
currencystringyes—

MoneySchema-Output​

A monetary amount in an API request or response.

FieldTypeAlways sentWhat it is
amountstringyes—
currencystringyes—

OAuthAppTokenResponse​

RFC 6749 §5.1.

FieldTypeAlways sentWhat it is
access_tokenstringyes—
token_typestringno—
expires_inintegeryes—
refresh_tokenstringyes—
scopestringyes—

PactScopeReason​

Why a shipped line is on a PACT report, or is not. One per line.

one of covered, forced_in, not_covered, unclassified, handed_over, licensed_distributor, forced_out.

PercentOf​

What a percentage tax is a percentage of.

one of line_amount, manufacturer_list, wholesale_cost, retail_price.

PublicApiApp​

FieldTypeAlways sentWhat it is
client_idstringyes—
namestringyes—

PublicApiCustomer​

A customer, in the public API's stable shape.

FieldTypeAlways sentWhat it is
idstringyes—
numberstringyes—
namestringyes—
legal_namestring or nullyes—
dba_namestring or nullyes—
statusstringyes—
emailstring or nullyes—
phonestring or nullyes—
websitestring or nullyes—
currencystringyes—
created_atstringyes—
updated_atstringyes—

PublicApiCustomerPage​

One page of customers. Ask for the next with offset=next_offset.

FieldTypeAlways sentWhat it is
itemslist of PublicApiCustomeryes—
totalintegeryes—
limitintegeryes—
offsetintegeryes—
next_offsetinteger or nullyes—

PublicApiWhoAmI​

Who a credential is, where, and with what.

FieldTypeAlways sentWhat it is
company_idstringyes—
company_namestringyes—
actor_typestringyes—
principal_idstring or nullyes—
appPublicApiApp or nullyes—
permissionslist of stringyes—
api_versionstringyes—

QuoteBasis​

What a quote's answer about the buyer rests on.

one of on_file, caller_stated.

QuoteBracketResponse​

What a statute's bracket decided on one line (audit of 21 October, 20).

FieldTypeAlways sentWhat it is
keystringyes—
sale_taxablestringyes—
sale_taxstringyes—
unbracketedstringyes—

QuoteBuyerResponse​

Who the quote was priced for, and what about them it rested on.

FieldTypeAlways sentWhat it is
customer_idstring or nullno—
ship_to_idstring or nullno—
namestring or nullno—
stated_licenceslist of StatedLicenceno—
stated_licences_ignoredbooleanno—
sale_to_a_person_no_accountbooleanno—
notestring or nullno—

QuoteChannel​

How the goods a quote prices reach the buyer.

one of delivery, counter, web.

QuoteLine​

One line to price.

FieldTypeAlways sentWhat it is
item_idstringyes—
quantitynumber or stringyes—
netMoneySchema-InputyesAn amount and its currency, {"amount": "12.50", "currency": "USD"}, or the amount alone as a string, "12.50", in the currency of the document it is for. Never a JSON number.
referencestring or nullno—
discountMoneySchema-Input or nullnoAn amount and its currency, {"amount": "12.50", "currency": "USD"}, or the amount alone as a string, "12.50", in the currency of the document it is for. Never a JSON number.

QuoteLineResponse​

FieldTypeAlways sentWhat it is
referencestring or nullyes—
taxeslist of AppliedTaxResponseyes—
chargedMoneySchema-Outputyes—
absorbedMoneySchema-Outputyes—
tracelist of TaxTraceLineResponseno—
pactQuotePactScopeResponse or nullno—
noteslist of QuoteNoteResponseno—

QuoteNoteResponse​

A gate the sale will ask, said on the quote instead of refusing it.

FieldTypeAlways sentWhat it is
causestringyes—
messagestringyes—

QuotePactScopeResponse​

Whether a sale like this line would be on a PACT filing, and why.

FieldTypeAlways sentWhat it is
reasonPactScopeReasonyes—
includedbooleanyes—

QuoteReliefResponse​

A tax due only on the first sale to a retailer, decided by the buyer (audit of 21 October, 20).

FieldTypeAlways sentWhat it is
buyerstringyes—
sentencestringyes—
licence_numberstring or nullno—
current_onstring or nullno—
authoritystringno—

QuoteRequest​

What to tax, where it is going, and when.

FieldTypeAlways sentWhat it is
lineslist of QuoteLineyes—
onstringyes—
country_codestring or nullno—
subdivisionstring or nullno—
citystring or nullno—
postal_codestring or nullno—
county_fipsstring or nullno—
record_typestring or nullno—
record_idstring or nullno—
channelQuoteChannelno—
customer_idstring or nullno—
ship_to_idstring or nullno—
store_idstring or nullno—
ships_onstring or nullno—
buyerStatedBuyer or nullno—

QuoteResponse​

FieldTypeAlways sentWhat it is
lineslist of QuoteLineResponseyes—
jurisdictionslist of JurisdictionResponseyes—
chargedMoneySchema-Outputyes—
absorbedMoneySchema-Outputyes—
roundingRoundingyes—
unmatchedlist of string or nullyes—
missing_exciselist of string or nullno—
channelQuoteChannelno—
basisQuoteBasisno—
buyerQuoteBuyerResponse or nullno—
netMoneySchema-Output or nullno—
totalMoneySchema-Output or nullno—

Rounding​

Where a tax total is rounded to the cent.

one of per_line, per_tax.

StatedBuyer​

A buyer not on file, as the caller describes them.

FieldTypeAlways sentWhat it is
namestring or nullno—
kindCustomerKindno—
licenceslist of StatedLicenceno—

StatedLicence​

A licence the caller says a buyer not on file holds.

FieldTypeAlways sentWhat it is
licence_typeLicenceTypeyes—
issuing_statestringyes—
issuing_countrystringno—
numberstringyes—
statusLicenceStatusno—
issued_onstring or nullno—
expires_onstring or nullno—

TaxBasis​

What a tax is charged on. The wedge.

one of percent, per_measure.

TaxKind​

What sort of tax this is, which decides where it posts and how it files.

one of sales, use, excise, vat.

TaxTraceLineResponse​

One tax on one line, as it was frozen.

FieldTypeAlways sentWhat it is
linestringyes—
skustringyes—
codestringyes—
namestringyes—
jurisdictionstringyes—
kindstringyes—
basisstringyes—
ratestringyes—
taxablestringyes—
amountstringyes—
measured_quantitystring or nullyes—
measurestring or nullyes—
explanationstringyes—
limitTraceLimitResponse or nullno—
reliefTraceReliefResponse or nullno—
discountstring or nullno—
tiersTraceTiersResponse or nullno—
citationTraceCitationResponse or nullno—

TraceCitationResponse​

FieldTypeAlways sentWhat it is
authoritystring or nullno—
source_urlstring or nullno—
checked_onstring or nullno—
pack_keystring or nullno—
pack_versionstring or nullno—
pack_rule_idstring or nullno—

TraceLimitResponse​

A frozen floor or cap: strings, as the rest of a frozen trace is.

FieldTypeAlways sentWhat it is
kindstringyes—
perstringyes—
countstringyes—
unlimitedstringyes—

TraceReliefResponse​

A tax due only on the first sale to a retailer, not charged (trace 1.3).

FieldTypeAlways sentWhat it is
buyerstringyes—
sentencestringyes—
licence_numberstring or nullno—
current_onstring or nullno—

TraceTierPartResponse​

One tier's part of a line (trace version 1.7).

FieldTypeAlways sentWhat it is
fromstringyes—
tostring or nullno—
ratestringyes—
countedstringyes—
amountstringyes—

TraceTiersResponse​

What a tiered schedule decided on a line (trace version 1.7).

FieldTypeAlways sentWhat it is
keystringyes—
namestringyes—
modestringyes—
onstringyes—
figurestringyes—
partslist of TraceTierPartResponseyes—

ValidationError​

FieldTypeAlways sentWhat it is
loclist of string or integeryes—
msgstringyes—
typestringyes—
inputanyno—
ctxobjectno—

WebhookCatalogue​

FieldTypeAlways sentWhat it is
catalogue_versionintegeryes—
signature_headerstringyes—
max_attemptsintegeryes—
retry_after_secondslist of integeryes—
eventslist of WebhookCatalogueEventyes—

WebhookCatalogueEvent​

FieldTypeAlways sentWhat it is
namestringyes—
familystringyes—
versionintegeryes—
descriptionstringyes—
payload_schemaobjectyes—