Coinbase Advanced Trade API
api.coinbase.com · Finance
Coinbase exchange API — real-time market data, portfolio management, order execution, and fills. Public market data requires no auth. Trading requires API key.
Authentication
API Key
Free API key from coinbase.com/settings/api. Pass as CB-ACCESS-KEY header. Requires HMAC signature for private endpoints.
Sample Requests
GET
Get BTC-USD price
Get current BTC-USD price and volume. No auth needed.
https://api.coinbase.com/api/v3/brokerage/market/products/BTC-USD/ticker
Hover any highlighted part to learn what it does
curl -X GET "https://api.coinbase.com/api/v3/brokerage/market/products/BTC-USD/ticker"
import requests
response = requests.get(
"https://api.coinbase.com/api/v3/brokerage/market/products/BTC-USD/ticker",
)
print(response.json())const url = 'https://api.coinbase.com/api/v3/brokerage/market/products/BTC-USD/ticker'; const response = await fetch(url); const data = await response.json(); console.log(data);
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
targetURL := "https://api.coinbase.com/api/v3/brokerage/market/products/BTC-USD/ticker"
req, _ := http.NewRequest("GET", targetURL, nil)
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://api.coinbase.com/api/v3/brokerage/market/products/BTC-USD/ticker")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Get.new(uri)
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://api.coinbase.com/api/v3/brokerage/market/products/BTC-USD/ticker";
$opts = ["http" => [
"method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));
GET
List products
List available trading pairs.
https://api.coinbase.com/api/v3/brokerage/market/products?limit=5&product_type=SPOT
Hover any highlighted part to learn what it does
curl -X GET "https://api.coinbase.com/api/v3/brokerage/market/products?limit=5&product_type=SPOT"
import requests
params = {
"limit": "5",
"product_type": "SPOT"
}
response = requests.get(
"https://api.coinbase.com/api/v3/brokerage/market/products",
params=params,
)
print(response.json())const url = new URL('https://api.coinbase.com/api/v3/brokerage/market/products');
url.searchParams.set('limit', '5');
url.searchParams.set('product_type', 'SPOT');
const response = await fetch(url);
const data = await response.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
baseURL, _ := url.Parse("https://api.coinbase.com/api/v3/brokerage/market/products")
q := baseURL.Query()
q.Set("limit", "5")
q.Set("product_type", "SPOT")
baseURL.RawQuery = q.Encode()
targetURL := baseURL.String()
req, _ := http.NewRequest("GET", targetURL, nil)
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://api.coinbase.com/api/v3/brokerage/market/products")
uri.query = URI.encode_www_form({
"limit" => "5",
"product_type" => "SPOT"
})
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Get.new(uri)
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://api.coinbase.com/api/v3/brokerage/market/products?" . http_build_query([
"limit" => "5",
"product_type" => "SPOT"
]);
$opts = ["http" => [
"method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));Postman Setup Guide
- Public market data needs no API key
- GET https://api.coinbase.com/api/v3/brokerage/market/products/BTC-USD/ticker
- For trading: get API key from coinbase.com/settings/api
- Private endpoints need HMAC-SHA256 signature — see docs for signing details
- Sandbox: use api-sandbox.coinbase.com (requires separate sandbox account)