> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mymorabaa.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get accounts

> Retrieve accounts with optional business filtering, search, and pagination.

## Endpoint

`GET /accounts`

Production URL:

`https://sam.aragon.morabaa.com/api/accounts`

## Authentication

This endpoint requires app authentication headers:

* `X-App-Id: <APP_ID>`
* `X-App-Secret: <APP_SECRET>`

### Required headers

<ParamField header="X-App-Id" type="string" required>
  App ID credential.
</ParamField>

<ParamField header="X-App-Secret" type="string" required>
  App secret credential.
</ParamField>

<Note>
  Need credentials? Contact [info@morabaa.com](mailto:info@morabaa.com).
</Note>

If either is invalid or missing, the response is `401 Unauthorized`.

Do not send `Content-Type: application/json` for this `GET` request. Only include a `Content-Type` header when the request has a JSON body.

## Request example

```bash theme={null}
curl -G "https://sam.aragon.morabaa.com/api/accounts" \
  -H "X-App-Id: <APP_ID>" \
  -H "X-App-Secret: <APP_SECRET>" \
  --data-urlencode "query=ahmed" \
  --data-urlencode "businessId=9c7f3b9d-0809-4f5e-b8f2-b6e46a4eb3af" \
  --data-urlencode "limit=25" \
  --data-urlencode "offset=0"
```

## Query parameters

All query parameters are optional.

<ParamField query="query" type="string">
  General text search.
</ParamField>

<ParamField query="businessId" type="guid">
  Filter by business ID. If omitted, the first business ID from the authenticated app is used.
</ParamField>

<ParamField query="limit" type="int">
  Page size. Defaults to `25`, clamped to `1..100`.
</ParamField>

<ParamField query="offset" type="int">
  Skip count. Defaults to `0` and never below `0`.
</ParamField>

Notes:

* `businessId` must belong to the authenticated app if it is supplied.
* A successful response returns `200 OK`.

## Response

The response type is an array of accounts:

<ResponseField name="id" type="guid">
  Account ID.
</ResponseField>

<ResponseField name="businessId" type="guid">
  Business ID associated with the account.
</ResponseField>

<ResponseField name="localId" type="int">
  Local account ID from MyMorabaa.
</ResponseField>

<ResponseField name="name" type="string">
  Account name.
</ResponseField>

<ResponseField name="phoneNumber" type="string">
  Account phone number.
</ResponseField>

<ResponseField name="address" type="string">
  Account address.
</ResponseField>

<ResponseField name="balances" type="array">
  Account balances grouped by state and currency.
</ResponseField>

```json theme={null}
[
  {
    "id": "7f8f6d3b-2b93-4af3-9f65-7ea7d5ab79f1",
    "businessId": "9c7f3b9d-0809-4f5e-b8f2-b6e46a4eb3af",
    "localId": 1024,
    "name": "Ahmed Ali",
    "phoneNumber": "+9647700000000",
    "address": "Baghdad, Iraq",
    "balances": [
      {
        "state": "active",
        "currencyId": 1,
        "amount": 1250.5
      }
    ]
  }
]
```


## OpenAPI

````yaml openapi.json GET /accounts
openapi: 3.1.0
info:
  title: MyMorabaa API
  version: 1.0.0
servers:
  - url: https://sam.aragon.morabaa.com/api
security: []
paths:
  /accounts:
    get:
      summary: Get accounts
      description: >-
        Retrieve accounts with optional business filtering, search, and
        pagination.
      parameters:
        - $ref: '#/components/parameters/XAppId'
        - $ref: '#/components/parameters/XAppSecret'
        - name: query
          in: query
          schema:
            type: string
          description: General text search.
        - name: businessId
          in: query
          schema:
            type: string
            format: uuid
          description: >-
            Filter by business ID. If omitted, the first business ID from the
            authenticated app is used.
        - name: limit
          in: query
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 25
          description: Page size. Defaults to 25, clamped to 1..100.
        - name: offset
          in: query
          schema:
            type: integer
            minimum: 0
            default: 0
          description: Skip count. Defaults to 0 and never below 0.
      responses:
        '200':
          description: Accounts returned successfully.
        '401':
          description: Missing or invalid app authentication headers.
components:
  parameters:
    XAppId:
      name: X-App-Id
      in: header
      required: true
      schema:
        type: string
      description: App ID credential.
    XAppSecret:
      name: X-App-Secret
      in: header
      required: true
      schema:
        type: string
      description: App secret credential.

````