Authorization header. The JWT is signed with your private key and encodes your API key identity, so Coinbase can verify who is making the request and what permissions they have — without transmitting your private key over the network.
The fastest way to confirm your credentials are working is to run this command:
1
Create an API key
Log in to your Coinbase account and navigate to Settings → API → Create API Key. During creation you will:
- Choose a key name (used as the
subclaim in your JWT). - Select the permissions (scopes) the key requires — see API key scopes below.
- Download or copy your private key (PEM format). Coinbase does not store your private key, so save it securely now.
2
Generate a JWT
The JWT must include the following claims and be signed using ES256 (ECDSA with P-256 and SHA-256):
Using the official SDK (recommended)
The easiest way to handle JWT generation is to use Coinbase’s official SDK, which manages signing automatically.Manual JWT construction
If you prefer not to use the SDK, you can sign a JWT directly using any ES256-capable JWT library.JWT tokens expire after 120 seconds. Generate a fresh token for each request, or immediately before sending a batch of requests. Long-running applications should automate token refresh rather than reusing a single token.
3
Construct the Authorization header
Once you have a signed JWT, pass it as a Bearer token in the Use the token as Replace
Authorization header of every HTTP request:$JWT in curl calls. For example, to list your accounts:$JWT with the token string you generated in the previous step. If you are using an official SDK, the library constructs and injects this header automatically.Authentication errors
If your JWT is missing, malformed, expired, or signed with an unrecognized key, the API returns an HTTP401 Unauthorized response:
401 errors:
- The JWT has expired (older than 120 seconds).
- The
uriclaim does not match the request method and path exactly. - The private key does not correspond to the API key name in the
subclaim. - The key has been revoked in the Coinbase dashboard.
API key scopes
When you create an API key you assign it one or more permission scopes. Choose the minimum scopes your application needs.Keep your API credentials safe. Rotate keys regularly, revoke keys you no longer use, and use separate keys with the narrowest possible scopes for each application or environment.