Ledger accounts

Show examples in: cURL Ruby

List all ledger accounts of an administration

Example: returns a list of ledger accounts

Request

curl -s -H "Content-Type: application/json" -H "Authorization: Bearer 84ec207ad0154a508f798e615a998ac1fd752926d00f955fb1df3e144cba44ab" \
  -XGET \
  https://moneybird.com/api/v2/123/ledger_accounts.json

Response

Status: 200 OK
[
  {
    "id": "171195703262970987",
    "administration_id": 123,
    "name": "Crediteuren",
    "account_type": "current_liabilities",
    "account_id": null,
    "parent_id": null,
    "created_at": "2016-10-26T14:29:26.999Z",
    "updated_at": "2016-10-26T14:29:26.999Z"
  },
  {
    "id": "171195703260873829",
    "administration_id": 123,
    "name": "Debiteuren",
    "account_type": "current_assets",
    "account_id": null,
    "parent_id": null,
    "created_at": "2016-10-26T14:29:26.999Z",
    "updated_at": "2016-10-26T14:29:26.999Z"
  },
  {
    "id": "171195703260873828",
    "administration_id": 123,
    "name": "Financiƫle rekeningen",
    "account_type": "current_assets",
    "account_id": null,
    "parent_id": null,
    "created_at": "2016-10-26T14:29:26.999Z",
    "updated_at": "2016-10-26T14:29:26.999Z"
  }
]

Returns information about a ledger account

Example: returns a ledger account

Request

curl -s -H "Content-Type: application/json" -H "Authorization: Bearer 84ec207ad0154a508f798e615a998ac1fd752926d00f955fb1df3e144cba44ab" \
  -XGET \
  https://moneybird.com/api/v2/123/ledger_accounts/171196213863908354.json

Response

Status: 200 OK
{
  "id": "171196213863908354",
  "administration_id": 123,
  "name": "Grootboekrekening 7565",
  "account_type": "revenue",
  "account_id": null,
  "parent_id": null,
  "created_at": "2016-10-26T12:37:33.921Z",
  "updated_at": "2016-10-26T12:37:33.921Z"
}

Example: returns 404 when requesting unexisting ledger account

Request

curl -s -H "Content-Type: application/json" -H "Authorization: Bearer 84ec207ad0154a508f798e615a998ac1fd752926d00f955fb1df3e144cba44ab" \
  -XGET \
  https://moneybird.com/api/v2/123/ledger_accounts/831921.json

Response

Status: 404 Not Found
{
  "error": "record not found",
  "symbolic": {
    "id": "not_found"
  }
}

Creates a new ledger account

The account_type determines the kind of ledger account, this can be any of the following values: non_current_assets, current_assets, equity, provisions, non_current_liabilities, current_liabilities, revenue, direct_costs, expenses, other_income_expenses

By providing the parent_id, it is possible to create a tree of ledger accounts. Make sure the account_types of the parent and child equal.

Parameters

Parameter Type Description
ledger_account[name] String

Required

Should be unique for this combination of administration and account type.

ledger_account[account_type] String

Required

Can be non_current_assets, current_assets, equity, provisions, non_current_liabilities, current_liabilities, revenue, direct_costs, expenses or other_income_expenses.

ledger_account[account_id] String

Optional field, also known as general ledger code. Should be unique.

ledger_account[parent_id] Integer

Id of the parent ledger account. Should be a valid ledger account id.

ledger_account[allowed_document_types] Array

Can be sales_invoice, purchase_invoice, receipt, general_journal_document or financial_mutation.

Example: creates a new ledger account

Request

curl -s -H "Content-Type: application/json" -H "Authorization: Bearer 84ec207ad0154a508f798e615a998ac1fd752926d00f955fb1df3e144cba44ab" \
  -XPOST \
  -d '{"ledger_account":{"name":"Test ledger account","account_type":"expenses","account_id":2182}}' \
  https://moneybird.com/api/v2/123/ledger_accounts.json

Response

Status: 201 Created
{
  "id": "171196223979521026",
  "administration_id": 123,
  "name": "Test ledger account",
  "account_type": "expenses",
  "account_id": "2182",
  "parent_id": null,
  "created_at": "2016-10-26T12:37:43.567Z",
  "updated_at": "2016-10-26T12:37:43.567Z"
}

Example: returns an error when name is not provided

Request

curl -s -H "Content-Type: application/json" -H "Authorization: Bearer 84ec207ad0154a508f798e615a998ac1fd752926d00f955fb1df3e144cba44ab" \
  -XPOST \
  -d '{"ledger_account":{"account_type":"expenses","account_id":2182}}' \
  https://moneybird.com/api/v2/123/ledger_accounts.json

Response

Status: 400 Bad Request
{
  "error": "Name is required",
  "symbolic": {
    "ledger_account": {
      "name": "required"
    }
  }
}

Example: returns an error when an empty name is provided

Request

curl -s -H "Content-Type: application/json" -H "Authorization: Bearer 84ec207ad0154a508f798e615a998ac1fd752926d00f955fb1df3e144cba44ab" \
  -XPOST \
  -d '{"ledger_account":{"name":"","account_type":"expenses","account_id":2182}}' \
  https://moneybird.com/api/v2/123/ledger_accounts.json

Response

Status: 422 Unprocessable Entity
{
  "error": {
    "name": [
      "cannot be empty"
    ]
  }
}

Updates a ledger account

Parameters

Parameter Type Description
ledger_account[name] String

Should be unique for this combination of administration and account type.

ledger_account[account_id] String

Optional field, also known as general ledger code. Should be unique.

ledger_account[account_type] String

Can be non_current_assets, current_assets, equity, provisions, non_current_liabilities, current_liabilities, revenue, direct_costs, expenses or other_income_expenses.

ledger_account[parent_id] Integer

Id of the parent ledger account. Should be a valid ledger account id.

ledger_account[allowed_document_types] Array

Can be sales_invoice, purchase_invoice, receipt, general_journal_document or financial_mutation.

Example: updates the information in the ledger account

Request

curl -s -H "Content-Type: application/json" -H "Authorization: Bearer 84ec207ad0154a508f798e615a998ac1fd752926d00f955fb1df3e144cba44ab" \
  -XPATCH \
  -d '{"ledger_account":{"name":"New name"}}' \
  https://moneybird.com/api/v2/123/ledger_accounts/171196240587916290.json

Response

Status: 200 OK
{
  "id": "171196240587916290",
  "administration_id": 123,
  "name": "New name",
  "account_type": "revenue",
  "account_id": null,
  "parent_id": null,
  "created_at": "2016-10-26T12:37:59.404Z",
  "updated_at": "2016-10-26T12:37:59.448Z"
}

Example: returns an error when validations are failing

Request

curl -s -H "Content-Type: application/json" -H "Authorization: Bearer 84ec207ad0154a508f798e615a998ac1fd752926d00f955fb1df3e144cba44ab" \
  -XPATCH \
  -d '{"ledger_account":{"name":""}}' \
  https://moneybird.com/api/v2/123/ledger_accounts/171196246562702338.json

Response

Status: 422 Unprocessable Entity
{
  "error": {
    "name": [
      "cannot be empty"
    ]
  }
}

Example: returns a 404 when the ledger account does not exist

Request

curl -s -H "Content-Type: application/json" -H "Authorization: Bearer 84ec207ad0154a508f798e615a998ac1fd752926d00f955fb1df3e144cba44ab" \
  -XPATCH \
  -d '{"ledger_account":{"name":"New name"}}' \
  https://moneybird.com/api/v2/123/ledger_accounts/12341.json

Response

Status: 404 Not Found
{
  "error": "record not found",
  "symbolic": {
    "id": "not_found"
  }
}

Deletes a ledger account

Example: deletes a ledger account

Request

curl -s -H "Content-Type: application/json" -H "Authorization: Bearer 84ec207ad0154a508f798e615a998ac1fd752926d00f955fb1df3e144cba44ab" \
  -XDELETE \
  https://moneybird.com/api/v2/123/ledger_accounts/171196258457748482.json

Response

Status: 204 No Content

Example: returns 404 when the ledger account does not exist

Request

curl -s -H "Content-Type: application/json" -H "Authorization: Bearer 84ec207ad0154a508f798e615a998ac1fd752926d00f955fb1df3e144cba44ab" \
  -XDELETE \
  https://moneybird.com/api/v2/123/ledger_accounts/21321.json

Response

Status: 404 Not Found
{
  "error": "record not found",
  "symbolic": {
    "id": "not_found"
  }
}

Top