---
title: Retrieve Ledger Accounts
slug: api/retrieve-ledger-accounts
docTags: 
createdAt: 2026-08-20T02:00:14.436Z
---

{
  "id": "lCTqLKsoOdMM_5xX5lnTs",
  "type": "api-oas-v2",
  "data": {
    "method": "GET",
    "url": "https://api.mpay.com.au/ledger/v1/allAccounts",
    "servers": [
      {
        "url": "https://api.mpay.com.au/ledger/v1/allAccounts",
        "description": "Production URL"
      },
      {
        "url": "https://api.m-pay.com.au/ledger/v1/allAccounts",
        "description": "Sandbox URL"
      }
    ],
    "name": "Retrieve Ledger Accounts",
    "description": "<p>Returns a list of all ledgers attached to the requestors mAccount, with options to include closed accounts in the query. If no ledger accounts exist, an empty array will be returned.</p>",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [
        {
          "name": "accept",
          "type": "string",
          "kind": "optional",
          "description": "Generated from available response content types",
          "enum": [
            "application/json"
          ],
          "default": "application/json"
        }
      ],
      "queryParameters": [
        {
          "kind": "optional",
          "name": "includeClosed",
          "type": "string",
          "example": "false",
          "description": "<p><strong>Optional</strong>. Whether to include closed ledger accounts in the response. Defaults to false.</p>",
          "default": "false",
          "pattern": "^(true|false)$"
        }
      ],
      "bodyDataParameters": [],
      "formDataParameters": [],
      "oAuthParameters": [
        {
          "id": "basicAuth",
          "name": "basicAuth",
          "kind": "optional",
          "type": "http",
          "description": "<p>To authenticate using basic authentication, generate an API key and pass it as the username. No password is required.</p>",
          "scheme": "basic"
        }
      ],
      "cookieParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "Successful response.",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "ledgerAllAccountsResponse_V1",
            "schema": [
              {
                "name": "ledgerAccounts",
                "kind": "optional",
                "type": "array",
                "description": "<p><strong>Optional</strong>. List of all ledger accounts, including closed ones if requested. An empty array is returned if no ledger accounts exist.</p>",
                "modelRef": "#/components/schemas/ledgerAllAccountsItem",
                "customType": "ledgerAllAccountsItem[]",
                "schema": [
                  {
                    "name": "ledgerAccountNumber",
                    "kind": "optional",
                    "type": "string",
                    "description": "Unique identifier of the ledger account.",
                    "example": "200000001",
                    "default": "200000001",
                    "pattern": "^[0-9]{6,12}$"
                  },
                  {
                    "name": "ledgerUniqueReference",
                    "kind": "optional",
                    "type": "string",
                    "description": "<p><strong>Optional</strong>. Unique reference associated with the ledger.</p>",
                    "example": "CUST-000123",
                    "default": "CUST-000123",
                    "pattern": "^.{1,50}$"
                  },
                  {
                    "name": "description",
                    "kind": "optional",
                    "type": "string",
                    "description": "<p><strong>Optional</strong>. Description of the ledger, possibly containing JSON encoded data.</p>",
                    "example": "Primary settlement ledger for Acme Pty Ltd",
                    "default": "Primary settlement ledger for Acme Pty Ltd",
                    "pattern": "^.{0,255}$"
                  },
                  {
                    "name": "name",
                    "kind": "optional",
                    "type": "string",
                    "description": "<p><strong>Optional</strong>. Name of the ledger.</p>",
                    "example": "Acme Pty Ltd",
                    "default": "Acme Pty Ltd",
                    "pattern": "^.{1,140}$"
                  },
                  {
                    "name": "isClosed",
                    "kind": "optional",
                    "type": "string",
                    "description": "Indicates whether the ledger account is currently closed.",
                    "example": "false",
                    "default": "false",
                    "pattern": "^(true|false)$"
                  },
                  {
                    "name": "createdDateTime",
                    "kind": "optional",
                    "type": "string",
                    "description": "The datetime when the ledger was created.",
                    "example": "2026-07-23T13:55:59",
                    "default": "2026-07-23T13:55:59",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?$"
                  },
                  {
                    "name": "closedDateTime",
                    "kind": "optional",
                    "type": "string",
                    "description": "<p><strong>Conditional</strong>. The datetime when the ledger was closed. Present only if the ledger has been closed.</p>",
                    "example": "2026-07-23T13:55:59",
                    "default": "2026-07-23T13:55:59",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?$"
                  }
                ]
              },
              {
                "name": "durationMs",
                "kind": "optional",
                "type": "string",
                "description": "The total time in milliseconds that the Platform took to process the request.",
                "example": "42",
                "default": "42",
                "pattern": "^[0-9]+$"
              },
              {
                "name": "status",
                "kind": "optional",
                "type": "string",
                "description": "This is the status of the request. A code of 'Ok' indicates no errors.",
                "example": "Ok",
                "default": "Ok",
                "pattern": "^.{1,50}$"
              },
              {
                "name": "statusDescription",
                "kind": "optional",
                "type": "string",
                "description": "<p>This is a description of the status. If an 'Ok' status is returned, then this will be 'Operation completed successfully'.</p>",
                "example": "Operation completed successfully",
                "default": "Operation completed successfully",
                "pattern": "^.{1,255}$"
              }
            ],
            "modelRef": "#/components/schemas/ledgerAllAccountsResponse_V1",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "400",
        "description": "<p>Bad Request - the request was malformed or contained invalid parameters.</p>",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "errorResponse_V1",
            "schema": [
              {
                "name": "status",
                "kind": "optional",
                "type": "string",
                "description": "The status of the request. A value other than 'Ok' indicates that the request failed.",
                "example": "Error",
                "default": "Error",
                "pattern": "^.{1,50}$"
              },
              {
                "name": "statusDescription",
                "kind": "optional",
                "type": "string",
                "description": "<p>A human-readable description of the error that occurred.</p>",
                "example": "Invalid ledger account number.",
                "default": "Invalid ledger account number.",
                "pattern": "^.{1,255}$"
              },
              {
                "name": "errorCode",
                "kind": "optional",
                "type": "string",
                "description": "<p><strong>Conditional</strong>. The error code returned by the platform. Present only when the request fails.</p>",
                "example": "400",
                "default": "400",
                "pattern": "^[0-9]{3,5}$"
              },
              {
                "name": "errorMessage",
                "kind": "optional",
                "type": "string",
                "description": "<p><strong>Conditional</strong>. Detailed error message describing the cause of the failure. Present only when the request fails.</p>",
                "example": "The supplied ledger account number could not be found.",
                "default": "The supplied ledger account number could not be found.",
                "pattern": "^.{1,255}$"
              },
              {
                "name": "durationMs",
                "kind": "optional",
                "type": "string",
                "description": "The total time in milliseconds that the Platform took to process the request.",
                "example": "42",
                "default": "42",
                "pattern": "^[0-9]+$"
              }
            ],
            "modelRef": "#/components/schemas/errorResponse_V1",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "401",
        "description": "<p>Unauthorized - authentication failed, or the API key was missing or invalid.</p>",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "errorResponse_V1",
            "schema": [
              {
                "name": "status",
                "kind": "optional",
                "type": "string",
                "description": "The status of the request. A value other than 'Ok' indicates that the request failed.",
                "example": "Error",
                "default": "Error",
                "pattern": "^.{1,50}$"
              },
              {
                "name": "statusDescription",
                "kind": "optional",
                "type": "string",
                "description": "<p>A human-readable description of the error that occurred.</p>",
                "example": "Invalid ledger account number.",
                "default": "Invalid ledger account number.",
                "pattern": "^.{1,255}$"
              },
              {
                "name": "errorCode",
                "kind": "optional",
                "type": "string",
                "description": "<p><strong>Conditional</strong>. The error code returned by the platform. Present only when the request fails.</p>",
                "example": "400",
                "default": "400",
                "pattern": "^[0-9]{3,5}$"
              },
              {
                "name": "errorMessage",
                "kind": "optional",
                "type": "string",
                "description": "<p><strong>Conditional</strong>. Detailed error message describing the cause of the failure. Present only when the request fails.</p>",
                "example": "The supplied ledger account number could not be found.",
                "default": "The supplied ledger account number could not be found.",
                "pattern": "^.{1,255}$"
              },
              {
                "name": "durationMs",
                "kind": "optional",
                "type": "string",
                "description": "The total time in milliseconds that the Platform took to process the request.",
                "example": "42",
                "default": "42",
                "pattern": "^[0-9]+$"
              }
            ],
            "modelRef": "#/components/schemas/errorResponse_V1",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "500",
        "description": "<p>Internal Server Error - an unexpected error occurred while processing the request.</p>",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "errorResponse_V1",
            "schema": [
              {
                "name": "status",
                "kind": "optional",
                "type": "string",
                "description": "The status of the request. A value other than 'Ok' indicates that the request failed.",
                "example": "Error",
                "default": "Error",
                "pattern": "^.{1,50}$"
              },
              {
                "name": "statusDescription",
                "kind": "optional",
                "type": "string",
                "description": "<p>A human-readable description of the error that occurred.</p>",
                "example": "Invalid ledger account number.",
                "default": "Invalid ledger account number.",
                "pattern": "^.{1,255}$"
              },
              {
                "name": "errorCode",
                "kind": "optional",
                "type": "string",
                "description": "<p><strong>Conditional</strong>. The error code returned by the platform. Present only when the request fails.</p>",
                "example": "400",
                "default": "400",
                "pattern": "^[0-9]{3,5}$"
              },
              {
                "name": "errorMessage",
                "kind": "optional",
                "type": "string",
                "description": "<p><strong>Conditional</strong>. Detailed error message describing the cause of the failure. Present only when the request fails.</p>",
                "example": "The supplied ledger account number could not be found.",
                "default": "The supplied ledger account number could not be found.",
                "pattern": "^.{1,255}$"
              },
              {
                "name": "durationMs",
                "kind": "optional",
                "type": "string",
                "description": "The total time in milliseconds that the Platform took to process the request.",
                "example": "42",
                "default": "42",
                "pattern": "^[0-9]+$"
              }
            ],
            "modelRef": "#/components/schemas/errorResponse_V1",
            "isExpanded": true
          }
        ]
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "QBEkpttakiXXRNr6jjgCY",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request GET \\\n     --url 'https://api.mpay.com.au/ledger/v1/allAccounts?includeClosed=false' \\\n     --header 'accept: application/json'"
        },
        {
          "id": "szSCn8VRi0soPGMibxmDJ",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar requestOptions = {\n   method: 'GET',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"https://api.mpay.com.au/ledger/v1/allAccounts?includeClosed=false\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "p9HLg2ktf2cW_9WF7pY4N",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.mpay.com.au/ledger/v1/allAccounts?includeClosed=false\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "23qyEbbcD7X10kAzsXo5J",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.mpay.com.au/ledger/v1/allAccounts?includeClosed=false\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"GET\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "QBEkpttakiXXRNr6jjgCY"
    },
    "results": {
      "languages": [
        {
          "id": "ATGUEBandkhj3gIAPQiF-",
          "language": "200",
          "code": "// Successful response.\n{\n  \"ledgerAccounts\": [\n    {\n      \"ledgerAccountNumber\": \"200000001\",\n      \"ledgerUniqueReference\": \"CUST-000123\",\n      \"description\": \"Primary settlement ledger for Acme Pty Ltd\",\n      \"name\": \"Acme Pty Ltd\",\n      \"isClosed\": \"false\",\n      \"createdDateTime\": \"2026-07-23T13:55:59\",\n      \"closedDateTime\": \"2026-07-23T13:55:59\"\n    }\n  ],\n  \"durationMs\": \"42\",\n  \"status\": \"Ok\",\n  \"statusDescription\": \"Operation completed successfully\"\n}"
        },
        {
          "id": "Ypt0kluGa_N419QiAfl4r",
          "language": "400",
          "code": "// Bad Request - the request was malformed or contained invalid parameters.\n{\n  \"status\": \"Error\",\n  \"statusDescription\": \"Invalid ledger account number.\",\n  \"errorCode\": \"400\",\n  \"errorMessage\": \"The supplied ledger account number could not be found.\",\n  \"durationMs\": \"42\"\n}"
        },
        {
          "id": "yxIN2LOzbMtuw-ywRgBpL",
          "language": "401",
          "code": "// Unauthorized - authentication failed, or the API key was missing or invalid.\n{\n  \"status\": \"Error\",\n  \"statusDescription\": \"Invalid ledger account number.\",\n  \"errorCode\": \"400\",\n  \"errorMessage\": \"The supplied ledger account number could not be found.\",\n  \"durationMs\": \"42\"\n}"
        },
        {
          "id": "klFCdf5IjtS69-SeyY8zX",
          "language": "500",
          "code": "// Internal Server Error - an unexpected error occurred while processing the request.\n{\n  \"status\": \"Error\",\n  \"statusDescription\": \"Invalid ledger account number.\",\n  \"errorCode\": \"400\",\n  \"errorMessage\": \"The supplied ledger account number could not be found.\",\n  \"durationMs\": \"42\"\n}"
        }
      ],
      "selectedLanguageId": "ATGUEBandkhj3gIAPQiF-"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}