> For the complete documentation index, see [llms.txt](https://docs.miatel.com/api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.miatel.com/api/account/list-accounts.md). Agents can also search and read this documentation through its [MCP server](https://docs.miatel.com/api/~gitbook/mcp).

# List accounts

Find the account ID to use when checking its balance.

Use the access token from [Authorization](https://docs.miatel.com/api/account-authorization) in the `Authorization: Bearer <access_token>` header. Use a token with the `account` scope. Set `Accept: application/json` for the examples below.

### Request

Send `select=id,name,currency_id` to list the accounts without their [balance values](https://docs.miatel.com/api/account/get-account-balance). The `id` field identifies the account.

#### Request Example

```bash
curl --request GET "https://app.miatel.com/api/sms_hub/account?select=id,name,currency_id" \
  --header "Authorization: Bearer $MIATEL_ACCESS_TOKEN" \
  --header 'Accept: application/json'
```

### Usage limits and retries

All endpoints share a limit of 50 requests per second from one IP address. Up to 50 more requests wait in a queue and are served at that rate. Clients behind the same IP share the limit.

When the queue is full, nginx returns 429 before the API handles the request. The request changed nothing. The response body is outside the API's JSON and CBOR error format: rely on the status code. Wait at least one second, then retry, increasing the wait after each further 429.

These account and currency requests only read data and can be repeated after a timeout or 5XX response. They do not change account balances.

## List accounts with balances

> Requires scope \`account\` or \`all\`.

````json
{"openapi":"3.1.2","info":{"title":"Miatel Client API","version":"1.0.0"},"tags":[{"name":"list-sms-accounts","description":"Use the access token from [Authorization](https://docs.miatel.com/api/account-authorization) in the `Authorization: Bearer <access_token>` header. Use a token with the `account` scope. Set `Accept: application/json` for the examples below.\n\n## Request\n\nSend `select=id,name,currency_id` to list the accounts without their [balance values](https://docs.miatel.com/api/account/get-account-balance). The `id` field identifies the account.\n\n### Request Example\n\n```bash\ncurl --request GET \"https://app.miatel.com/api/sms_hub/account?select=id,name,currency_id\" \\\n  --header \"Authorization: Bearer $MIATEL_ACCESS_TOKEN\" \\\n  --header 'Accept: application/json'\n```\n\n## Usage limits and retries\n\nAll endpoints share a limit of 50 requests per second from one IP address. Up to 50 more requests wait in a queue and are served at that rate. Clients behind the same IP share the limit.\n\nWhen the queue is full, nginx returns 429 before the API handles the request. The request changed nothing. The response body is outside the API's JSON and CBOR error format: rely on the status code. Wait at least one second, then retry, increasing the wait after each further 429.\n\nThese account and currency requests only read data and can be repeated after a timeout or 5XX response. They do not change account balances."},{"name":"get-account-balance","description":"Use the access token from [Authorization](https://docs.miatel.com/api/account-authorization) in the `Authorization: Bearer <access_token>` header. Use a token with the `account` scope. Set `Accept: application/json` for the examples below.\n\n## Request\n\nGet the account ID from [List accounts](https://docs.miatel.com/api/account/list-accounts). Set `id.eq` to that ID and request `id,name,balance,currency_id`.\n\n### Request Example\n\n```bash\ncurl 'https://app.miatel.com/api/sms_hub/account?id.eq=42&select=id,name,balance,currency_id' \\\n  --header \"Authorization: Bearer $MIATEL_ACCESS_TOKEN\" \\\n  --header 'Accept: application/json'\n```\n\n### Response\n\nThe API returns a JSON array. An empty array means no account matched the query.\n\n```json\n[\n  {\n    \"id\": 42,\n    \"name\": \"Example account\",\n    \"balance\": -12.50,\n    \"currency_id\": 3\n  }\n]\n```\n\nThe balance uses the account currency and can be negative. A `null` value means the balance has yet to be calculated. For the currency code, match `currency_id` to `id` from the [currency endpoint](https://docs.miatel.com/api/account/get-account-balance#get-api-sms_hub-currency) and read its `name` field.\n\n{% openapi-operation spec=\"miatel-client-api\" path=\"/api/sms_hub/account\" method=\"get\" %}\nOpenAPI miatel-client-api\n{% endopenapi-operation %}\n\n## Usage limits and retries\n\nAll endpoints share a limit of 50 requests per second from one IP address. Up to 50 more requests wait in a queue and are served at that rate. Clients behind the same IP share the limit.\n\nWhen the queue is full, nginx returns 429 before the API handles the request. The request changed nothing. The response body is outside the API's JSON and CBOR error format: rely on the status code. Wait at least one second, then retry, increasing the wait after each further 429.\n\nThese account and currency requests only read data and can be repeated after a timeout or 5XX response. They do not change account balances."}],"servers":[{"url":"https://app.miatel.com"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Access token from `POST /oauth/token`"}},"parameters":{"Select":{"name":"select","in":"query","description":"Comma-separated columns to return, all columns if omitted. An unknown column returns 400","schema":{"type":"string"}},"Order":{"name":"order","in":"query","description":"Comma-separated columns to sort by, ascending unless suffixed with `.desc`. An unknown column returns 400","schema":{"type":"string"}},"Filter":{"name":"filter","in":"query","style":"form","explode":true,"description":"`<column>.<operator>=<value>` query parameters, combined with AND. An unknown column or operator returns 400.\n\n- `eq`, `neq`, `gt`, `gte`, `lt`, `lte`: comparison\n- `like`, `ilike` (case-insensitive): SQL pattern, `%` matches any characters, `_` one character.\n  Encode `%` as `%25` in the URL\n- `in`, `not.in`, `overlap`: list in braces, `id.in={1,2,3}`\n- `isnull`, `notnull`: the value is ignored, `name.isnull=`\n","schema":{"type":"object","additionalProperties":{"type":"string"}}}},"schemas":{"SmsAccount":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"balance":{"type":["number","null"],"format":"double","description":"In the account currency, null if not yet calculated"},"currency_id":{"type":"integer","description":"`id` from `GET /api/sms_hub/currency`"}}},"Rows":{"description":"First array holds column names, the rest hold row values","type":"array","items":{"type":"array","items":{}}},"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"string","description":"RFC 6749 error code on `/oauth/token`. On other endpoints, a short message that may change:\nrely on the HTTP status there. Errors without a specific message carry the HTTP status text,\nsuch as `Bad Request` or `Conflict`\n"},"error_description":{"type":"string","description":"On `/oauth/token`, a description for developers that may change. On other endpoints, only when a\nrequest breaks a constraint of the data (400, 409): the name of that constraint, such as\n`shortcode_format` or `tag_customer_id_name_unique`. The names are listed with the responses\n"}}}},"responses":{"BadRequest":{"description":"Invalid request, such as an unknown filter, or `Accept` allowing neither CBOR nor JSON\n(`mime type application/cbor or application/json is not acceptable`)\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}},"application/cbor":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Unauthorized":{"description":"Missing, invalid or expired access token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}},"application/cbor":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Forbidden":{"description":"The token lacks the required scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}},"application/cbor":{"schema":{"$ref":"#/components/schemas/Error"}}}},"TooManyRequests":{"description":"More than 50 requests per second from this IP address, and the queue of 50 more is full. nginx rejects\nthe request before the API, so nothing is changed and the request can be repeated after a pause of at least\na second. The body comes from nginx and is not part of this API: rely on the status code\n"},"ServerError":{"description":"Server error, retry later. 500 returns `unknown error`, 503 returns `database connection error`\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}},"application/cbor":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"paths":{"/api/sms_hub/account":{"get":{"tags":["list-sms-accounts","get-account-balance"],"operationId":"listSmsAccounts","summary":"List accounts with balances","description":"Requires scope `account` or `all`.","parameters":[{"$ref":"#/components/parameters/Select"},{"$ref":"#/components/parameters/Order"},{"$ref":"#/components/parameters/Filter"}],"responses":{"200":{"description":"Accounts","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/SmsAccount"}}},"application/cbor":{"schema":{"$ref":"#/components/schemas/Rows"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/TooManyRequests"},"5XX":{"$ref":"#/components/responses/ServerError"}}}}}}
````


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.miatel.com/api/account/list-accounts.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
