Generate Tokens
Use your API Key to generate an Access Token, and your Refresh Token to obtain a new pair of tokens when the Access Token expires. The Access Token is valid for 1 hour, and the Refresh Token for 7 days.
Generate an Access Token
Swagger
- Navigate to https://api.redbookdirect.com/. This opens a Swagger page that lists all the RedBook Direct API endpoints.
- Expand the
/tokenendpoint, enter your API Key, then hit Execute. - The response contains the Access Token, the time (in seconds) before it expires, and the Refresh Token (valid for 7 days).
CURL
Provide the API Key while calling the token endpoint:
curl -H "x-api-key: {apikey}" https://api.redbookdirect.com/tokenThe response contains the Access Token, the time (in seconds) before it expires, and the Refresh Token (valid for 7 days):
{ "accessToken": "eyJhbGciOiJodHRwOi8v...s_8cPjEaSRNFgHpPQ6EJNjXzqCqPqffXShgRUvCPw_Y", "expiresIn": 3600, "refreshToken": "eWiYZAeFggMn1tzNzTPC6bIbfIdP4x0Y83PnJ+avpOM=" }
Get a Refresh Token
When the Access Token expires, use the Refresh Token together with the Access Token to generate a new pair of tokens.
Swagger
- Navigate to https://api.redbookdirect.com. This opens a Swagger page that lists all the RedBook Direct API endpoints.
- Use the refresh token endpoint at
/refresh/token, provide the Access Token and Refresh Token, and hit Execute.
This returns a new pair of Access and Refresh tokens.
CURL
Provide the Access Token and Refresh Token when you call the refresh endpoint:
curl -H "x-accesstoken: {access-token}" -H "x-refreshtoken: {refresh-token}" \ https://api.redbookdirect.com/token/refreshYou will get a new pair of Access and Refresh tokens:
{ "accessToken": "eyJhbGciOiJodHRwOi8v...da43_aRF2I9A1B2wmRllXBRk6ulxIxgcPrp-8IOF9Fs", "expiresIn": 3600, "refreshToken": "ZmfIyUJs+JOZcDydyB+6ETTCKlpOMno1OjDr4JagI1Q=" }