| title | keywords | last_updated | tags | summary |
|---|---|---|---|---|
Coinbase endpoint |
December 13, 2018 |
Detailed description of the API of the Coinbase endpoint. |
Coinbase’s API makes it easy to integrate bitcoin, bitcoin cash, litecoin and ethereum into both new and existing applications.
Coinbase’s APIs enable a variety of capabilities; from simply gathering read-only data, to building something that’s never been done before.
Before integrating Coinbase endpoint, you’ll need to register a new OAuth2 application under your API settings.
Capabilities:
- Generate bitcoin, bitcoin cash, litecoin and ethereum wallets and addresses
- Buy/sell and send/receive bitcoin, bitcoin cash, litecoin and ethereum
- Securely store bitcoin, bitcoin cash, litecoin and ethereum
- Retrieve real-time or historical price information
- Receive notifications when payments arrive
- Shortcuts to access the REST API
- Oauth for users
- Support for webhooks
In most cases you will be using the provided shortcuts to access the API. For example, you could use the REST API directly by doing an HTTP request like this:
var res = app.endpoints.coinbase.get('/v2/accounts');However you probably want to use the shortcuts:
var res = app.endpoints.coinbase.accounts.get(); These shortcuts are based on the Coinbase REST API. You can see more information about that in the shortcuts section.
First you will need to setup an account in Coinbase. Then you will be able to configure the endpoint you will need to generate a new OAuth2 application under your API settings. You can find more information about that in Coinbase Digital API.
This is the client ID for OAuth, which is needed in order to perform operations on behalf of a user.
This is the client secret for OAuth, which is needed in order to perform operations on behalf of a user.
A limit to the amount of money your application can send from the user’s account.
Supported fiat currency in ISO format, ex. EUR, USD
How often the send money limit expires. Default is month - allowed values are day, month and year.
Comma separated list of permissions (scopes) your application requests access to. Required scopes are listed under endpoints in the Full Scopes List
This is the OAuth callback you need to configure in your Coinbase app.
This is the URL you need to set in your Coinbase app so webhooks are sent there.
The user token will be automatically attach in each request when is used Coinbase endpoint. When use shortcuts or directly the API request.
var res = app.endpoints.coinbase.get('/v2/accounts');- HTTP request: this allows to make regular HTTP requests like
GET,POSTorPUTto the API. - Shortcuts: these are helpers to make HTTP request to the API in a more convenient way. Sign request automatically.
You can make GET, POST, PUT, and DELETE request to the
Coinbase API like this:
Please take a look at the documentation of the HTTP endpoint for more information.
Instead of having to use the generic HTTP methods, you can make use of the shortcuts provided in the endpoint. There are two groups of shortcuts:
These shortcuts follow these rules:
- Path sections get converted to namespaces: for example if the method is GET
~/v2/accounts/:account_id/transactionsit is converted toapp.endpoints.coinbase.accounts.transactions.get(accountId). - If they have dashes, we should convert them to camel case:
~/exchange-ratesis converted toapp.endpoints.coinbase.exchangeRates.get(). - HTTP method is appended at the end of the method: for example if the method is
GET, you will see a method with the suffix.get(...). For exampleGET ~/accounts/:account_idwill becomeapp.endpoints.coinbase.accounts.get(accountId). This is the mapping of names:GET:getPOST:postPUT:putDELETE:delete
- Path variables become method parameters: if the method has variables in the path, they will become parameters for
the method. For example
GET ~/v2/accounts/:account_id/withdrawals/:withdrawal_idwill becomeapp.endpoints.coinbase.accounts.withdrawals.get(accountId, withdrawalId). - Body are sent in the last param as JSON: if the method accepts more parameters or it allows to send a body,
that will be sent in the last parameter. For example the method
PUT ~/v2/accounts/:account_idwill becomeapp.endpoints.coinbase.accounts.put(accountId, {...params to update...}) - Arguments are sent in the last param as JSON. After the body: if the method accepts argument,
that will be sent in the last parameter. In case of PUT or POST after the body. For example the method
PUT ~/v2/accounts/:account_idwill becomeapp.endpoints.coinbase.accounts.put(accountId, {...params to update...}, {... arguments...}).
Here are some URLs of the REST API and their corresponding shortcut:
// GET ~/v2/exchange-rates?currency=BTC
var res = app.endpoints.coinbase.exchangeRates.get({currency: 'BTC'});
// GET ~/v2/accounts/:account_id
var res = app.endpoints.coinbase.accounts.get(accountId);
// PUT ~/v2/accounts/:account_id?name=xx
var res = app.endpoints.coinbase.accounts.get(accountId, {/*params to update*/}, {name: 'xx'});SLINGR is a low-code rapid application development platform that accelerates development, with robust architecture for integrations and executing custom workflows and automation.
This endpoint is licensed under the Apache License 2.0. See the LICENSE file for more details.