Documentation Index
Fetch the complete documentation index at: https://docs.cloud.coinbase.com/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The following methods can be used to authenticate your requests to the Coinbase Developer Platform (CDP). Choose the method that best suits your needs:| Method | Difficulty | Description |
|---|---|---|
| Use an Axios request client | Easy | Use an Axios client with a pre-configured interceptor that automatically handles authentication for all requests. |
| Generate your authorization headers | Intermediate | Generate authentication headers and apply them to your preferred HTTP client. |
| Generate a JWT | Advanced | Generate a JWT token, manually create your authentication headers, and apply them to your preferred HTTP client. |
Generate a JWT
The following example shows how to generate a JWT token, which can then be injected manually into yourAuthorization header to authenticate REST API requests to the CDP APIs using the HTTP request library of your choice.
Step 1: Install the required package:
Authorization header of your HTTP request:
Generate your authorization headers
The following example shows how to generate the required authentication headers for authenticating a request to the CDP REST APIs, using the HTTP request library of your choice. Step 1: Install the required package:Use an Axios request interceptor
Step 1: Install the required packages:- Generate a JWT for each request
- Add the JWT to the
Authorizationheader - Set the appropriate
Content-Typeheader - Add wallet authentication when required
Authentication parameters
The following table provides more context of many of the authentication parameters used in the examples above:| Parameter | Required | Description |
|---|---|---|
apiKeyId | true | The unique identifier for your API key. Supported formats are: - xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx- organizations/{orgId}/apiKeys/{keyId} |
apiKeySecret | true | Your API key secret. Supported formats are: - Edwards key (Ed25519): xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx==- Elliptic Curve key (ES256): -----BEGIN EC PRIVATE KEY-----\n...\n...\n...==\n-----END EC PRIVATE KEY-----\n |
requestMethod | true* | The HTTP method for the API request you’re authenticating (ie, GET, POST, PUT, DELETE). Can be null for JWTs intended for websocket connections. |
requestHost | true* | The API host you’re calling (ie, api.cdp.coinbase.com). Can be null for JWTs intended for websocket connections. |
requestPath | true* | The path of the specific API endpoint you’re calling (ie, /platform/v1/wallets). Can be null for JWTs intended for websocket connections. |
requestBody | false | Optional request body data. |
expiresIn | false | The JWT expiration time in seconds. After this time, the JWT will no longer be valid, and a new one must be generated. Defaults to 120 (ie, 2 minutes) if not specified. |
requestMethod, requestHost, and requestPath) must be provided for REST API requests, or all three must be null for JWTs intended for websocket connections.