# User Accounts

Returns all accounts the DEX associates with the given address. DexPal calls this endpoint for each of a user's connected wallets to build a complete picture of their accounts before querying positions, orders, history, or holdings.

> **🔒 Affiliate-code gating:** Only return accounts for addresses attributed to DexPal's affiliate code. If the address is not DexPal-attributed at the DEX, return `404 "Address not found"` — do not return partial data or an empty accounts list. See the [Overview](/for-partners/dex-api-spec.md).

## Overview

|                |                |
| -------------- | -------------- |
| **Method**     | GET            |
| **Auth**       | Bearer API key |
| **Rate limit** | 120 req/min    |

## Request

### Path Parameters

| Param     | Type   | Required | Description                                                                                                                                     |
| --------- | ------ | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| `address` | string | yes      | A wallet address in any format supported by the DEX. The DEX handles format detection internally (EVM hex, Solana base58, Cosmos bech32, etc.). |

### Headers

| Header          | Required | Description        |
| --------------- | -------- | ------------------ |
| `Authorization` | yes      | `Bearer <api_key>` |

## Response

Returns a `data` array of all accounts associated with the given address on this DEX.

### Fields — Account Object

| Field     | Type   | Required | Description                                                                                    |
| --------- | ------ | -------- | ---------------------------------------------------------------------------------------------- |
| `address` | string | yes      | The account address. May differ from the path `{address}` for subaccounts and smart wallets.   |
| `label`   | string | no       | DEX-assigned human-readable label for this account e.g. `"Main Account"`, `"1-Click Trading"`. |

## Account Types

DexPal users may have several types of accounts on a given DEX. The DEX handles the distinction internally and returns all of them here. Common account types include:

* **Primary wallet** — the main EOA used to sign transactions
* **Subaccount** — a DEX-managed account linked to the primary wallet (e.g. dYdX subaccounts)
* **Smart wallet** — an ERC-4337 or equivalent smart contract wallet
* **One-click trading account** — a session wallet used for fast order execution without per-transaction signing (e.g. Vela one-click trading)

All of these are returned as flat entries in the `data` array. DexPal uses the returned addresses to query all other user endpoints.

## Example Response

```json
{
  "success": true,
  "data": [
    {
      "address": "0x1a2b3c4d5e6f7890abcdef1234567890abcdef12",
      "label": "Main Account"
    },
    {
      "address": "0x9c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d",
      "label": "1-Click Trading"
    },
    {
      "address": "0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef",
      "label": "Subaccount 1"
    }
  ]
}
```

## Error Responses

| Status | Error                          | When                                |
| ------ | ------------------------------ | ----------------------------------- |
| `401`  | `"Invalid or missing API key"` | Bad or absent auth header           |
| `404`  | `"Address not found"`          | Address has no accounts on this DEX |
| `500`  | `"Internal server error"`      | Unexpected failure                  |

## Notes

* Always include the primary wallet itself in the response, not only subaccounts.
* Return `404` when the address is either completely unknown **or** not attributed to DexPal's affiliate code. An attributed address with no subaccounts should return a single-item array containing the primary address.
* The `address` values returned here are used as input to the `?addr=` parameter on all other user-level endpoints.


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.dexpal.io/for-partners/endpoints/user-accounts.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
