cURL
curl --request POST \
--url https://drb.coinbase.com/api/v2/public/auth \
--header 'Content-Type: application/json' \
--data '
{
"grant_type": "coinbase_cdp",
"token": "<string>"
}
'import requests
url = "https://drb.coinbase.com/api/v2/public/auth"
payload = {
"grant_type": "coinbase_cdp",
"token": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({grant_type: 'coinbase_cdp', token: '<string>'})
};
fetch('https://drb.coinbase.com/api/v2/public/auth', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://drb.coinbase.com/api/v2/public/auth",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'grant_type' => 'coinbase_cdp',
'token' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://drb.coinbase.com/api/v2/public/auth"
payload := strings.NewReader("{\n \"grant_type\": \"coinbase_cdp\",\n \"token\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://drb.coinbase.com/api/v2/public/auth")
.header("Content-Type", "application/json")
.body("{\n \"grant_type\": \"coinbase_cdp\",\n \"token\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://drb.coinbase.com/api/v2/public/auth")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"grant_type\": \"coinbase_cdp\",\n \"token\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": 9929,
"jsonrpc": "2.0",
"result": {
"access_token": "a3f8c2e1d4b7f09e5c6a2d8b1e4f7c0a9d3b6e2f5a8c1d4e7b0f3a6c9d2e5f8",
"expires_in": 3600,
"scope": "wallet:user:read wallet:accounts:read wallet:transactions:read wallet:buys:create",
"token_type": "bearer"
}
}Authentication
public/auth
Authenticate using a Coinbase-issued credential.
Accepts both GET and POST. Use POST as best practice — your credential then travels in the request body, keeping it out of URLs, browser history, and access logs.
POST
/
public
/
auth
cURL
curl --request POST \
--url https://drb.coinbase.com/api/v2/public/auth \
--header 'Content-Type: application/json' \
--data '
{
"grant_type": "coinbase_cdp",
"token": "<string>"
}
'import requests
url = "https://drb.coinbase.com/api/v2/public/auth"
payload = {
"grant_type": "coinbase_cdp",
"token": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({grant_type: 'coinbase_cdp', token: '<string>'})
};
fetch('https://drb.coinbase.com/api/v2/public/auth', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://drb.coinbase.com/api/v2/public/auth",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'grant_type' => 'coinbase_cdp',
'token' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://drb.coinbase.com/api/v2/public/auth"
payload := strings.NewReader("{\n \"grant_type\": \"coinbase_cdp\",\n \"token\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://drb.coinbase.com/api/v2/public/auth")
.header("Content-Type", "application/json")
.body("{\n \"grant_type\": \"coinbase_cdp\",\n \"token\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://drb.coinbase.com/api/v2/public/auth")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"grant_type\": \"coinbase_cdp\",\n \"token\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": 9929,
"jsonrpc": "2.0",
"result": {
"access_token": "a3f8c2e1d4b7f09e5c6a2d8b1e4f7c0a9d3b6e2f5a8c1d4e7b0f3a6c9d2e5f8",
"expires_in": 3600,
"scope": "wallet:user:read wallet:accounts:read wallet:transactions:read wallet:buys:create",
"token_type": "bearer"
}
}Body
application/json
Was this page helpful?
⌘I