Books

Create ledgers (general ledger accounts)

Changed on

Creates up to 100 ledgers, i.e. general ledger (GL) accounts, in the organization's live chart of accounts. Each ledger needs a name, type, subType, debitCredit (natural balance), and sortCode (account number), and may name a parentId to nest it under an existing ledger of the same Books instance that is not read-only. Teal validates each ledger against the chart-of-accounts rules: subType must belong to type (see the type and subType fields of a ledger, as returned by getBooksLedgers), a child ledger has the same type and sub-type as its parent, and names and sort codes must be unique. The response has exactly one result per requested ledger, in request order: the created ledger, in the same shape as getBooksLedgers returns, or an error with a stable code and a message explaining how to fix it. A failed ledger does not fail the request or the other ledgers, so the status is 200 even when some or all ledgers fail; check each result. Problems with the request as a whole, such as a missing scope, a parent ledger outside the Books instance or read-only (linked to a Mercury account), an empty list, or more than 100 ledgers, are reported with an HTTP error status and create nothing.

post/books/ledgers

Request

Query parameters

booksIdstring uuid

The Books instance to act on. Must be the token organization's own instance, which it defaults to.

Request body

Example request

{
  "ledgers": [
    {
      "parentId": "7JRNsKwy2Lw66caxVU7WGC"
    }
  ]
}

Response

Example response

{
  "results": [
    {
      "ledger": {
        "id": "7JRNsKwy2Lw66caxVU7WGC",
        "parentId": "7JRNsKwy2Lw66caxVU7WGC"
      }
    }
  ]
}

Changes