These endpoints implement the OAuth 2.0 authorization code flow for applications created under My Account > Developer > OAuth Clients.
| Method | URI |
|---|---|
| GET | /oauth/authorize |
Send the member's browser to this address. The member signs in and approves your application, and is then redirected to your redirect URL.
{
"client_id": "{client_id}",
"redirect_uri": "{redirect_url}",
"response_type": "code",
"scope": "*",
"state": "{random_state}"
}
{info} The redirect to your redirect URL includes a
codein the query string. Check thatstatematches what you sent, then exchange the code for a token as shown below.
| Method | URI |
|---|---|
| POST | /oauth/token |
{
"grant_type": "authorization_code",
"client_id": "{client_id}",
"client_secret": "{client_secret}",
"redirect_uri": "{redirect_url}",
"code": "{code}"
}
{
"token_type": "Bearer",
"expires_in": 1209600,
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9...",
"refresh_token": "def50200014f3f27858ab9446214f089d26..."
}
Access tokens expire after 14 days (expires_in is in seconds). Refresh tokens expire after 30 days.
| Method | URI |
|---|---|
| POST | /oauth/token |
{
"grant_type": "refresh_token",
"refresh_token": "{refresh_token}",
"client_id": "{client_id}",
"client_secret": "{client_secret}",
"scope": "*"
}
The response has the same shape as above, with a new access token and a new refresh token.
For your own scripts, you can skip the OAuth flow. Create a token under My Account > Developer > Personal Access Tokens and send it as Authorization: Bearer {token}. Personal access tokens expire after 60 days; create a new one before then.