Ledgerwell API v1

QA fixture. Ledgerwell is a made-up accounting product used to test integrations. All data is synthetic.

Authentication

Send your API token on every request: Authorization: Bearer <token>. There is no OAuth sign-in. Requests without a valid token get 401.

All endpoints are under /api/v1 and send and receive JSON. Amounts are decimal numbers in the currency's major unit (12.50 means twelve and a half). Dates are YYYY-MM-DD.

GET /api/v1/organisation

The organisation the token belongs to: {"organisation":{"id":"org-1","name":"..."}}. Use it to check a token.

Contacts (customers)

GET /api/v1/contacts?search=<text>

Contacts whose name contains the text (case-insensitive): {"data":{"contacts":[{"id":"con-101","name":"...","reference":"..."}]}}

POST /api/v1/contacts

Body {"name":"string (required)","reference":"string (optional, your own id for the contact)"}. Returns 201 {"data":{"contact":{"id":"con-102","name":"...","reference":"..."}}}.

Invoices

GET /api/v1/invoices?number=<invoice number>

Invoices with exactly that number: {"data":{"invoices":[{"id":"inv-103","number":"...","total":0,"currency":"USD","status":"open"}]}}. An empty list when there is none.

POST /api/v1/invoices

{
  "number": "string (required, must be unique)",
  "contact_id": "string (required, a contact id)",
  "currency": "string, ISO 4217 (required)",
  "issue_date": "YYYY-MM-DD (required)",
  "due_date": "YYYY-MM-DD (optional)",
  "total": 0.00,            // number (required): the invoice total including tax
  "idempotency_key": "string (optional): a repeated key returns the first invoice instead of creating another",
  "lines": [                // at least one
    { "description": "string (required)", "quantity": 1, "unit_price": 0.00,
      "account_code": "string (required, the sales account)", "tax_code": "string (optional)" }
  ]
}

Returns 201 {"data":{"invoice":{"id":"inv-104","number":"...","total":0.00,"currency":"USD","status":"open"}}}. A duplicate number gets 409; a missing field gets 422 with {"error":"..."}.

GET /api/v1/invoices/{id}

{"data":{"invoice":{"id":"...","number":"...","total":0.00,"currency":"USD","status":"open | paid | void"}}}. An invoice is paid when status is paid.

DELETE /api/v1/invoices/{id}

Voids an open invoice (status becomes void). Returns 200. A paid invoice cannot be voided (409).

Credit notes

GET /api/v1/credit-notes?number=<number>

Same shape as invoices, under data.credit_notes.

POST /api/v1/credit-notes

Same body as an invoice (number, contact_id, currency, issue_date, total, lines, idempotency_key), plus optional "invoice_id" for the invoice it credits. Returns 201 {"data":{"credit_note":{"id":"crn-105","number":"...","total":0.00,"currency":"USD","status":"open"}}}.

GET /api/v1/credit-notes/{id}

{"data":{"credit_note":{"id":"...","number":"...","total":0.00,"currency":"USD","status":"open | void"}}}

POST /api/v1/credit-notes/{id}/void

Reverses a credit note (status becomes void). No body. Returns 200.