January 3, 2024
Does Coinbase have an API?
Yes! Coinbase has an API that covers trading functions, such as order placement and account access, and offers market data like prices and trading volumes. In this article, we’ll walk through every aspect of the Coinbase API — how it’s used, what the rate limits are, and much more.
With that said, if you’re looking for an alternative that allows you to integrate not only with Coinbase but 300+ other wallets and exchanges, use Mesh instead!
About Coinbase
Coinbase, created by Brian Armstrong and Fred Ehrsam in 2012, is a platform where you can buy, sell, and keep track of your cryptocurrencies. Based in San Francisco, this company has come a long way, now boasting a global team of thousands as of 2023. But it's not just about trading crypto. Coinbase also offers tools for businesses and developers to process payments, making it a practical choice for a range of users, from individual crypto traders to larger enterprises.
General usage
The Coinbase API documentation categorizes APIs into two types: Trading and Market Data. Here are the four API options cater to various trading requirements:
- REST API: Suitable for web interactions, using HTTP/HTTPS protocols to handle diverse requests, ideal for web and mobile apps.
- FIX Order Entry API: This API prioritizes speed in trading, using the FIX protocol for quick order placements and modifications, beneficial for high-frequency trading.
- WebSocket Feed: Provides real-time updates through a two-way communication channel, fitting for applications needing immediate data, like live market feeds or sports scores.
- FIX Market Data API: Uses the FIX protocol to offer real-time financial market data, including stock prices and forex rates, aiding in informed trading decisions.
Rate limits
According to the REST API Rate Limits documentation, public endpoints are throttled by IP, while private endpoints are throttled by profile ID. Some endpoints, like "/fills", may have custom rate limits. Here are the specific rate limits for various endpoints:
- Public Endpoints:
- Requests per second per IP: 10
- Requests per second per IP in bursts: Up to 15
- Private Endpoints:
- Requests per second per profile: 15
- Requests per second per profile in bursts: Up to 30
- Private "/fills" Endpoint:
- Requests per second per profile: 10
- Requests per second per profile in bursts: Up to 20
Note that the private "/loans" endpoint has a rate limit of 10 requests per second per profile, and rate limits do not apply to the "/loans/assets" endpoint, which is not private.
Authentication
This is how you authenticate your requests to the Coinbase REST API:
- Generate an API key via the Coinbase Exchange website, and write down the key, secret, and passphrase.
- Choose the appropriate permissions for your API key based on your needs.
- Include the CB-ACCESS-KEY, CB-ACCESS-SIGN, CB-ACCESS-TIMESTAMP, and CB-ACCESS-PASSPHRASE headers in your REST requests.
- Calculate the CB-ACCESS-TIMESTAMP header as the number of seconds since Unix Epoch in UTC.
- Create the CB-ACCESS-SIGN header by generating a sha256 HMAC using the base64-decoded secret key on the prehash string, which includes the timestamp, method, request path, and body (if applicable). Base64-encode the resulting signature and include it in the CB-ACCESS-SIGN header.
Recent changes
Here are five of the most recent changes to the Coinbase API:
- On 2023-NOV-27: Iceberg Orders were added to FIX 5.0 production.
- On 2023-NOV-21: Loan APIs were added for underwritten users to view and monitor loan/collateral metrics, initiate loan opens, and initiate loan repayments.
- On 2023-NOV-02: Iceberg Orders were added to FIX 4.2 production and the REST API.
- On 2023-OCT-30: in FIX 4.2, the DropCopyFlag was disabled by default by setting 9406=N (from Y).
- On 2023-OCT-24: a destination_tag_regex field was added to the supported_networks of the currencies object in the Status message.
For a comprehensive list of changes, visit the Exchange Changelog page.
An alternative to the Coinbase API
Like we mentioned above Mesh provides a great alternative to Coinbase, particularly for developers and businesses aiming for a streamlined and integrated user experience for cryptocurrency transactions. Here are some of the standout features of Mesh's API:
- Integrated User Experience: Mesh seamlessly embeds cryptocurrency functionalities into your app, offering a smooth user journey.
- Broad Connectivity: With a single integration, Mesh connects to over 300 brokerages, exchanges, and wallets, providing extensive flexibility and choice.
- Simplified Asset Management: The API eases the process of depositing assets, allowing transfers from various sources directly within the app for enhanced user convenience.
Start with Mesh today and experience the ease and efficiency of their cutting-edge API in your digital currency endeavors.