Stable Pro

Stable Pro API · v1

Endpoints and objects

Every endpoint with its permission, parameters and response, and every object with its fields. Generated from the OpenAPI contract.

Field names, codes and values are the contract: they are the same in every language.

Endpoints

GET/api/v1/connection

The connection of the calling key: name, permissions, and the key itself (never the secret)

Permission
any valid key
Parameters
lang
Response
Connection
Errors
400 · 401 · 403 · 404 · 429 · 500 · 503
GET/api/v1/codes

The dictionary of every code the API returns, with names in the requested language (?lang=, Accept-Language)

Permission
any valid key
Parameters
lang
Response
Codes
Errors
400 · 401 · 403 · 404 · 429 · 500 · 503
GET/api/v1/organization

The stable of the calling key: name, country, currency, time zone, language, whether Stable Pro calculates taxes

Permission
any valid key
Parameters
lang
Response
Organization
Errors
400 · 401 · 403 · 404 · 429 · 500 · 503
GET/api/v1/customers

Everyone with at least one charge, paid or not, member or staff; with customers.fiscal:read also the invoice details

Permission
customers:read
Parameters
langlimitstarting_after
Response
CustomerList
Errors
400 · 401 · 403 · 404 · 429 · 500 · 503
GET/api/v1/customers/{id}

One customer; with customers.fiscal:read also the invoice details. Not of this stable: 404

Permission
customers:read
Parameters
id (path)lang
Response
Customer
Errors
400 · 401 · 403 · 404 · 429 · 500 · 503
GET/api/v1/customers/{id}/balance

What the customer owes today, what comes later, and the credit they can spend

Permission
charges:read
Parameters
id (path)lang
Response
Balance
Errors
400 · 401 · 403 · 404 · 429 · 500 · 503
GET/api/v1/charges

Every charge to the customers, paid or not (never the staff pay)

Permission
charges:read
Parameters
langlimitstarting_after
Filters
  • customer — Only this customer (its id)
  • accounting_month — Only this accounting month (YYYY-MM): the month the fact counts in, see Conventions
Response
ChargeList
Errors
400 · 401 · 403 · 404 · 429 · 500 · 503
GET/api/v1/charges/{id}

One charge, as it is now: amount and taxes are birth plus adjustments plus tax changes

Permission
charges:read
Parameters
id (path)lang
Response
Charge
Errors
400 · 401 · 403 · 404 · 429 · 500 · 503
GET/api/v1/adjustments

Adjustments of charges

Permission
charges:read
Parameters
langlimitstarting_after
Filters
  • charge — Only the adjustments of this charge (its id)
  • accounting_month — Only this accounting month (YYYY-MM): the month the fact counts in, see Conventions
Response
AdjustmentList
Errors
400 · 401 · 403 · 404 · 429 · 500 · 503
GET/api/v1/adjustments/{id}

One adjustment: action, reason, category, signed amount, consideration_effect, the tax difference

Permission
charges:read
Parameters
id (path)lang
Response
Adjustment
Errors
400 · 401 · 403 · 404 · 429 · 500 · 503
GET/api/v1/payments

Money movements of the customers (payments, refunds, reversals, credit used)

Permission
payments:read
Parameters
langlimitstarting_after
Filters
  • customer — Only this customer (its id)
Response
PaymentList
Errors
400 · 401 · 403 · 404 · 429 · 500 · 503
GET/api/v1/payments/{id}

One money movement, with its allocations; who paid on behalf of the customer

Permission
payments:read
Parameters
id (path)lang
Response
Payment
Errors
400 · 401 · 403 · 404 · 429 · 500 · 503
GET/api/v1/allocations/{id}

How much of a movement goes to a charge, signed

Permission
payments:read
Parameters
id (path)lang
Response
Allocation
Errors
400 · 401 · 403 · 404 · 429 · 500 · 503
GET/api/v1/credit-entries

Movements of the customers' credit (born, grown, used, refunded)

Permission
payments:read
Parameters
langlimitstarting_after
Filters
  • customer — Only this customer (its id)
Response
CreditEntryList
Errors
400 · 401 · 403 · 404 · 429 · 500 · 503
GET/api/v1/credit-entries/{id}

One movement of a customer's credit

Permission
payments:read
Parameters
id (path)lang
Response
CreditEntry
Errors
400 · 401 · 403 · 404 · 429 · 500 · 503
GET/api/v1/receipts

Receipts of Stable Pro (R: payment receipts, RB: refund confirmations), in order of issue; never fiscal documents

Permission
receipts:read
Parameters
langlimitstarting_after
Filters
  • customer — Only this customer (its id)
  • payment — Only the receipts of this money movement (its id)
Response
ReceiptList
Errors
400 · 401 · 403 · 404 · 429 · 500 · 503
GET/api/v1/receipts/{id}

One receipt: kind, the number as printed, status, the payment it confirms, the frozen amount

Permission
receipts:read
Parameters
id (path)lang
Response
Receipt
Errors
400 · 401 · 403 · 404 · 429 · 500 · 503
GET/api/v1/receipts/{id}/pdf

The PDF of the receipt, the same the customer got. When it carries the tax data of who paid on behalf of the customer, it also needs customers.fiscal:read (else 403)

Permission
receipts:read
Parameters
id (path)lang
Response
application/pdf
Errors
400 · 401 · 403 · 404 · 429 · 500 · 503
GET/api/v1/events

What happened, in order: read after your cursor to stay in sync. Each event needs the permission of the object it points to. While the stable's history is being loaded: 503 events-not-ready

Permission
any valid key
Parameters
langlimitafter
Response
EventList
Errors
400 · 401 · 403 · 404 · 429 · 500 · 503
GET/api/v1/events/{id}

One event. Of another stable, or of a kind your key does not read: 404

Permission
any valid key
Parameters
id (path)lang
Response
Event
Errors
400 · 401 · 403 · 404 · 429 · 500 · 503

Objects

Problem

FieldTypeDescription
typestring (uri)Stable, in English: decide on this, not on the text
titlestringIn English
statusinteger
detailstring · optionalA sentence for people, in the requested language (?lang=, Accept-Language)
reasonstring · optional
missing · malformed · wrong_environment · unknown · connection_revoked · revoked · expired · rotated
401 only: why the key is not valid
missing_permissionstring · optional
charges:read · payments:read · receipts:read · customers:read · customers.fiscal:read · external-documents:write
403 forbidden only
invalid_paramstring · optional400 only: the parameter that is not valid

Connection

FieldTypeDescription
object"connection"
idstring (uuid)
namestring
permissionsarray of string
created_atstring (date-time)RFC 3339, UTC
keyobject
key.idstring (uuid)
key.last_fourstring
key.environmentstring
live · test
live = production (sp_live_), test = staging (sp_test_)
key.created_atstring (date-time)RFC 3339, UTC
key.expires_atstring (date-time) · nullableRFC 3339, UTC
key.retires_atstring (date-time) · nullableAfter a rotation: when this key stops working

Organization

FieldTypeDescription
object"organization"
idstring (uuid)
namestring
legal_namestring · nullable
countrystring · nullableISO 3166-1 alpha-2
currencystringISO 4217
timezonestringIANA
languagestringThe stable's language: Stable Pro does not know each customer's
localestringBCP 47, for formatting
taxesobject
taxes.calculated_bystring
stable_pro · external
external = Stable Pro does not calculate taxes this month: nothing more
taxes.amount_basis"gross"Every amount is the total the customer pays
receipts_shown_to_customersbooleanfalse: the stable chose not to give Stable Pro receipts to its customers while software is connected; they still exist and are numbered (GET /receipts)

Customer

FieldTypeDescription
object"customer"
idstring (uuid)The customer code: it never changes
kindstring
member · staff
namestring
given_namestring · nullable
family_namestring · nullable
activebooleanfalse: left the stable, or removed; their charges are still invoiceable
created_atstring (date-time)RFC 3339, UTC
billing_addressobject · nullable · optionalcustomers.fiscal:read only
billing_address.line1string · nullable
billing_address.line2string · nullable
billing_address.postal_codestring · nullable
billing_address.citystring · nullable
billing_address.subdivisionstring · nullableISO 3166-2 (IT-MI, US-OH)
billing_address.countrystring · nullableISO 3166-1 alpha-2
billing_address_textstring · nullable · optionalcustomers.fiscal:read only: the old free-text address, only while billing_address is empty
tax_identifiersarray of object · optionalcustomers.fiscal:read only
tax_identifiers[].schemestringVAT, or an ISO 6523 ICD (0210 Italian fiscal code, 0211 Italian VAT number)
tax_identifiers[].valuestring
tax_codestring · nullable · optionalcustomers.fiscal:read only: the old fiscal code, without a scheme

CustomerList

FieldTypeDescription
object"list"
dataarray of Customer
has_morebooleanThere is a next page: ask again with starting_after = the id of the last item

Balance

FieldTypeDescription
object"balance"
customer_idstring (uuid)
currencystring
amount_dueintegerWhat is due today: charges already visible
amount_scheduledintegerCharges that become visible later
creditintegerCredit that can be spent on a charge
as_ofstring (date)Today, in the stable's time zone

Charge

FieldTypeDescription
object"charge"
idstring (uuid)
customer_idstring (uuid)
typestringOpen list: boarding, service_charge, lesson_drop_in, lesson_plan, health_record, …
descriptionstringAs the stable wrote it
period_startstring (date)YYYY-MM-DD
period_endstring (date)YYYY-MM-DD
competence_monthstringYYYY-MM
accounting_monthstringThe later of competence and registration month: computed by Stable Pro
due_datestring (date)YYYY-MM-DD
visible_fromstring (date)YYYY-MM-DD
quantity"1"
unitstring
MON · ANN · C62
UNECE Rec. 20
unit_amountintegerMinor units of the currency (ISO 4217)
currencystring
original_amountintegerAt birth
amountintegerNow: birth plus adjustments
amount_paidintegerMinor units of the currency (ISO 4217)
amount_remainingintegerMinor units of the currency (ISO 4217)
amount_basis"gross"
tax_calculated_bystring
stable_pro · external
tax_treatmentstring
standard_rated · zero_rated · not_calculated · undetermined
taxable_amountintegerMinor units of the currency (ISO 4217)
taxesarray of object
taxes[].type"vat"Open list: other types may come
taxes[].jurisdictionstring · nullableISO 3166-1 alpha-2 of the stable
taxes[].categorystring · nullableUNCL 5305: S, Z, E, AE, K, G, O; null when not declared
taxes[].rate_bpintegerBasis points: 2200 = 22%
taxes[].amountintegerMinor units of the currency
taxes[].exemption_reasonstring · nullable · optionalBT-120, zero-rated only
taxes[].exemption_reason_codestring · nullable · optionalVATEX (BT-121), zero-rated only
created_atstring (date-time)RFC 3339, UTC

ChargeList

FieldTypeDescription
object"list"
dataarray of Charge
has_morebooleanThere is a next page: ask again with starting_after = the id of the last item

Adjustment

FieldTypeDescription
object"adjustment"
idstring (uuid)
charge_idstring (uuid)
customer_idstring (uuid)
direction"receivable"
actionstring · nullableOpen list of codes (see /codes)
reasonstring · nullable
categorystring · nullable
originstring · nullableHUMAN, SYSTEM, …
amountintegerSigned: negative lowers the charge
consideration_effectstring
changes · none
changes: a credit note (or debit note) follows; none: a credit loss, no tax
taxesarray of objectWith changes: the tax difference, already computed. With none: empty
taxes[].type"vat"Open list: other types may come
taxes[].jurisdictionstring · nullableISO 3166-1 alpha-2 of the stable
taxes[].categorystring · nullableUNCL 5305: S, Z, E, AE, K, G, O; null when not declared
taxes[].rate_bpintegerBasis points: 2200 = 22%
taxes[].amountintegerMinor units of the currency
taxes[].exemption_reasonstring · nullable · optionalBT-120, zero-rated only
taxes[].exemption_reason_codestring · nullable · optionalVATEX (BT-121), zero-rated only
taxable_amountinteger · nullableMinor units of the currency (ISO 4217)
currencystring
competence_monthstringYYYY-MM
accounting_monthstringYYYY-MM
occurred_atstring (date-time)RFC 3339, UTC
reverses_adjustment_idstring (uuid) · nullable
taxonomy_versioninteger

AdjustmentList

FieldTypeDescription
object"list"
dataarray of Adjustment
has_morebooleanThere is a next page: ask again with starting_after = the id of the last item

Allocation

FieldTypeDescription
object"allocation"
idstring (uuid)
payment_idstring (uuid)
charge_idstring (uuid)
amountintegerSigned
currencystring · optional
consideration_effect"none"

Payment

FieldTypeDescription
object"payment"
idstring (uuid)
customer_idstring (uuid) · nullable
typestring
payment · credit_applied · offset · refund · moved_to_credit · reversal
What happened to the money (open list)
amountintegerThe money that really moved, signed: a refund or a reversal is negative, moved_to_credit is zero
currencystring
datestring (date)YYYY-MM-DD
accounting_monthstringYYYY-MM
methodstringcash, bank_transfer, pos, credit, compensazione, other (open list)
referencestring · nullable
paid_byobject · nullableWho paid on behalf of the customer (a parent): not a customer of its own
paid_by.kindstring · nullable
paid_by.namestring · nullable
paid_by.tax_codestring · nullable · optionalcustomers.fiscal:read only
paid_by.address_textstring · nullable · optionalcustomers.fiscal:read only
reverses_payment_idstring (uuid) · nullable
actionstring · nullableReversals only
reasonstring · nullable
categorystring · nullable
consideration_effect"none"
allocationsarray of Allocation
taxonomy_versioninteger · nullable
created_atstring (date-time)RFC 3339, UTC

PaymentList

FieldTypeDescription
object"list"
dataarray of Payment
has_morebooleanThere is a next page: ask again with starting_after = the id of the last item

CreditEntry

FieldTypeDescription
object"credit_entry"
idstring (uuid)
customer_idstring (uuid)
directionstring
credit · debit
credit: the credit is born or grows; debit: it is used or refunded
amountintegerAlways positive: direction says the way
currencystring
sourcestringOpen list of codes
payment_idstring (uuid) · nullableThe movement that caused it
charge_idstring (uuid) · nullable
actionstring · nullable
reasonstring · nullable
categorystring · nullable
reverses_entry_idstring (uuid) · nullable
consideration_effect"none"
created_atstring (date-time)RFC 3339, UTC

CreditEntryList

FieldTypeDescription
object"list"
dataarray of CreditEntry
has_morebooleanThere is a next page: ask again with starting_after = the id of the last item

Receipt

FieldTypeDescription
object"receipt"
idstring (uuid)
kindstring
payment_receipt · refund_confirmation
payment_receipt: series R, money received; refund_confirmation: series RB, money refunded (open list)
seriesstringR, RB (open list): every series has its own progression
yearinteger
sequenceintegerProgressive number inside series and year, without gaps
numberstringThe number as printed on the document
statusstring
issued · voided
A voided receipt stays, with its number
issued_atstring (date-time)RFC 3339, UTC
voided_atstring (date-time) · nullableRFC 3339, UTC
operation_typestring · nullableRefund confirmations only: voluntary_refund, payment_reversal, chargeback (open list)
payment_idstring (uuid) · nullableThe payment, or the refund, that the receipt confirms
charge_idstring (uuid) · nullableOnly receipts of the old model, issued on a charge instead of a payment
customer_idstring (uuid) · nullable
amountinteger · nullableAs frozen on the document, signed: a refund confirmation is negative
currencystring
pdf_availablebooleanfalse only for the oldest receipts, issued before frozen documents: no sheet to print again
fiscal_document"false"A confirmation of payment: the fiscal document is issued by your software

ReceiptList

FieldTypeDescription
object"list"
dataarray of Receipt
has_morebooleanThere is a next page: ask again with starting_after = the id of the last item

Event

FieldTypeDescription
object"event"
idstring (uuid)Stable, unique across stables: use it to recognise an event you already processed
typestringOpen list: customer.updated, charge.created, charge.due_date_changed, charge.tax_changed, adjustment.created, payment.created, allocation.created, credit_entry.created, receipt.issued, receipt.voided
dataobject
data.objectstringOpen list: customer, charge, adjustment, payment, allocation, credit_entry, receipt
data.idstring (uuid)
data.urlstringWhere to read it, from the host: /api/v1/charges/{id}
occurred_atstring (date-time)When the fact happened: its creation, issue or void time; for a tax change, its creation
recorded_atstring (date-time)When the event was written: for historical events, the day the history was loaded
historicalbooleantrue: a fact from before the events existed, loaded once, ordered by its date

EventList

FieldTypeDescription
object"list"
dataarray of Event
has_morebooleanAsk again with after = next_cursor. A page can hold fewer events than limit, even none, while has_more is true
next_cursorstring (uuid) · nullableSave it after processing the page, and pass it back as after. It can be the id of an event you are not shown. null only when the stable has no events for you yet

Codes

FieldTypeDescription
object"codes"
languagestringThe language of the names: ?lang=, then Accept-Language, then en
taxonomy_versionintegerThe taxonomy that action, reason and category come from
listsobject
lists.charge_typeobject
lists.charge_type.fieldsarray of stringWhere these codes appear: resource.field
lists.charge_type.codesarray of object
lists.charge_type.codes[].codestring
lists.charge_type.codes[].namestring
lists.actionobject
lists.action.fieldsarray of stringWhere these codes appear: resource.field
lists.action.codesarray of object
lists.action.codes[].codestring
lists.action.codes[].namestring
lists.reasonobject
lists.reason.fieldsarray of stringWhere these codes appear: resource.field
lists.reason.codesarray of object
lists.reason.codes[].codestring
lists.reason.codes[].namestring
lists.reason.codes[].actionstringThe name of a reason depends on its action: look it up with both
lists.reason.codes[].categorystring
lists.categoryobject
lists.category.fieldsarray of stringWhere these codes appear: resource.field
lists.category.codesarray of object
lists.category.codes[].codestring
lists.category.codes[].namestring
lists.originobject
lists.origin.fieldsarray of stringWhere these codes appear: resource.field
lists.origin.codesarray of object
lists.origin.codes[].codestring
lists.origin.codes[].namestring
lists.payment_typeobject
lists.payment_type.fieldsarray of stringWhere these codes appear: resource.field
lists.payment_type.codesarray of object
lists.payment_type.codes[].codestring
lists.payment_type.codes[].namestring
lists.payment_methodobject
lists.payment_method.fieldsarray of stringWhere these codes appear: resource.field
lists.payment_method.codesarray of object
lists.payment_method.codes[].codestring
lists.payment_method.codes[].namestring
lists.credit_sourceobject
lists.credit_source.fieldsarray of stringWhere these codes appear: resource.field
lists.credit_source.codesarray of object
lists.credit_source.codes[].codestring
lists.credit_source.codes[].namestring
lists.receipt_kindobject
lists.receipt_kind.fieldsarray of stringWhere these codes appear: resource.field
lists.receipt_kind.codesarray of object
lists.receipt_kind.codes[].codestring
lists.receipt_kind.codes[].namestring
lists.refund_operationobject
lists.refund_operation.fieldsarray of stringWhere these codes appear: resource.field
lists.refund_operation.codesarray of object
lists.refund_operation.codes[].codestring
lists.refund_operation.codes[].namestring
lists.tax_categoryobjectUNCL 5305
lists.tax_category.fieldsarray of stringWhere these codes appear: resource.field
lists.tax_category.codesarray of object
lists.tax_category.codes[].codestring
lists.tax_category.codes[].namestring
lists.unitobjectUNECE Rec. 20
lists.unit.fieldsarray of stringWhere these codes appear: resource.field
lists.unit.codesarray of object
lists.unit.codes[].codestring
lists.unit.codes[].namestring
lists.event_typeobject
lists.event_type.fieldsarray of stringWhere these codes appear: resource.field
lists.event_type.codesarray of object
lists.event_type.codes[].codestring
lists.event_type.codes[].namestring