# Listing accounts

## List accounts

<mark style="color:green;">`GET`</mark> `/api/public/v1/accounts`

This endpoint returns your master accounts and subaccounts, including current balances.

### Example request

Use the base URL for your environment. See [Environments](https://docs.txn.io/getting-setup/environments).

{% code title="curl" %}

```bash
curl -X GET "https://api.sandbox.txn.io/api/public/v1/accounts?page=1&per_page=50" \
  -H "Content-Type: application/vnd.api+json" \
  -H "Authorization: Bearer <api_key>"
```

{% endcode %}

Authentication details: [Authenticating the API](https://docs.txn.io/api-basics/authenticating-the-api).

**Headers**

| Name          | Value                      |
| ------------- | -------------------------- |
| Content-Type  | `application/vnd.api+json` |
| Authorization | `Bearer <api_key>`         |

**URL Parameters**

| Name       | Type   | Description                            |
| ---------- | ------ | -------------------------------------- |
| `per_page` | number | Number of accounts to return per page. |
| `page`     | number | Page number to return.                 |

**Response**

{% tabs %}
{% tab title="HTTP 200" %}

```json
{
  "data": [
    {
      "id": "adb0f9c4-c7fd-4989-a273-1bd11ad5847b",
      "type": "accounts",
      "attributes": {
        "master": false,
        "currencyCode": "EUR",
        "label": "EUR_4",
        "bankReference": "BDR0154632342411086",
        "balance": "26.16",
        "totalBalance": "26.16",
        "bankWithdrawalAvailable": true,
        "currencyType": "fiat"
      },
      "relationships": {
        "company": {
          "meta": {
            "included": false
          }
        },
        "networks": {
          "meta": {
            "included": false
          }
        }
      }
    },
    {
      "id": "c569b222-6de4-4783-a3c1-8d2b8a1bb980",
      "type": "accounts",
      "attributes": {
        "master": false,
        "currencyCode": "USDC",
        "label": "qq",
        "bankReference": "BDR0804588056382376",
        "balance": "0.00",
        "totalBalance": "0.00",
        "bankWithdrawalAvailable": false,
        "currencyType": "crypto"
      },
      "relationships": {
        "company": {
          "meta": {
            "included": false
          }
        },
        "networks": {
          "meta": {
            "included": false
          }
        }
      }
    },
    {
      "id": "1d5a3601-76b7-4426-b5fb-3e434c17803e",
      "type": "accounts",
      "attributes": {
        "master": false,
        "currencyCode": "EUR",
        "label": "123",
        "bankReference": "BDR0354788360836433",
        "balance": "33.35",
        "totalBalance": "33.35",
        "bankWithdrawalAvailable": true,
        "currencyType": "fiat"
      },
      "relationships": {
        "company": {
          "meta": {
            "included": false
          }
        },
        "networks": {
          "meta": {
            "included": false
          }
        }
      }
    },
    {
      "id": "dc9c1c6e-3fa6-4fce-8c5f-714dfcecf3ee",
      "type": "accounts",
      "attributes": {
        "master": false,
        "currencyCode": "USDT",
        "label": "Sub-account Adam Goodman",
        "bankReference": "BDR7013714686525702",
        "balance": "0.000000",
        "totalBalance": "0.000000",
        "bankWithdrawalAvailable": false,
        "currencyType": "crypto"
      },
      "relationships": {
        "company": {
          "meta": {
            "included": false
          }
        },
        "networks": {
          "meta": {
            "included": false
          }
        }
      }
    },
    {
      "id": "d5415da2-b193-4445-aab1-a654ad77cd79",
      "type": "accounts",
      "attributes": {
        "master": false,
        "currencyCode": "EUR",
        "label": "Sub-account Callum Abbott",
        "bankReference": "BDR0812434002530431",
        "balance": "8.44",
        "totalBalance": "8.44",
        "bankWithdrawalAvailable": true,
        "currencyType": "fiat"
      },
      "relationships": {
        "company": {
          "meta": {
            "included": false
          }
        },
        "networks": {
          "meta": {
            "included": false
          }
        }
      }
    }
  ],
  "meta": {
    "page": 1,
    "per_page": 5,
    "total": 39
  },
  "jsonapi": {
    "version": "1.0"
  }
}
```

{% endtab %}
{% endtabs %}

**Response Body**

| Name                                        | Type    | Description                                                                                                                               |
| ------------------------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| `data[].id`                                 | string  | Account ID.                                                                                                                               |
| `data[].type`                               | string  | Entity type returned. Always `accounts`.                                                                                                  |
| `data[].attributes`                         | object  | Account attributes.                                                                                                                       |
| `data[].attributes.master`                  | boolean | If `true`, the account is a master account. If `false`, the account is a subaccount.                                                      |
| `data[].attributes.currencyCode`            | string  | Account currency code. See [Supported currencies](https://docs.txn.io/api-basics/supported-currencies).                                   |
| `data[].attributes.currencyType`            | string  | Currency type. Either `fiat` or `crypto`.                                                                                                 |
| `data[].attributes.label`                   | string  | Account label. Master accounts use `master`. Subaccounts use a user-defined label.                                                        |
| `data[].attributes.bankReference`           | string  | Unique bank deposit reference (when applicable). Example: `BDR6421088115176062`.                                                          |
| `data[].attributes.balance`                 | string  | Account balance. Returned as a string for decimal precision.                                                                              |
| `data[].attributes.totalBalance`            | string  | For master accounts only. Total balance across the master account and its subaccounts.                                                    |
| `data[].attributes.bankWithdrawalAvailable` | bool    | When set to `true`, users can initiate bank withdrawals from the specified account. When set to `false`, bank withdrawals are restricted. |
| `meta.page`                                 | number  | Current page number.                                                                                                                      |
| `meta.per_page`                             | number  | Page size used for the response.                                                                                                          |
| `meta.total`                                | number  | Total number of accounts available.                                                                                                       |
| `jsonapi.version`                           | string  | JSON:API version.                                                                                                                         |

### Errors

* `401 Unauthorized` if the API key is missing or invalid. See [Authenticating the API](https://docs.txn.io/api-basics/authenticating-the-api).
* `429 Too Many Requests` if you hit rate limits. See [Rate limits](https://docs.txn.io/api-basics/rate-limits).

### Related endpoints

* [Read account](https://docs.txn.io/accounts/reading-account)
* [Accounts concept](https://docs.txn.io/accounts/accounts-concept)
