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

# Accounts

## Table of Endpoints

| Name | Method | Endpoint | Legacy Scope | CDP API Key Scope |
| :- | :- | :- | :- | :- |
| [List Accounts](#list-accounts) | GET | `/v2/accounts` | `wallet:accounts:read`, `coinbase:stablecoins:balance-read` | `view` |
| [Show Account](#show-account) | GET | `/v2/accounts/:account_id` | `wallet:accounts:read`, `coinbase:stablecoins:balance-read` | `view` |

## Overview

The **Account resource** represents a user's accounts: cryptocurrency wallets, fiat currency accounts, and vaults. When you set `fetch_all=true`, the response also includes self-custody wallet accounts and accounts in the user's perpetuals portfolio. The `type` field says which kind it is. New types may be added in the future, so make sure your implementation handles values it doesn't recognize.

User can only have one primary account and its type can only be `wallet`.

| Parameter | Description |
| :- | :- |
| `id` *string* | Resource ID |
| `name` *string* | User or system defined name |
| `primary` *boolean* | Primary account (or not) |
| `type` *string, enumerable* | Account's type. Values: `wallet`, `fiat`, `vault`, `dex_wallet`. Self-custody wallet accounts are `dex_wallet`. Perpetuals portfolio accounts are `wallet`. New values may be added. |
| `currency` *hash* | Account's currency |
| `balance` *money hash* | Crypto balance |
| `available_to_send` *money hash* | Amount the user can send from this account right now. Returned only when you set `include_available_to_send=true` and the account is eligible. Only USDC accounts are eligible for now. |
| `created_at` *timestamp* | |
| `updated_at` *timestamp* | |
| `resource` *string, constant **account*** | |
| `resource_path` *string* | |

#### Account Resource

```json lines wrap theme={null}
{
  "id": "2bbf394c-193b-5b2a-9155-3b4732659ede",
  "name": "My Wallet",
  "primary": true,
  "type": "wallet",
  "currency" : {
      "asset_id" : "5b71fc48-3dd3-540c-809b-f8c94d0e68b5",
      "code" : "BTC",
      "color" : "#F7931A",
      "exponent" : 8,
      "name" : "Bitcoin",
      "slug" : "bitcoin",
      "type" : "crypto"
  }
  "balance": {
      "amount": "39.59000000",
      "currency": "BTC"
  },
  "created_at": "2024-01-31T20:49:02Z",
  "updated_at": "2024-01-31T20:49:02Z",
  "resource": "account",
  "resource_path": "/v2/accounts/2bbf394c-193b-5b2a-9155-3b4732659ede"
}
```

## List Accounts

List a current user's accounts to which the authentication method has access to.

### HTTP Request

`GET https://api.coinbase.com/v2/accounts`

### Scopes

* `wallet:accounts:read`
* `coinbase:stablecoins:balance-read`

> [!NOTE]
>
> If your token has `coinbase:stablecoins:balance-read` but not `wallet:accounts:read`, the response includes only stablecoin accounts. Pagination applies to the stablecoin accounts only. With `wallet:accounts:read`, the response includes all accounts.

### Arguments

| Parameter | Type | Required | Description |
| :- | :- | :- | :- |
| `include_available_to_send` | boolean | Optional | Include `available_to_send` on each eligible account in the page. Defaults to `false`. |
| `fetch_all` | boolean | Optional | Include self-custody wallet accounts and accounts in the user's perpetuals portfolio. Defaults to `false`. |

> [!NOTE]
>
> With `fetch_all=true`, results are still limited to the accounts the user granted your app. `next_uri` keeps `fetch_all=true`, so later pages use the same setting.

> [!NOTE]
>
> `available_to_send` accounts for holds and the user's send limits, so it can be lower than `balance`. It's never higher than the account's own available balance. Because send limits apply across the user, don't add `available_to_send` values together across accounts.
>
> The field is omitted, not set to zero, when it isn't available for an account. This includes accounts in currencies other than USDC. An actual zero amount is still returned.

### Examples

#### Request

```shell Shell  lines wrap theme={null}
curl 'https://api.coinbase.com/v2/accounts?include_available_to_send=true&fetch_all=true' \
  -H 'Authorization: Bearer abd90df5f27a7b170cd775abf89d632b350b7c1c9d53e08b340cd9832ce52c2c'
```

```ruby Ruby  lines wrap theme={null}
require 'coinbase/wallet'
client = Coinbase::Wallet::Client.new(api_key: <api key>, api_secret: <api secret>)

accounts = client.accounts
```

```python Python  lines wrap theme={null}
import requests

# For instructions generating JWT, check the "API Key Authentication" section
JWT_TOKEN = "<your_jwt_token>"

# Coinbase API base URL
ENDPOINT_URL = "https://api.coinbase.com/v2/accounts"

def get_accounts():
    # Generate headers with JWT for authentication
    headers = {
        "Authorization": f"Bearer {JWT_TOKEN}"
    }

    # Make the API request
    response = requests.get(ENDPOINT_URL, headers=headers)

    return response.json()  # Return the JSON response

accounts = get_accounts()
print(accounts)
```

```javascript JavaScript  lines wrap theme={null}
var Client = require('coinbase').Client;

var client = new Client({'apiKey': 'API KEY',
                         'apiSecret': 'API SECRET'});

client.getAccounts({}, function(err, accounts) {
  console.log(accounts);
});
```

#### Response

```json [expandable] lines wrap theme={null}
{
  "pagination": {
    "ending_before": null,
    "starting_after": null,
    "limit": 25,
    "order": "desc",
    "previous_uri": null,
    "next_uri": null
  },
  "data": [
    {
      "id": "58542935-67b5-56e1-a3f9-42686e07fa40",
      "name": "My Vault",
      "primary": false,
      "type": "vault",
      "currency" : {
         "asset_id" : "5b71fc48-3dd3-540c-809b-f8c94d0e68b5",
         "code" : "BTC",
         "color" : "#F7931A",
         "exponent" : 8,
         "name" : "Bitcoin",
         "slug" : "bitcoin",
         "type" : "crypto"
      }
      "balance": {
        "amount": "4.00000000",
        "currency": "BTC"
      },
      "created_at": "2024-01-31T20:49:02Z",
      "updated_at": "2024-01-31T20:49:02Z",
      "resource": "account",
      "resource_path": "/v2/accounts/58542935-67b5-56e1-a3f9-42686e07fa40",
      "ready": true
    },
    {
      "id": "2bbf394c-193b-5b2a-9155-3b4732659ede",
      "name": "My Wallet",
      "primary": true,
      "type": "wallet",
      "currency" : {
         "asset_id" : "5b71fc48-3dd3-540c-809b-f8c94d0e68b5",
         "code" : "BTC",
         "color" : "#F7931A",
         "exponent" : 8,
         "name" : "Bitcoin",
         "slug" : "bitcoin",
         "type" : "crypto"
      }
      "balance": {
        "amount": "39.59000000",
        "currency": "BTC"
      },
      "created_at": "2024-01-31T20:49:02Z",
      "updated_at": "2024-01-31T20:49:02Z",
      "resource": "account",
      "resource_path": "/v2/accounts/2bbf394c-193b-5b2a-9155-3b4732659ede"
    },
    {
      "id": "8d5f2c4e-7a1b-5c3d-9e6f-0a1b2c3d4e5f",
      "name": "USDC Wallet",
      "primary": true,
      "type": "wallet",
      "currency": {
        "asset_id": "2b92315d-eab7-5bef-84fa-089a131333f5",
        "code": "USDC",
        "exponent": 6,
        "name": "USDC",
        "type": "crypto"
      },
      "balance": {
        "amount": "250.000000",
        "currency": "USDC"
      },
      "available_to_send": {
        "amount": "200.000000",
        "currency": "USDC"
      },
      "created_at": "2024-01-31T20:49:02Z",
      "updated_at": "2024-01-31T20:49:02Z",
      "resource": "account",
      "resource_path": "/v2/accounts/8d5f2c4e-7a1b-5c3d-9e6f-0a1b2c3d4e5f"
    },
    {
      "id": "6f2e1c3a-9b4d-5e7f-8a1b-2c3d4e5f6a7b",
      "name": "USDC Wallet",
      "primary": false,
      "type": "dex_wallet",
      "currency": {
        "asset_id": "2b92315d-eab7-5bef-84fa-089a131333f5",
        "code": "USDC",
        "exponent": 6,
        "name": "USDC",
        "type": "crypto"
      },
      "balance": {
        "amount": "25.000000",
        "currency": "USDC"
      },
      "created_at": "2026-10-15T16:00:00Z",
      "updated_at": "2026-10-15T16:00:00Z",
      "resource": "account",
      "resource_path": "/v2/accounts/6f2e1c3a-9b4d-5e7f-8a1b-2c3d4e5f6a7b"
    }
  ]
}
```

## Show Account

Show (or get) a current user's account. To access the primary account for a given currency, a currency string (e.g., `BTC` or `ETH`) can be used instead of the account ID in the URL.

### HTTP Request

`GET https://api.coinbase.com/v2/accounts/:account_id`

### Scopes

* `wallet:accounts:read`
* `coinbase:stablecoins:balance-read`

> [!NOTE]
>
> If your token has `coinbase:stablecoins:balance-read` but not `wallet:accounts:read`, you can only get stablecoin accounts. A request for any other account, by account ID or by currency (for example, `BTC`), returns `404 Not Found`.

### Arguments

| Parameter | Type | Required | Description |
| :- | :- | :- | :- |
| `include_available_to_send` | boolean | Optional | Include `available_to_send` on the account if it's eligible. Defaults to `false`. |

See [List Accounts](#list-accounts) for details on `available_to_send` and an example response that includes it.

Show Account returns any account the user granted, by ID, without `fetch_all`. Getting an account by currency (for example, `BTC`) returns only the user's primary Coinbase account for that currency.

### Examples

#### Request

```shell Shell  lines wrap theme={null}
curl https://api.coinbase.com/v2/accounts/2bbf394c-193b-5b2a-9155-3b4732659ede \
    -H 'Authorization: Bearer abd90df5f27a7b170cd775abf89d632b350b7c1c9d53e08b340cd9832ce52c2c'
```

```ruby Ruby  lines wrap theme={null}
require 'coinbase/wallet'
client = Coinbase::Wallet::Client.new(api_key: <api key>, api_secret: <api secret>)

account = client.account("2bbf394c-193b-5b2a-9155-3b4732659ede")
```

```python Python  lines wrap theme={null}
import requests

# For instructions generating JWT, check the "API Key Authentication" section
JWT_TOKEN = "<your_jwt_token>"

# Coinbase API base URL
ENDPOINT_URL = "https://api.coinbase.com/v2/accounts/:account_id"

def get_account():
    # Generate headers with JWT for authentication
    headers = {
        "Authorization": f"Bearer {JWT_TOKEN}"
    }

    # Make the API request
    response = requests.get(ENDPOINT_URL, headers=headers)

    return response.json()  # Return the JSON response

account = get_account()
print(account)
```

```javascript JavaScript  lines wrap theme={null}
var Client = require('coinbase').Client;

var client = new Client({'apiKey': 'API KEY',
                         'apiSecret': 'API SECRET'});

client.getAccount("2bbf394c-193b-5b2a-9155-3b4732659ede", function(err, account) {
  console.log(account);
});
```

#### Response

```json lines wrap theme={null}
{
  "data": {
    "id": "2bbf394c-193b-5b2a-9155-3b4732659ede",
    "name": "My Wallet",
    "primary": true,
    "type": "wallet",
      "currency" : {
         "asset_id" : "5b71fc48-3dd3-540c-809b-f8c94d0e68b5",
         "code" : "BTC",
         "color" : "#F7931A",
         "exponent" : 8,
         "name" : "Bitcoin",
         "slug" : "bitcoin",
         "type" : "crypto"
      }
    "balance": {
      "amount": "39.59000000",
      "currency": "BTC"
    },
    "created_at": "2024-01-31T20:49:02Z",
    "updated_at": "2024-01-31T20:49:02Z",
    "resource": "account",
    "resource_path": "/v2/accounts/2bbf394c-193b-5b2a-9155-3b4732659ede"
  }
}
```
