Guides
DocumentationLog In

Accounts

Account resource

Account resource represents all of a user's accounts, including bitcoin, bitcoin cash, litecoin and ethereum wallets, fiat currency accounts, and vaults. This is represented in the type field. It's important to note that new types can be added over time so you want to make sure this won't break your implementation.

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

FieldsDescription
id stringResource ID
name stringUser or system defined name
primary booleanPrimary account
type string, enumerableAccount's type. Available values: wallet, fiat, vault
currency stringAccount's currency
balance money hashBalance in BTC or ETH
created_at timestamp
updated_at timestamp
resource string, constant account
resource_path string

Account resource

{
  "id": "2bbf394c-193b-5b2a-9155-3b4732659ede",
  "name": "My Wallet",
  "primary": true,
  "type": "wallet",
  "currency": "BTC",
  "balance": {
      "amount": "39.59000000",
      "currency": "BTC"
  },
  "created_at": "2015-01-31T20:49:02Z",
  "updated_at": "2015-01-31T20:49:02Z",
  "resource": "account",
  "resource_path": "/v2/accounts/2bbf394c-193b-5b2a-9155-3b4732659ede"
}

List accounts

Lists 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
curl https://api.coinbase.com/v2/accounts \
  -H 'Authorization: Bearer abd90df5f27a7b170cd775abf89d632b350b7c1c9d53e08b340cd9832ce52c2c'
require 'coinbase/wallet'
client = Coinbase::Wallet::Client.new(api_key: <api key>, api_secret: <api secret>)

accounts = client.accounts
from coinbase.wallet.client import Client
client = Client(<api_key>, <api_secret>)

accounts = client.get_accounts()
var Client = require('coinbase').Client;

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

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

Example response

{
  "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": "BTC",
      "balance": {
        "amount": "4.00000000",
        "currency": "BTC"
      },
      "created_at": "2015-01-31T20:49:02Z",
      "updated_at": "2015-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": "BTC",
      "balance": {
        "amount": "39.59000000",
        "currency": "BTC"
      },
      "created_at": "2015-01-31T20:49:02Z",
      "updated_at": "2015-01-31T20:49:02Z",
      "resource": "account",
      "resource_path": "/v2/accounts/2bbf394c-193b-5b2a-9155-3b4732659ede"
    }
  ]
}

Show an account

Show current user's account. To access the primary account for a given currency, a currency string (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
curl https://api.coinbase.com/v2/accounts/2bbf394c-193b-5b2a-9155-3b4732659ede \
    -H 'Authorization: Bearer abd90df5f27a7b170cd775abf89d632b350b7c1c9d53e08b340cd9832ce52c2c'
require 'coinbase/wallet'
client = Coinbase::Wallet::Client.new(api_key: <api key>, api_secret: <api secret>)

account = client.account("2bbf394c-193b-5b2a-9155-3b4732659ede")
from coinbase.wallet.client import Client
client = Client(<api_key>, <api_secret>)

account = client.get_account("2bbf394c-193b-5b2a-9155-3b4732659ede")
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);
});

Example response

{
  "data": {
    "id": "2bbf394c-193b-5b2a-9155-3b4732659ede",
    "name": "My Wallet",
    "primary": true,
    "type": "wallet",
    "currency": "BTC",
    "balance": {
      "amount": "39.59000000",
      "currency": "BTC"
    },
    "created_at": "2015-01-31T20:49:02Z",
    "updated_at": "2015-01-31T20:49:02Z",
    "resource": "account",
    "resource_path": "/v2/accounts/2bbf394c-193b-5b2a-9155-3b4732659ede"
  }
}

Update account

Modifies user's account.

HTTP Request

PUT https://api.coinbase.com/v2/accounts/:account_id

Scopes

  • wallet:accounts:update

Arguments

ParameterTypeRequiredDescription
namestringOptionalAccount name

Example request

curl https://api.coinbase.com/v2/accounts/82de7fcd-db72-5085-8ceb-bee19303080b \
  -X PUT
  -H 'Content-Type: application/json'
  -H 'Authorization: Bearer abd90df5f27a7b170cd775abf89d632b350b7c1c9d53e08b340cd9832ce52c2c'
  -d '{"name": "New account name"}'
require 'coinbase/wallet'
client = Coinbase::Wallet::Client.new(api_key: <api key>, api_secret: <api secret>)

account = client.update_account('82de7fcd-db72-5085-8ceb-bee19303080b',
                                {name: 'New account name'})
from coinbase.wallet.client import Client
client = Client(<api_key>, <api_secret>)

account = client.update_account('82de7fcd-db72-5085-8ceb-bee19303080b',
                                name='New account name')
var Client = require('coinbase').Client;

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

client.getAccount('82de7fcd-db72-5085-8ceb-bee19303080b', function(err, account) {
  account.update({'name': 'New account name'}, function(err, acct) {
    console.log(acct);
  });
});

Response (200)

{
  "data": {
    "id": "82de7fcd-db72-5085-8ceb-bee19303080b",
    "name": "New account name",
    "primary": false,
    "type": "wallet",
    "currency": "BTC",
    "balance": {
      "amount": "0.00000000",
      "currency": "BTC"
    },
    "created_at": "2015-03-31T15:21:58-07:00",
    "updated_at": "2015-03-31T15:21:58-07:00",
    "resource": "account",
    "resource_path": "/v2/accounts/82de7fcd-db72-5085-8ceb-bee19303080b"
  }
}

Delete account

Removes user's account. In order to remove an account it can't be:

  • Primary account
  • Account with non-zero balance
  • Fiat account
  • Vault with a pending withdrawal

HTTP Request

DELETE https://api.coinbase.com/v2/accounts/:account_id

Scopes

  • wallet:accounts:delete

Example request

curl https://api.coinbase.com/v2/accounts/82de7fcd-db72-5085-8ceb-bee19303080b \
  -X DELETE
  -H 'Authorization: Bearer abd90df5f27a7b170cd775abf89d632b350b7c1c9d53e08b340cd9832ce52c2c'
require 'coinbase/wallet'
client = Coinbase::Wallet::Client.new(api_key: <api key>, api_secret: <api secret>)

account = client.delete_account('82de7fcd-db72-5085-8ceb-bee19303080b')
from coinbase.wallet.client import Client
client = Client(<api_key>, <api_secret>)

account = client.delete_account('82de7fcd-db72-5085-8ceb-bee19303080b')
var Client = require('coinbase').Client;

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

client.getAccount('82de7fcd-db72-5085-8ceb-bee19303080b', function(err, account) {
  account.delete(function(err, resp) {
    console.log(resp);
  });
});

Response (204 No Content)