Skip to main content
POST
/
reports
Create a report
curl --request POST \
  --url https://api.exchange.coinbase.com/reports \
  --header 'Content-Type: application/json' \
  --header 'cb-access-key: <api-key>' \
  --header 'cb-access-passphrase: <api-key>' \
  --header 'cb-access-sign: <api-key>' \
  --header 'cb-access-timestamp: <api-key>' \
  --data '
{
  "type": "account",
  "format": "pdf",
  "email": "user1@example.com",
  "profile_id": "8058d771-2d88-4f0f-ab6e-299c153d4308",
  "account": {
    "start_date": "2020-02-25T03:11:42.164Z",
    "end_date": "2020-03-26T02:11:42.164Z",
    "account_id": "ALL"
  }
}
'
import requests

url = "https://api.exchange.coinbase.com/reports"

payload = {
"type": "account",
"format": "pdf",
"email": "user1@example.com",
"profile_id": "8058d771-2d88-4f0f-ab6e-299c153d4308",
"account": {
"start_date": "2020-02-25T03:11:42.164Z",
"end_date": "2020-03-26T02:11:42.164Z",
"account_id": "ALL"
}
}
headers = {
"cb-access-key": "<api-key>",
"cb-access-passphrase": "<api-key>",
"cb-access-sign": "<api-key>",
"cb-access-timestamp": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {
'cb-access-key': '<api-key>',
'cb-access-passphrase': '<api-key>',
'cb-access-sign': '<api-key>',
'cb-access-timestamp': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
type: 'account',
format: 'pdf',
email: 'user1@example.com',
profile_id: '8058d771-2d88-4f0f-ab6e-299c153d4308',
account: {
start_date: '2020-02-25T03:11:42.164Z',
end_date: '2020-03-26T02:11:42.164Z',
account_id: 'ALL'
}
})
};

fetch('https://api.exchange.coinbase.com/reports', 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://api.exchange.coinbase.com/reports",
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([
'type' => 'account',
'format' => 'pdf',
'email' => 'user1@example.com',
'profile_id' => '8058d771-2d88-4f0f-ab6e-299c153d4308',
'account' => [
'start_date' => '2020-02-25T03:11:42.164Z',
'end_date' => '2020-03-26T02:11:42.164Z',
'account_id' => 'ALL'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"cb-access-key: <api-key>",
"cb-access-passphrase: <api-key>",
"cb-access-sign: <api-key>",
"cb-access-timestamp: <api-key>"
],
]);

$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://api.exchange.coinbase.com/reports"

payload := strings.NewReader("{\n \"type\": \"account\",\n \"format\": \"pdf\",\n \"email\": \"user1@example.com\",\n \"profile_id\": \"8058d771-2d88-4f0f-ab6e-299c153d4308\",\n \"account\": {\n \"start_date\": \"2020-02-25T03:11:42.164Z\",\n \"end_date\": \"2020-03-26T02:11:42.164Z\",\n \"account_id\": \"ALL\"\n }\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("cb-access-key", "<api-key>")
req.Header.Add("cb-access-passphrase", "<api-key>")
req.Header.Add("cb-access-sign", "<api-key>")
req.Header.Add("cb-access-timestamp", "<api-key>")
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://api.exchange.coinbase.com/reports")
.header("cb-access-key", "<api-key>")
.header("cb-access-passphrase", "<api-key>")
.header("cb-access-sign", "<api-key>")
.header("cb-access-timestamp", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"account\",\n \"format\": \"pdf\",\n \"email\": \"user1@example.com\",\n \"profile_id\": \"8058d771-2d88-4f0f-ab6e-299c153d4308\",\n \"account\": {\n \"start_date\": \"2020-02-25T03:11:42.164Z\",\n \"end_date\": \"2020-03-26T02:11:42.164Z\",\n \"account_id\": \"ALL\"\n }\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.exchange.coinbase.com/reports")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["cb-access-key"] = '<api-key>'
request["cb-access-passphrase"] = '<api-key>'
request["cb-access-sign"] = '<api-key>'
request["cb-access-timestamp"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"account\",\n \"format\": \"pdf\",\n \"email\": \"user1@example.com\",\n \"profile_id\": \"8058d771-2d88-4f0f-ab6e-299c153d4308\",\n \"account\": {\n \"start_date\": \"2020-02-25T03:11:42.164Z\",\n \"end_date\": \"2020-03-26T02:11:42.164Z\",\n \"account_id\": \"ALL\"\n }\n}"

response = http.request(request)
puts response.read_body
{
  "id": "<string>",
  "type": "<string>",
  "status": "pending"
}
{
"message": "<string>"
}
{
"message": "<string>"
}
Reports provide batches of historic information about your profile in various human and machine readable forms.
A report is generated when resources are available. You can poll the report resource endpoint at /reports/{report_id} for its status. When status is ready, the final report is uploaded and available at {file_url}.

API Key Permissions

This endpoint requires either the “view” or “trade” permission.

Expired reports

Reports are only available for download for a few days after being created. Once a report expires, the report is no longer available for download and is deleted.

Balance Reports

Balance statements represent historical or current point-in-time “snapshots” in native and fiat converted units. Balance statement reports:
  • Can be generated for a specific portfolio (API and UI) or all portfolios (UI only). In the UI, all portfolios can be grouped by portfolio or asset (with balances totaled across portfolios).
  • Include balances for crypto and fiat assets supported on the Exchange (USD, EUR, GBP).
  • Include balances in both native units (e.g., 1 BTC) as well as fiat-converted units assets (e.g., $20000 USD worth of BTC) where price data is available.
  • Are generated for all assets (crypto and fiat) in the user’s account as of the requested timestamp. They cannot be generated for a specific asset (as is possible with the account and fill reports).
API calls are tied to a specific portfolio but you can group by all portfolios in the UI.

Timestamps

  • Range: Timestamps are UTC-exclusive. For example, to generate a balance as of December 31st, 2022 EOD UTC (11:59:59 PM UTC), input January 1st, 2023 12:00:00 AM UTC.
  • Granularity: The API is the most granular and lets you specify a timestamp to the very second. The UI lets you specify the day and hour.

Fiat Conversion

  • For fiat balances (USD, EUR, GBP), the conversion price is 1:1 and is reported in that specific fiat currency. EUR/GBP is not converted to USD balance.
  • For crypto balances the conversion price is the volume weighted average of closing prices in USD (when available). It is calculated by fetching 1 hour candles between [t-24 hours to t] and taking a volume weighted average of the closing price of the candles (when available).
    • Requested timestamp = t; Start range = t - 24 hours; End range = t
    • Candles may not be available; e.g., delisted assets may not have candles at the requested timestamp.
    • If a USD pair is not listed for trading at the requested timestamp, fiat conversion is not possible.

Request Details

The Balance Report API:
  • Leverages the existing /reports endpoint.
  • Adds a new report type of balance.
  • Adds a balance object to the request with datetime (and group_by_portfolio_id for the UI only).
  • Keeps the same response schema (with the possibility that "type"="balance").
Example of Balance Report API Request
// Create balance statement for the portfolio tied to the API key
{
  "balance": {
    "datetime": "2022-02-25T05:00:00.000Z"
  },
  "email": "user1@example.com",
  "format": "csv",
  "type": "balance"
}

Authorizations

cb-access-key
string
header
required
cb-access-passphrase
string
header
required
cb-access-sign
string
header
required
cb-access-timestamp
string
header
required

Body

application/json
type
string
required

Type of report to generate. Possible values: [account, balance, fills, otc-fills, rfq-fills, tax-invoice, 1099k-transaction-history]

year
string

required for 1099k-transaction-history-type reports

format
enum<string>
default:pdf
Available options:
pdf,
csv
email
string

Email to send generated report notification to

profile_id
string

If this field is specified, it must be the profile_id that is linked to the API key.

balance
object
fills
object
account
object
otc_fills
object
tax_invoice
object
rfq_fills
object

Response

id
string
required
type
string
required
status
enum<string>
default:pending
required
Available options:
pending