Refresh a token
Exchanges a refresh token for a fresh access and refresh pair. The partner comes from the request's own credential, so a refresh token issued to one partner cannot be redeemed by another.
POST/api/v3/auth/tokens/refresh
Send your own credential. No customer is involved.
How authentication works- Yours
x-api-keyorAuthorization: Bearer
Returns a fresh pair, so store both: the refresh token you send is spent, and the new one is what the next refresh needs.
Refresh rather than re-authenticating on a schedule. Sending your username and password on every call keeps a long-lived secret in flight far more often than it needs to be.
Language
Environment
Credentials
Your credential
Choose an environment first.
curl -X POST https://api.btcdirect.eu/api/v3/auth/tokens/refresh \ -H "x-api-key: $BTCD_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "refreshToken": "v3.rt.8f2c1d9a4b7e6301f5a2c8d4b9e0736a" }'Response
{ "token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI5ZmM", "refreshToken": "v3.rt.8f2c1d9a4b7e6301f5a2c8d4b9e0736a"}Request
refreshTokenstringrequired
Examplev3.rt.8f2c1d9a4b7e6301f5a2c8d4b9e0736a
Responses
200A fresh token pair.400Invalid request, or the refresh token is not valid (ER037). A token spent by another refresh a moment ago adds "reason": "superseded": the session is alive, and the caller should retry with the newer refresh token rather than sign out.401Bad credentials.503`maintenance` — full maintenance is on, and every endpoint refuses every request until it ends (`endsAt`, when it has an end). Nothing is wrong with the request and nothing was done; the same request is accepted afterwards. Told apart from any other 503 by `code`.Body of the success response
tokenstring
ExampleeyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI5ZmM
refreshTokenstring
Examplev3.rt.8f2c1d9a4b7e6301f5a2c8d4b9e0736a
Every failure answers with a message and a code. Switch on the code — messages are written for people and can change.