Browse the docs

List accounts

GET /v2/api-gateway/accounts

Lists the accounts of your top-level organization and its direct child organizations, newest first. Pass organization_id to scope the list to one organization you own.

Request

Authentication: your API key in the x-api-key header.

Query parameters

FieldTypeDescription
pagenumberMin 1
per_pagenumberMin 1, max 100. A larger value is rejected with a 400 on this listing.
organization_idstring, uuidReturn only accounts of this organization (yours or one of its children). Omit for all.
searchstringCase-insensitive partial match against account id and name
current_pagenumberPage number, starting at 1 — the canonical spelling, accepted on every paginated endpoint and matching pagination.current_page in the response. page means the same thing and keeps working; if both are sent, current_page wins.

Example request

cURL

curl --request GET \
     --url 'https://api.themooncard.com/v2/api-gateway/accounts' \
     --header 'x-api-key: YOUR_API_KEY'

Responses

200 Success
FieldTypeDescription
accounts requiredarray of object
accounts[].id requiredstringAccount id.
accounts[].name requiredstring, nullable
accounts[].organization_id requiredstring
accounts[].ledger_account_id requiredstringInternal. May change or be removed without notice — do not rely on it.
accounts[].balance requirednumberCurrent balance as a number.
accounts[].available_balance requirednumberSpendable balance as a number.
accounts[].currency requiredstringISO-4217 currency code, e.g. "USD".
accounts[].metadata requiredobjectThe key-value data you stored on this account, returned exactly as you sent it. An empty object when you never set any — it is never null.
accounts[].created_at requiredstringISO-8601 timestamp.
accounts[].updated_at requiredstring, nullableISO-8601 timestamp, or null.
pagination requiredobject
pagination.total requiredintegerTotal number of items across all pages.
pagination.last_page requiredintegerNumber of the last page (0 when there are no items).
pagination.prev_page requiredinteger, nullablePrevious page number, or null on the first page.
pagination.next_page requiredinteger, nullableNext page number, or null on the last page.
pagination.per_page requiredintegerPage size that was applied.
pagination.current_page requiredinteger1-based current page.
pagination.from requiredinteger1-based index of the first item on this page (0 when empty).
pagination.to requiredinteger1-based index of the last item on this page (0 when empty).

JSON

{
  "accounts": [
    {
      "id": "9b2e7d10-6c1f-4a3e-8f5d-2a4b6c8d0e1f",
      "name": "Operations",
      "organization_id": "5c1e2d3f-4a5b-4c6d-8e7f-9a0b1c2d3e4f",
      "ledger_account_id": "0a1b2c3d-4e5f-4061-8273-8495a6b7c8d9",
      "balance": 1250.75,
      "available_balance": 1180.25,
      "currency": "USD",
      "metadata": {
        "cost_center": "CC-204"
      },
      "created_at": "2026-08-01T09:12:44.000Z",
      "updated_at": "2026-08-16T17:51:01.000Z"
    }
  ],
  "pagination": {
    "total": 1,
    "last_page": 1,
    "prev_page": null,
    "next_page": null,
    "per_page": 10,
    "current_page": 1,
    "from": 1,
    "to": 1
  }
}
400 Error

Validation failed (errors[] lists each offending field) or a domain rule rejected the request ({ message, code }).

The body is the standard error object: see Errors.

401 Error

Missing or invalid credentials, e.g. { "message": "Invalid API Key", "code": "UNAUTHORIZED" }.

The body is the standard error object: see Errors.

404 Error

Organization not found (returned with code ACCOUNT_NOT_FOUND).

The body is the standard error object: see Errors.

500 Error

Unexpected server error. Body is { message: "Internal server error", code: "INTERNAL_SERVER_ERROR" }.

The body is the standard error object: see Errors.

Last updated June 5, 2026