ReconSmiths Developers Your API keys

Reference

Invoices and credit notes

Issue tax invoices and credit notes, change notes, void.

This page as plain text: invoices.md

POST/v1/invoices

Post sales invoices in bulk

Calls the ledger's own posting function: one balanced journal, an open-period check, terms taken from the billing party, and the receivable account resolved from the party.

doc_no is NOT accepted. ReconSmith mints the tax invoice number from its own sequence, and takes the number inside the posting transaction, so a failed invoice returns it instead of burning it — the sequence has no gaps. A sales order number legitimately HAS gaps, because orders get cancelled, so passing one through as the invoice number would import those gaps into a sequence an auditor expects to be unbroken. Put the order number in external_ref, and in reference if it should print on the invoice.

No settlement flag is returned: status is derived from allocations and never stored. Read it from GET /v1/documents.

Parameters

NameInRequiredWhat it is
Idempotency-KeyheaderyesRequired on this call. Retrying with the same key returns the original response instead of doing it twice. Reusing a key with a different body is a 422.

Body a JSON array of these, up to 1 000 per call

FieldTypeRequiredWhat it is
external_refstringyesYour identifier — typically the sales order number. The idempotency key for this document.
customer_external_refstringYour customer id, as pushed to /v1/parties. Preferred: you never learn our codes.
account_codestringAlternative: the account_code returned by /v1/parties.
doc_datestring (date)yes
due_datestring (date)Omit to let the billing party's terms derive it.
ccystringDefault "ZAR".
referencestringPrinted on the invoice. The order number belongs here.
notesstring
source_systemstringYour system's name, the same on every call (for example shop). Identifies your references.
linesarray of objectyes
lines[].descriptionstringyes
lines[].amount_excl_taxnumberyes
lines[].tax_amountnumberyes
lines[].account_codestringRevenue account, e.g. "4010". Friendlier than carrying our UUIDs in your config.
lines[].ledger_account_idstring (uuid)Alternative to account_code.
lines[].quantitynumberDefault 1.
lines[].unit_pricenumberOmit and it is derived from amount_excl_tax / quantity.
lines[].branch_idstring (uuid)Chain customers: the branch that incurred the charge. Its branch_number prints on the statement line.
lines[].site_idstring (uuid)
lines[].dimensionsobjectAnalytic tags. Keys and values must already be registered or the line is refused.
lines[].tax_codestringOptional. SR (standard rate) by default; send ZR for zero-rated or EX for exempt supplies.
lines[].item_codestringOptional. The product, by its code in the product list (GET /v1/items).
billing_addressobjectOptional. The address this order was billed to, kept on the invoice so it prints that address whatever the customer's address becomes later. Left out, the invoice prints the customer's current invoice address.
billing_address.unitstring
billing_address.buildingstring
billing_address.street_nostring
billing_address.streetstring
billing_address.suburbstring
billing_address.citystring
billing_address.provincestring
billing_address.postal_codestring
billing_address.country_codestring

Answers

201Posted. Each result carries document_id and the external_ref you sent; created:false means it was already posted under that ref.
422Rejected by the ledger — unknown customer, closed period, unregistered dimension, unbalanced journal. The detail carries the database's own message.

Example

curl -X POST 'https://api.reconsmith.com/v1/invoices' \
  -H 'Authorization: Bearer $RECONSMITH_KEY' \
  -H 'Idempotency-Key: 7c1d0c2e-0b55-4f3a-9a51-1d2f4b6c8e90' \
  -H 'Content-Type: application/json' \
  -d '[
  {
    "external_ref": "string",
    "doc_date": "2026-12-01",
    "lines": [
      {
        "description": "string",
        "amount_excl_tax": 100,
        "tax_amount": 100
      }
    ]
  }
]'

POST/v1/credit-notes

Credit a customer — against an invoice, or on the account

Three shapes, because all three happen:

  1. invoice_external_ref, no lines — credit the whole invoice. The ordinary cancelled-order case.
  2. invoice_external_ref with lines — credit part of that invoice.
  3. customer_external_ref with lines, no invoice — a credit note tied to no invoice at all: goodwill, a pricing correction, a deposit refund, a settlement. It is posted against the customer's account and sits there as money owed, and POST /v1/allocations applies it to any later invoice when they spend it.

An invoice is never deleted and never renumbered. It keeps its number and a credit note cancels it out: that is what keeps the invoice sequence unbroken when an order falls away, and the audit trail append-only. Credit notes have their own gapless sequence (CRN-).

applied: false means nothing was set against an invoice — either the invoice was already paid, or the credit note was never tied to one. Either way the value is credit the customer holds, and it shows in GET /v1/credits and GET /v1/customers/{ref}/credit.

mark_for_refund records that the customer wants the money back rather than a credit against their next order. The credit note is raised either way; this only records which they chose.

reason is never optional. It is the first thing anyone asks about a credit note, and the ledger refuses one without it.

Parameters

NameInRequiredWhat it is
Idempotency-KeyheaderyesRequired on this call. Retrying with the same key returns the original response instead of doing it twice. Reusing a key with a different body is a 422.

Body a JSON array of these, up to 1 000 per call

FieldTypeRequiredWhat it is
invoice_external_refstringThe invoice being credited. Omit for a credit note on the account, and then lines are required.
reasonstringyesStored on the credit note. Say why — an auditor reads this.
external_refstringyesYour identifier for the credit note itself.
doc_datestring (date)
linesarray of objectRequired when no invoice is named; omit to credit a whole invoice.
lines[].descriptionstringyes
lines[].amount_excl_taxnumberyes
lines[].tax_amountnumberyes
lines[].account_codestringRevenue account, e.g. "4010". Friendlier than carrying our UUIDs in your config.
lines[].ledger_account_idstring (uuid)Alternative to account_code.
lines[].quantitynumberDefault 1.
lines[].unit_pricenumberOmit and it is derived from amount_excl_tax / quantity.
lines[].branch_idstring (uuid)Chain customers: the branch that incurred the charge. Its branch_number prints on the statement line.
lines[].site_idstring (uuid)
lines[].dimensionsobjectAnalytic tags. Keys and values must already be registered or the line is refused.
source_systemstringYour system's name, the same on every call (for example shop). Identifies your references.
mark_for_refundbooleanThe customer opted for a refund rather than keeping the credit on account. Default false.
customer_external_refstringThe customer, for a credit note not tied to an invoice. Your own id, as pushed to /v1/parties.
account_codestringAlternative to customer_external_ref.

Answers

201Credited
422Neither an invoice nor a customer with lines; unknown invoice or customer; no reason; or nothing left to credit on an invoice already settled.

Example

curl -X POST 'https://api.reconsmith.com/v1/credit-notes' \
  -H 'Authorization: Bearer $RECONSMITH_KEY' \
  -H 'Idempotency-Key: 7c1d0c2e-0b55-4f3a-9a51-1d2f4b6c8e90' \
  -H 'Content-Type: application/json' \
  -d '[
  {
    "reason": "string",
    "external_ref": "string"
  }
]'

POST/v1/credit-notes/{externalRef}/refund-request

The customer asks for the money back

Flags an existing credit note as refund-requested. It is a flag, not a payment: nothing moves in the ledger and the customer can change their mind right up until the money leaves. Refused if the credit has already been used up.

The flag shows as refund_requested in GET /v1/credits, and refundOnly=true filters to these.

Parameters

NameInRequiredWhat it is
externalRefpathyesYour own external_ref, our document number (CRN-00004) or our document id. GET /v1/credits returns all three, so an office-raised credit with no external_ref is still addressable.
sourceSystemqueryYour system's name, the same on every call (for example shop). Identifies your references.

Body

FieldTypeRequiredWhat it is
notestringWhy, or how they asked. Shown beside the credit.

Answers

200doc_no, unused, requested_at
404No such credit note
422Not a posted credit note, or nothing left to refund

Example

curl -X POST 'https://api.reconsmith.com/v1/credit-notes/EXTERNALREF/refund-request' \
  -H 'Authorization: Bearer $RECONSMITH_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "note": "string"
}'

DELETE/v1/credit-notes/{externalRef}/refund-request

They changed their mind

Clears the flag. The credit itself is untouched and stays on the account.

Parameters

NameInRequiredWhat it is
externalRefpathyesYour own external_ref, our document number (CRN-00004) or our document id. GET /v1/credits returns all three, so an office-raised credit with no external_ref is still addressable.
sourceSystemqueryYour system's name, the same on every call (for example shop). Identifies your references.

Answers

200refund_requested is now false
404No such credit note

Example

curl -X DELETE 'https://api.reconsmith.com/v1/credit-notes/EXTERNALREF/refund-request' \
  -H 'Authorization: Bearer $RECONSMITH_KEY'

POST/v1/credit-notes/{externalRef}/refund

Pay a credit back in money

The money leaves: Dr trade receivables, Cr bank. The refund is a settleable document (CUSTOMER_REFUND, its own REF- sequence) and the credit note is allocated to it, exactly as a receipt settles an invoice — so over-refunding is refused by the allocation rather than by trusting the caller.

Omit amount to refund whatever is unused. A partial refund leaves the rest on the customer's account, which is a thing customers ask for. Omit bank_account_id and the entity's primary bank account is used.

Takes an Idempotency-Key like every write: a retried refund must not pay the customer twice. Once credit_left reaches zero the credit drops off GET /v1/credits.

Parameters

NameInRequiredWhat it is
Idempotency-KeyheaderyesRequired on this call. Retrying with the same key returns the original response instead of doing it twice. Reusing a key with a different body is a 422.
externalRefpathyesYour own external_ref, our document number (CRN-00004) or our document id. GET /v1/credits returns all three, so an office-raised credit with no external_ref is still addressable.
sourceSystemqueryYour system's name, the same on every call (for example shop). Identifies your references.

Body

FieldTypeRequiredWhat it is
amountnumberOmit to refund the full unused balance.
bank_account_idstring (uuid)
doc_datestring (date)
referencestringYours — the EFT reference, say.

Answers

201refund_no, amount, credit_left
404No such credit note
422Nothing left to refund, more than is unused, or a closed period

Example

curl -X POST 'https://api.reconsmith.com/v1/credit-notes/EXTERNALREF/refund' \
  -H 'Authorization: Bearer $RECONSMITH_KEY' \
  -H 'Idempotency-Key: 7c1d0c2e-0b55-4f3a-9a51-1d2f4b6c8e90' \
  -H 'Content-Type: application/json' \
  -d '{
  "amount": 100,
  "bank_account_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "doc_date": "2026-12-01",
  "reference": "string"
}'

POST/v1/credit-notes/{externalRef}/void

Void a credit note

For a credit note raised in error. Posts the mirror journal, keeps the number and marks it VOIDED with the reason. A credit note that has already been used or refunded is refused. Voiding one already voided answers again with already_voided true, so a retry is harmless.

Parameters

NameInRequiredWhat it is
Idempotency-KeyheaderyesRequired on this call. Retrying with the same key returns the original response instead of doing it twice. Reusing a key with a different body is a 422.
externalRefpathyesYour own external_ref, our document number or our document id.
sourceSystemqueryYour system's name, the same on every call (for example shop). Identifies your references.

Body

FieldTypeRequiredWhat it is
reasonstringyesKept on the document's notes.

Answers

201credit_note_external_ref, document_id, doc_no, voided, already_voided
400Idempotency-Key header missing
404No such document
409A request with this Idempotency-Key is already in flight
422No reason given, not a customer credit note, already used or refunded, or Idempotency-Key reused with a different body

Example

curl -X POST 'https://api.reconsmith.com/v1/credit-notes/EXTERNALREF/void' \
  -H 'Authorization: Bearer $RECONSMITH_KEY' \
  -H 'Idempotency-Key: 7c1d0c2e-0b55-4f3a-9a51-1d2f4b6c8e90' \
  -H 'Content-Type: application/json' \
  -d '{
  "reason": "string"
}'

POST/v1/invoices/{externalRef}/void

Void an invoice

For an invoice billed wrong: void it, then issue the correct one under a new external_ref. Posts the mirror journal, keeps the number and marks it VOIDED with the reason. An invoice with a receipt or credit note allocated against it is refused, naming them, because un-allocating money is a decision for a person; un-allocate first, then void. Voiding one already voided answers again with already_voided true.

Parameters

NameInRequiredWhat it is
Idempotency-KeyheaderyesRequired on this call. Retrying with the same key returns the original response instead of doing it twice. Reusing a key with a different body is a 422.
externalRefpathyesYour own external_ref, our document number or our document id.
sourceSystemqueryYour system's name, the same on every call (for example shop). Identifies your references.

Body

FieldTypeRequiredWhat it is
reasonstringyesKept on the document's notes.

Answers

201invoice_external_ref, document_id, doc_no, voided, already_voided
400Idempotency-Key header missing
404No such document
409A request with this Idempotency-Key is already in flight
422No reason given, not a sales invoice, paid or credited, or Idempotency-Key reused with a different body

Example

curl -X POST 'https://api.reconsmith.com/v1/invoices/EXTERNALREF/void' \
  -H 'Authorization: Bearer $RECONSMITH_KEY' \
  -H 'Idempotency-Key: 7c1d0c2e-0b55-4f3a-9a51-1d2f4b6c8e90' \
  -H 'Content-Type: application/json' \
  -d '{
  "reason": "string"
}'

PUT/v1/invoices/{externalRef}/notes

Change an invoice's notes

Replaces the notes line on an invoice and nothing else: same number, same amounts. Works on a draft, posted or paid invoice; a voided one is refused. The PDF is drawn from the document, so fetch it again afterwards to get the new notes. The audit log keeps the old and new notes and the API client that changed them.

Parameters

NameInRequiredWhat it is
Idempotency-KeyheaderyesRequired on this call. Retrying with the same key returns the original response instead of doing it twice. Reusing a key with a different body is a 422.
externalRefpathyesYour own external_ref, our document number or our document id.
sourceSystemqueryYour system's name, the same on every call (for example shop). Identifies your references.

Body

FieldTypeRequiredWhat it is
notesstring or nullThe new notes; null clears them.

Answers

200invoice_external_ref, document_id, doc_no, status, notes, changed
400No body, or Idempotency-Key header missing
404Unknown invoice
409A request with this Idempotency-Key is already in flight
422Notes not changed (e.g. the invoice is voided), or Idempotency-Key reused with a different body

Example

curl -X PUT 'https://api.reconsmith.com/v1/invoices/EXTERNALREF/notes' \
  -H 'Authorization: Bearer $RECONSMITH_KEY' \
  -H 'Idempotency-Key: 7c1d0c2e-0b55-4f3a-9a51-1d2f4b6c8e90' \
  -H 'Content-Type: application/json' \
  -d '{
  "notes": "string"
}'