Skip to main content
The Coinbase Advanced Trade API gives you full programmatic control over order placement, letting you buy and sell crypto assets directly from your application. Whether you need to execute an immediate market order, set a precise limit price, or define a stop-limit trigger, a single POST /api/v3/brokerage/orders endpoint handles all order types through a flexible order_configuration object. This guide walks you through each step of the process and shows you concrete examples for the most common order types.

Prerequisites

Before placing orders, make sure you have:
  • A valid JWT token (see Authentication)
  • Sufficient funds in your Coinbase account for the order side and size
  • The correct product_id for the trading pair you want to trade (e.g., BTC-USD)

Place an order

1

Choose your product and side

Every order targets a specific trading pair called a product. Products follow the format BASE-QUOTE (e.g., BTC-USD, ETH-USDC). You can retrieve the full list of available products with GET /api/v3/brokerage/products.Along with the product, you must specify a side:For example, a BUY on BTC-USD spends US dollars to acquire Bitcoin; a SELL on BTC-USD sells Bitcoin for US dollars.
2

Choose your order type and set parameters

The order_configuration object determines the order type and its parameters. Each type uses a distinct key inside order_configuration:For market buys, use quote_size to specify how many dollars (or quote currency units) to spend. For market sells, use base_size to specify how much of the base asset to sell.
3

Submit POST /api/v3/brokerage/orders

Send a POST request to https://api.coinbase.com/api/v3/brokerage/orders with your JWT in the Authorization header and a JSON body containing at minimum:
  • client_order_id — a unique string you generate to identify this order
  • product_id — the trading pair
  • side — BUY or SELL
  • order_configuration — the order type object with its parameters
See the code examples below for market, limit, and stop-limit orders.
4

Handle the response and confirm your order ID

A successful response returns "success": true along with an order_id (a UUID assigned by Coinbase) and an order_configuration echo. Store the order_id — you will need it to query order status, cancel the order, or reconcile fills.If the request fails, the response body contains a preview_failure_reason or error_response field explaining why. See the Error handling section below for common error codes.

Code examples

Market buy order

A market buy executes immediately at the best available price. Use quote_size to specify the amount of quote currency (e.g., USD) you want to spend.

Limit sell order

A limit sell places an order on the order book that executes only when the market price reaches your specified limit_price or better. The order remains open until filled or cancelled (gtc = good-till-cancelled).

Stop-limit order

A stop-limit order triggers a limit order when the market reaches your stop_price. Use STOP_DIRECTION_STOP_UP to trigger on a price rise, or STOP_DIRECTION_STOP_DOWN to trigger on a price drop.

Success response

A successful POST /orders response looks like this:
Always generate a unique client_order_id for every order request. If a network timeout causes you to retry, submitting the same client_order_id will be rejected as a duplicate rather than creating a second order — protecting you from accidental double-fills.

Error handling

When "success": false or the HTTP status is 4xx, the response includes an error code you can use to diagnose the problem programmatically.
Before placing a large order, call GET /api/v3/brokerage/products/{product_id} to check the base_min_size, base_max_size, quote_increment, and base_increment fields. Submitting an order below the minimum size or with an incorrect increment is a common source of validation errors.