Brave API Docs

Brave API Docs

Official Brave Documents and API Reference

This API documentation is for use alongside the Brave Dashboard.

Introduction

The reference is your key to a comprehensive understanding of the Brave API.

The Brave Wealth API, structured around REST principles, uses predictable, resource-oriented URLs, accepts form-encoded request bodies, returns JSON-encoded responses, and adheres to standard HTTP protocols including response codes and authentication methods.

Interaction with the Brave API requires an API Key, which you can obtain by creating an account on our web application and visiting the App Token page. There is no test mode; all data interactions are in production.

The API is continuously enhanced with new versions and functionalities tailored to individual user needs. Access customized settings specific to your version of the API in the Brave Dashboard.

For further details, visit our website.

You need an API Key to interact with the Brave API. You can find an API Key by creating an account in the Brave Dashboard and going to the App Token page.

Authentication

The base URL to send all API requests is:

https://api.bravewealth.com

The Brave API uses API keys to authenticate requests. Manage your API keys by creating an account and accessing the App Token page on Brave Dashboard.

  • All API requests must be made over HTTPS.
  • API keys must be included in all requests for authentication.
  • Protect your API keys; do not expose them publicly in areas such as GitHub or client-side code.
  • Authentication to the API is performed via HTTP Basic Auth. Provide your API key as the basic auth username value. There is no need to provide a password.
  • For authentication, use the header Authorization: Bearer YOUR_API_KEY.

Status Codes

Brave API uses conventional HTTP response codes to indicate the success or failure of an API request.

In general these specifications are true:

  • Codes in the 2xx range indicate success.
  • Codes in the 4xx range indicate an error due to the information provided (e.g., a missing parameter).
  • Codes in the 5xx range indicate an error with Brave's servers.

HTTP Status Codes

Status Code
Status Text
Description
200
OK
Everything worked as expected.
400
Bad Request
The request failed, often due to missing a parameter.
401
Unauthorized
No valid API key provided.
402
Request Failed
The parameters were valid but the request failed.
403
Forbidden
The API key doesn’t have permissions to perform the request.
404
Not Found
The requested resource doesn’t exist.
405
Too Large
The request is too big to process at this time.
409
Conflict
The request conflicts with another request.
429
Too Many Requests
Too many requests hit the API too quickly.
500
Server Error
Something went wrong on Brave‘s end.
502
Bad Gateway
Something went wrong on Brave's end.
503
Service Unavailable
Something went wrong on Brave's end.
504
Gateway Timeout
Something went wrong on Brave's end.

HTTP Endpoints

HTTP method
Endpoint
GET
Get a list of exchanges
GET
Get real-time prices for a token
GET
Get market stats and statistics
GET
Download a CSV of historical prices
POST
Generate a historical backtest
POST
Generate a detailed report

Versioning

Our API versions are named for the date the version is released.

When Brave introduces changes to the API, we release a new, dated version to ensure a seamless transition and to prevent disruption to existing applications.

By default, requests made using tools like curl will operate under your account’s default API version, as set in the Brave Dashboard. You can override this by specifying a different version in the Version header. Setting the Version header is not required.

curl https://api.bravewealth.com/{YOUR_ENDPOINT} \
  -H "Authorization: Bearer secret_YOUR_API_KEY"
  -H "Version: 2024-04-20"

Webhook events will also utilize the API version associated with your account by default. You can set a different API version during endpoint creation to customize behavior.

To manage your API version, visit the Brave Dashboard. We recommend using API versioning to test new versions before fully transitioning, minimizing potential disruptions.

Exchanges

Brave is compatible with more than a dozen distinct crypto exchanges in the U.S. and globally. Some API endpoints, such as Ranks, Prices, and Tests, support multiple exchanges.

Generally, the default is Binance (id is set to 1), as they have the most tokens and the most open data policies. However, Binance doesn’t go as far back as other exchanges.

Here are the exchanges and their IDs:

ID
Exchange
Founded
Tokens
1
Binance
2017
350
2
Coinbase
2012
50
3
Bitfinex
2012
150
4
Bitstamp
2011
25
5
Kraken
2011
70
6
OKEX
2013
250
7
CEXIO
2013
40
8
Gemini
2015
40
9
Bittrex
2014
250
10
Poloniex
2014
100
11
Gateio
2013
180
12
HitBTC
2013
300
13
Mt. Gox
2010
1

Limitations

To maintain a uniform experience for all developers, the Brave API implements rate limits and basic size restrictions on requests, historical time periods, and token coverage limits. The rate limit for incoming requests considers the combined usage of all applications linked to your account.

Rate Limits

  • Rate-limited requests will return a "rate_limited" error code
  • HTTP response status 429 (Too Many Requests)

Token Limits

  • Token-limited requests will return a "token_forbidden" error code
  • HTTP response status 403 (Forbidden)

Data Limits

  • Data-limited requests will return a "data_forbidden" error code
  • HTTP response status 403 (Forbidden)

Brave Plans

Brave’s plans are intended for all users, from individual researchers to commercial enterprises.

The following table outlines the API request limits by plan:

Plan
Request/Mo
Tokens
Data Range
License
Free
10,000
1-20
1 year
Personal
Startup
100,000
1-100
5 years
Commercial
Growth
1,000,000
1-500
10 years
Commercial
Pro
10M+
Unlimited
Unlimited
Commercial
Pricing plans may change

We may adjust plans, rate limits and prices to balance for demand and reliability. View our Pricing page for our latest pricing information.

Get Ranks

Market capitalization, particularly for Bitcoin and other leading crypto, ranks among the most closely monitored statistics online, typically organized from the highest to the lowest market cap.

Get real-time rankings of crypto tokens with this GET endpoint:

/ranks

Parameters

  • sort (optional): Defines the sort order of the tokens.
    • Options: market_cap (default), price, 24h_change, 7d_change, 30d_change, 24h_vol
  • limit (optional): Defines the maximum number of results per query.
  • offset (optional): Specifies the starting point for data retrieval.
  • file (optional): Format of the returned data.
    • Options include: csv or json.

API Rules

  • Run a GET command for Ranks.
  • For stables, default is true (included).
  • For limit, max is 20 per request.

Response

Each price object includes the following fields:

{
  "rank": 1,
  "name": "Bitcoin",
  "symbol": "BTC",
  "price": "$65,111.10",
  "24h_change": "0.0136",
  "7d_change": "0.0104",
  "30d_change": "0.0185",
  "market_cap": "$1,281,906,417,658",
  "24h_vol": "$22,121,297,492",
  "ath": "$73,686.93",
  "percent_from_ath": "0.1200"
}

Get Stats

We track essential statistics on crypto market activity, including number of tokens, exchanges, market pairs, Bitcoin dominance, and sector-specific market caps.

Get real-time crypto market stats with this GET endpoint:

/stats

Parameters

  • file (optional): Format of the returned data.
    • Options include: csv or json.

Response

Each stats object includes the following fields:

{
	"data": {
		  "active_cryptos": 9685,
      "total_cryptos": 29174,
      "active_market_pairs": 81023,
      "active_exchanges": 748,
      "total_exchanges": 8333,
      "eth_dominance": 16.121135438807,
      "btc_dominance": 54.009805963326,
      "defi_market_cap": 88554041212.7765,
      "stablecoin_market_cap": 151395978129.17328,
      "total_market_cap": 2353525673766.3633,
      "altcoin_market_cap": 1082391024068.08,
      "last_updated": "2024-04-15T17:14:59.999Z"
	}
}

Get Prices

Get real-time and historical crypto pricing data with this GET endpoint:

/prices

Parameters

  • ticker (required): Specifies the cryptocurrency and currency pair, e.g., BTC/USD.
  • period (optional): Defines the aggregation period for the prices.
    • Options include: daily, weekly, monthly, yearly.
  • interval (optional): Specifies the number of days for which data is requested.
  • start_date (optional): Start date for the data retrieval, in Unix timestamp format.
  • end_date (optional): End date for the data retrieval, in Unix timestamp format.
  • current (optional): If set to true, returns the latest available price.
  • exchange (optional): Defines the exchange to use for price.
  • file (optional): Format of the returned data.
    • Options include: csv or json.

API Rules

  • Run a GET command for Prices.
  • By default, exchange is set to 1 for Binance; see Exchanges.
  • Use either the interval or period parameter, but not both.
  • If the current parameter is set to true, all other date-related parameters (interval, start_date, end_date) must not be included in the request, else they will be ignored.
  • Request Limits may apply based on your plan.
  • All dates must be in Unix Timestamp format.

Response

Each price object includes the following fields:

{
  "unix": "1669770000000",
  "date": "11/30/22 0:00",
  "symbol": "BTC/USD",
  "open": "69137.80416327",
  "high": "69849.18208480",
  "low": "68446.40608164",
  "close": "69849.18208480"
}

Get News

Get crypto-related news feeds with this GET endpoint:

/news

Parameters

  • query (optional): Filters the news by a keyword.
    • Accepted options: crypto (default), bitcoin, ethereum, solana, blockchain, defi, nfts, and web3.
  • sort (optional): Sort the list by popularity (default) or latest.
  • limit (optional): Defines the maximum number of results per query.
  • offset (optional): Specifies the starting point for data retrieval.

API Rules

  • Run a GET command for News.
  • For query, limit 1 per request.
  • For limit, limit is 10 per request.
  • Use the offset parameter to paginate through the database for more feeds.

Response

Example response showing the structure of news data:

{
    "total": 373,
    "offset": 0,
    "limit": 10,
    "query": "crypto",
    "sort": "popularity",
    "data": [
        {
            "id": "_joPepQ4OTzwPFhNl",
            "name": "Brave Crypto News",
            "rss_feed_url": "http://api.brave.com/feed/_joPepQ4OTzwPFhNl.xml",
            "description": "Latest updates in crypto news.",
            "icon": "https://example.com/icon.png",
            "feeds": [
                "cYVBYcpUEbgXfg9v",
                "tRB1VRwysSuwnHlJ",
                "tq7X9v2dKgkTre59"
            ]
        }
    ]
}

Get Feeds

The standard format for news articles is RSS (Really Simple Syndication), providing various elements such as: title, description, link, author, publication date, and media content.

Get specific RSS feeds with this GET endpoint:

/feeds/:feed_id

Parameters

  • feed_id (required): Enter the id of the RSS feed

API Rules

  • Run a GET command for Feeds.
  • For feed_id, get id from Get News endpoint (e.g., _joPepQ4OTzwPFhNl).
  • Limit 10 articles per feed; generate a new feed_id for additional items.

Response

Example response showing the structure of feed data:

<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:media="http://search.yahoo.com/mrss/">
    <channel>
        <title><![CDATA[Brave Crypto]]></title>
        <description><![CDATA[Comprehensive updates and insights from the crypto world.]]></description>
        <link>https://rss.app</link>
        <image>
            <url>https://rss.app/static/img/icons/rss-app.png</url>
            <title>Brave Crypto</title>
            <link>https://rss.app</link>
        </image>
        <generator>https://rss.app</generator>
        <lastBuildDate>Sat, 20 Apr 2024 21:30:41 GMT</lastBuildDate>
        <atom:link href="https://rss.app/feeds/_GBfPk0IQL5UU1k9u.xml" rel="self" type="application/rss+xml"/>
        <language><![CDATA[en]]></language>
        <item>
            <title><![CDATA[a16z snubs crypto, Mango Markets exploiter found guilty and Worldcoin launches blockchain network: Hodler’s Digest, April 14-20]]></title>
            <description><![CDATA[<div><img src="https://cointelegraph.com/magazine/wp-content/uploads/2024/04/april-20-scaled.jpg?v=1713646556" style="width: 100%;" /><div>The Cyprus SEC extends FTX Europe license suspension, a16z snubs crypto investment and Worldcoin launches blockchain: Hodler's Digest</div></div>]]></description>
            <link>https://cointelegraph.com/magazine/a16z-crypto-mango-markets-exploiter-guilty-worldcoin-blockchain-network-hodlers-digest/</link>
            <guid isPermaLink="false">537cd8bdb373eaa71db798514231ee6c</guid>
            <dc:creator><![CDATA[Cointelegraph Magazine]]></dc:creator>
            <pubDate>Sat, 20 Apr 2024 21:24:28 GMT</pubDate>
            <media:content medium="image" url="https://cointelegraph.com/magazine/wp-content/uploads/2024/04/april-20-scaled.jpg?v=1713646556"/>
        </item>
    </channel>
</rss>

Get Tests

The Analysis endpoint allows users to run historical backtests on specified assets with given weights, over different time periods and against various indices, and generate performance metrics.

Run backtest analysis with this POST endpoint:

/tests

Parameters

  • assets (required): Specifies the assets included in the backtest (e.g., BTC/SOL/USD).
  • weights (required): Assigns weights to the specified assets, formatted as a comma-separated list (e.g., 0.2,0.3,0.5).
  • period (optional): Defines the period for the price data used in the analysis.
    • Options include: daily, weekly, monthly, yearly.
  • start_date (optional): Start date for the data retrieval, in Unix timestamp format.
  • end_date (optional): End date for the data retrieval, in Unix timestamp format.
  • special_date (optional): Specific date range for data retrieval.
    • Options include: ytd, qtd, last_year, 2023, 2022, 2021, etc
  • yield (optional): Defines the interest rate for U.S. Dollars (if applicable).
  • index (optional): Specifies the market index against which the backtest is compared.
    • Options include: BTC (default), SPY, DJIA, NASDAQ, IAU, USD.

API Rules

  • Run a POST command for Analysis.
  • For index, max 1 benchmark (e.g., SPY).
  • For weight, must add up to 1 (e.g., 0.3,0.7).
  • For yield, default is Fed Funds Rate (e.g., 0.053).
  • For start_date and end_date, default is max time period.
  • If the special_date parameter is set, all other date-related parameters (interval, start_date, end_date) must not be included in the request, else they will be ignored.
  • ests with varying special_date (e.g., ytd, 2021, 2022, 2023 etc).
  • Request Limits may apply based on your plan.

Response

Example response showing the structure of analysis data:

{
    "query": {
        "assets": "BTC/SOL",
        "weights": "0.3,0.7"
        "special_date": "2021"
        "period": "daily",
        "index": "SPY"
    },
    "data": {
        "Beta": "0.49000000",
        "Performance": "0.59670000",
        "Sharpe Ratio": "0.90000000",
        "Standard-Deviation": "0.49060000",
        "Tracking Error": "0.50230000",
        "Information Ratio": "-0.00050000",
        "Treynor Ratio": "0.26050000",
        "Sortino Ratio": "2.01000000",
        "MaxDrawdown": "-0.39390000",
        "Capture Ratio": "1.60540000",
        "Up-Market Capt": "0.53430000",
        "Down-Market Capt": "0.33280000",
        "R2": "0.58000000"
    },
    "data_index": {
        "Beta": "0.49000000",
        "Performance": "0.28730000",
        "Sharpe Ratio": "0.90000000",
        "Standard-Deviation": "0.49060000",
        "Tracking Error": "0.50230000",
        "Information Ratio": "-0.00050000",
        "Treynor Ratio": "0.26050000",
        "Sortino Ratio": "2.01000000",
        "MaxDrawdown": "-0.39390000",
        "Capture Ratio": "1.60540000",
        "Up-Market Capt": "0.53430000",
        "Down-Market Capt": "0.33280000",
        "R2": "0.58000000"
    }
}

Changelog

Our latest version is 2024-04-18.

This changelog documents all updates and additions to the Brave API, presented in chronological order. For breaking changes and detailed steps on upgrading your Brave API version, please contact us.

April 18, 2024

  • Added functionality to retrieve real-time crypto prices via the Current Prices endpoint.
  • Introduced the Historical Prices endpoint, allowing users to fetch historical price data for crypto tokens.
  • Updated the Market Stats endpoint to include broad analyses of crypto market and environment.
  • Launched a new Backtesting feature, enabling users to test trading strategies with historical data.
  • Enhanced the Latest News endpoint to include more sources and real-time news updates.