Guides
DocumentationLog In

Sells

Sell resource

Sell resource represents any Coinbase supported asset using a payment method (either a bank or a fiat account). Each committed sell also has an associated transaction.

Sells can be started with commit: false which is useful when displaying the confirmation for a sell. These sells will never complete and receive an associated transaction unless they are committed separately.

ParameterDescription
id stringResource ID
status string, enumerableStatus of the sell. Valid values: created, completed, canceled
payment_method hashAssociated payment method (e.g., a bank, fiat account)
transaction hashAssociated transaction (e.g., a bank, fiat account)
amount money hashAmount of any supported asset
total money hashFiat amount with fees
subtotal money hashFiat amount without fees
fee money hashFees associated to this sell
created_at timestamp
updated_at timestamp
resource string, constant sell
resource_path string
committed booleanHas this sell been committed?
instant booleanWas this sell executed instantly?
payout_at timestamp, optionalWhen a sell isn't executed instantly, it receives a payout date for the time it will be executed

Example sell resource

{
  "id": "67e0eaec-07d7-54c4-a72c-2e92826897df",
  "status": "completed",
  "payment_method": {
    "id": "83562370-3e5c-51db-87da-752af5ab9559",
    "resource": "payment_method",
    "resource_path": "/v2/payment-methods/83562370-3e5c-51db-87da-752af5ab9559"
  },
  "transaction": {
    "id": "441b9494-b3f0-5b98-b9b0-4d82c21c252a",
    "resource": "transaction",
    "resource_path": "/v2/accounts/2bbf394c-193b-5b2a-9155-3b4732659ede/transactions/441b9494-b3f0-5b98-b9b0-4d82c21c252a"
  },
  "amount": {
    "amount": "1.00000000",
    "currency": "BTC"
  },
  "total": {
    "amount": "9.75",
    "currency": "USD"
  },
  "subtotal": {
    "amount": "9.90",
    "currency": "USD"
  },
  "created_at": "2015-01-31T20:49:02Z",
  "updated_at": "2015-02-11T16:54:02-08:00",
  "resource": "sell",
  "resource_path": "/v2/accounts/2bbf394c-193b-5b2a-9155-3b4732659ede/sells/67e0eaec-07d7-54c4-a72c-2e92826897df",
  "committed": true,
  "instant": false,
  "fee": {
    "amount": "0.15",
    "currency": "USD"
  },
  "payout_at": "2015-02-18T16:54:00-08:00"
}

List sells

Lists sells for an account.

HTTP Request

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

Scopes

  • wallet:sells:read

Example request

curl https://api.coinbase.com/v2/accounts/2bbf394c-193b-5b2a-9155-3b4732659ede/sells /
  -H 'Authorization: Bearer abd90df5f27a7b170cd775abf89d632b350b7c1c9d53e08b340cd9832ce52c2c'
require 'coinbase/wallet'
client = Coinbase::Wallet::Client.new(api_key: <api key>, api_secret: <api secret>)

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

txs = client.get_sells('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) {
  account.getSells(function(err, txs) {
    console.log(txs);
  });
});

Example response

{
  "pagination": {
    "ending_before": null,
    "starting_after": null,
    "limit": 25,
    "order": "desc",
    "previous_uri": null,
    "next_uri": null
  },
  "data": [
    {
      "id": "9e14d574-30fa-5d85-b02c-6be0d851d61d",
      "status": "created",
      "payment_method": {
        "id": "83562370-3e5c-51db-87da-752af5ab9559",
        "resource": "payment_method",
        "resource_path": "/v2/payment-methods/83562370-3e5c-51db-87da-752af5ab9559"
      },
      "transaction": {
        "id": "4117f7d6-5694-5b36-bc8f-847509850ea4",
        "resource": "transaction",
        "resource_path": "/v2/accounts/2bbf394c-193b-5b2a-9155-3b4732659ede/transactions/4117f7d6-5694-5b36-bc8f-847509850ea4"
      },
      "amount": {
        "amount": "10.00000000",
        "currency": "BTC"
      },
      "total": {
        "amount": "98.01",
        "currency": "USD"
      },
      "subtotal": {
        "amount": "99.00",
        "currency": "USD"
      },
      "created_at": "2015-03-26T23:43:59-07:00",
      "updated_at": "2015-03-26T23:44:09-07:00",
      "resource": "sell",
      "resource_path": "/v2/accounts/2bbf394c-193b-5b2a-9155-3b4732659ede/sells/9e14d574-30fa-5d85-b02c-6be0d851d61d",
      "committed": true,
      "instant": false,
      "fee": {
        "amount": "10.1",
        "currency": "USD"
      },
      "payout_at": "2015-04-01T23:43:59-07:00"
    }
  ]
}

Show a sell

Show an individual sell.

HTTP Request

GET https://api.coinbase.com/v2/accounts/:account_id/sells/:sell_id

Scopes

  • wallet:sells:read

Example request

curl https://api.coinbase.com/v2/accounts/2bbf394c-193b-5b2a-9155-3b4732659ede/sells/dd3183eb-af1d-5f5d-a90d-cbff946435ff /
  -H 'Authorization: Bearer abd90df5f27a7b170cd775abf89d632b350b7c1c9d53e08b340cd9832ce52c2c'
require 'coinbase/wallet'
client = Coinbase::Wallet::Client.new(api_key: <api key>, api_secret: <api secret>)

sell = client.list_sell('2bbf394c-193b-5b2a-9155-3b4732659ede',
                        'dd3183eb-af1d-5f5d-a90d-cbff946435ff')
from coinbase.wallet.client import Client
client = Client(<api_key>, <api_secret>)

sell = client.get_sell('2bbf394c-193b-5b2a-9155-3b4732659ede',
                       'dd3183eb-af1d-5f5d-a90d-cbff946435ff')
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) {
  account.getSell('dd3183eb-af1d-5f5d-a90d-cbff946435ff', function(err, tx) {
    console.log(tx);
  });
});

Example response

{
  "data": {
    "id": "9e14d574-30fa-5d85-b02c-6be0d851d61d",
    "status": "created",
    "payment_method": {
      "id": "83562370-3e5c-51db-87da-752af5ab9559",
      "resource": "payment_method",
      "resource_path": "/v2/payment-methods/83562370-3e5c-51db-87da-752af5ab9559"
    },
    "transaction": {
      "id": "4117f7d6-5694-5b36-bc8f-847509850ea4",
      "resource": "transaction",
      "resource_path": "/v2/accounts/2bbf394c-193b-5b2a-9155-3b4732659ede/transactions/4117f7d6-5694-5b36-bc8f-847509850ea4"
    },
    "amount": {
      "amount": "10.00000000",
      "currency": "BTC"
    },
    "total": {
      "amount": "98.01",
      "currency": "USD"
    },
    "subtotal": {
      "amount": "99.00",
      "currency": "USD"
    },
    "created_at": "2015-03-26T23:43:59-07:00",
    "updated_at": "2015-03-26T23:44:09-07:00",
    "resource": "sell",
    "resource_path": "/v2/accounts/2bbf394c-193b-5b2a-9155-3b4732659ede/buys/9e14d574-30fa-5d85-b02c-6be0d851d61d",
    "committed": true,
    "instant": false,
    "fee": {
      "amount": "10.1",
      "currency": "USD"
    },
    "payout_at": "2015-04-01T23:43:59-07:00"
  }
}

Place sell order

Sells a user-defined amount of any Coinbase supported asset.

You can define sell amounts with either the amount or total parameter:

  • amount sells the amount in the defined asset. It's recommended that you use a cryptocurrency as the currency value, but if you specify a fiat currency, the amount is converted.

  • total credits the defined total value, and after fees are taken out, sells the remaining amount of the defined asset. It's recommended that you use the currency of the payment method as the currency parameter, but if you specify a different currency, the amount is converted.

Given the price of digital currency depends on the time of the call and amount of the sell, it's recommended to use the commit: false parameter to create an uncommitted sell to get a quote and then to commit that with a separate request.

If you need to query the sell price without locking in the sell, you can use quote: true option. This returns an unsaved sell and unlike commit: false, this sell can't be completed. This option is useful when you need to show the detailed sell price quote for the user when they are filling a form or similar situation.

HTTP Request

POST https://api.coinbase.com/v2/accounts/:account_id/sells

Scopes

  • wallet:sells:create

Arguments

ParameterTypeRequiredDescription
amountstringRequiredSell amount
totalstringOptionalSell amount with fees (alternative to amount)
currencystringRequiredCurrency for the amount
payment_methodstringOptionalID of the payment method for the sell. Payment methods can be listed using the GET /payment-methods API call
agree_btc_amount_variesbooleanOptionalWhether or not you would still like to sell if you have to wait for your money to arrive to lock in a price
commitbooleanOptionalIf false, this sell will not be immediately completed. Use the commit call to complete it. Default value: true
quotebooleanOptionalIf true, response will return an unsave sell for detailed price quote. Default value: false

Example request

curl https://api.coinbase.com/v2/accounts/82de7fcd-db72-5085-8ceb-bee19303080b/sells /
  -X POST \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer abd90df5f27a7b170cd775abf89d632b350b7c1c9d53e08b340cd9832ce52c2c' \
  -d '{
    "amount": "10",
    "currency": "BTC",
    "payment_method": "83562370-3e5c-51db-87da-752af5ab9559"
  }'
require 'coinbase/wallet'
client = Coinbase::Wallet::Client.new(api_key: <api key>, api_secret: <api secret>)

sell = client.sell('2bbf394c-193b-5b2a-9155-3b4732659ede',
                   {"amount" => "10",
                    "currency" => "BTC",
                    "payment_method" => "83562370-3e5c-51db-87da-752af5ab9559"})
from coinbase.wallet.client import Client
client = Client(<api_key>, <api_secret>)

sell = client.sell('2bbf394c-193b-5b2a-9155-3b4732659ede',
                   amount="10",
                   currency="BTC",
                   payment_method="83562370-3e5c-51db-87da-752af5ab9559")
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) {
  account.sell({"amount": "10",
                "currency": "BTC",
                "payment_method": "83562370-3e5c-51db-87da-752af5ab9559"}, function(err, tx) {
    console.log(tx);
  });
});

Response (201)

{
  "data": {
    "id": "a333743d-184a-5b5b-abe8-11612fc44ab5",
    "status": "created",
    "payment_method": {
      "id": "83562370-3e5c-51db-87da-752af5ab9559",
      "resource": "payment_method",
      "resource_path": "/v2/payment-methods/83562370-3e5c-51db-87da-752af5ab9559"
    },
    "transaction": {
      "id": "763d1401-fd17-5a18-852a-9cca5ac2f9c0",
      "resource": "transaction",
      "resource_path": "/v2/accounts/2bbf394c-193b-5b2a-9155-3b4732659ede/transactions/763d1401-fd17-5a18-852a-9cca5ac2f9c0"
    },
    "amount": {
      "amount": "10.00000000",
      "currency": "BTC"
    },
    "total": {
      "amount": "98.01",
      "currency": "USD"
    },
    "subtotal": {
      "amount": "99.00",
      "currency": "USD"
    },
    "created_at": "2015-04-01T18:43:37-07:00",
    "updated_at": "2015-04-01T18:43:37-07:00",
    "resource": "sell",
    "resource_path": "/v2/accounts/2bbf394c-193b-5b2a-9155-3b4732659ede/sells/a333743d-184a-5b5b-abe8-11612fc44ab5",
    "committed": true,
    "instant": false,
    "fee": {
      "amount": "10.1",
      "currency": "USD"
    },
    "payout_at": "2015-04-07T18:43:37-07:00"
  }
}

Commit a sell

Completes a sell that is created in commit: false state.

If the exchange rate has changed since the sell was created, this call will fail with the error “The exchange rate updated while you were waiting. The new total is shown below”.

The sell's total will also be updated. You can repeat the /commit call to accept the new values and commit the sell at the new rates.

HTTP Request

POST https://api.coinbase.com/v2/accounts/:account_id/sells/:sell_id/commit

Scopes

  • wallet:sells:create

Arguments

None

Example request

curl https://api.coinbase.com/v2/accounts/82de7fcd-db72-5085-8ceb-bee19303080b/sells/a333743d-184a-5b5b-abe8-11612fc44ab5/commit \
  -X POST \
  -H 'Authorization: Bearer abd90df5f27a7b170cd775abf89d632b350b7c1c9d53e08b340cd9832ce52c2c'
require 'coinbase/wallet'
client = Coinbase::Wallet::Client.new(api_key: <api key>, api_secret: <api secret>)

sell = client.commit_sell('2bbf394c-193b-5b2a-9155-3b4732659ede',
                          'a333743d-184a-5b5b-abe8-11612fc44ab5')
from coinbase.wallet.client import Client
client = Client(<api_key>, <api_secret>)

sell = client.commit_sell('2bbf394c-193b-5b2a-9155-3b4732659ede',
                          'a333743d-184a-5b5b-abe8-11612fc44ab5')
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) {
  account.getSell('a333743d-184a-5b5b-abe8-11612fc44ab5', function(err, tx) {
    tx.commit(function(err, resp) {
      console.log(resp);
    });
  });
});

Response (200)

{
  "data": {
    "id": "a333743d-184a-5b5b-abe8-11612fc44ab5",
    "status": "created",
    "payment_method": {
      "id": "83562370-3e5c-51db-87da-752af5ab9559",
      "resource": "payment_method",
      "resource_path": "/v2/payment-methods/83562370-3e5c-51db-87da-752af5ab9559"
    },
    "transaction": {
      "id": "763d1401-fd17-5a18-852a-9cca5ac2f9c0",
      "resource": "transaction",
      "resource_path": "/v2/accounts/2bbf394c-193b-5b2a-9155-3b4732659ede/transactions763d1401-fd17-5a18-852a-9cca5ac2f9c0"
    },
    "amount": {
      "amount": "10.00000000",
      "currency": "BTC"
    },
    "total": {
      "amount": "98.01",
      "currency": "USD"
    },
    "subtotal": {
      "amount": "99.00",
      "currency": "USD"
    },
    "created_at": "2015-04-01T18:43:37-07:00",
    "updated_at": "2015-04-01T18:43:37-07:00",
    "resource": "sell",
    "resource_path": "/v2/accounts/2bbf394c-193b-5b2a-9155-3b4732659ede/sells/a333743d-184a-5b5b-abe8-11612fc44ab5",
    "committed": true,
    "instant": false,
    "fee": {
      "amount": "10.1",
      "currency": "USD"
    },
    "payout_at": "2015-04-07T18:43:37-07:00"
  }
}