Get an OAuth 2.0 access token for the Shutterstock API using the authorization code grant and refresh it before it expires
domain: api.shutterstock.com · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗
Steps
Create a Shutterstock application at shutterstock.com/account/developers/apps to obtain a consumer key (client_id) and consumer secret (client_secret)
Redirect the user to GET https://api.shutterstock.com/v2/oauth/authorize with client_id, redirect_uri, response_type=code, a space-separated scope list (e.g. 'licenses.create licenses.view purchases.view'), and a state value
After the user logs in and approves, capture the authorization code from the redirect_uri's code query parameter (valid once, expires after 5 minutes)
Exchange the code for a token with POST https://api.shutterstock.com/v2/oauth/access_token using grant_type=authorization_code, client_id, client_secret, redirect_uri, code, and expires=true or expires=false
If expires=true was used, store the returned refresh_token (prefixed '3/') and refresh the access_token before its 1-hour expiry via POST /v2/oauth/access_token with grant_type=refresh_token, refresh_token, client_id, and either client_secret or user_id
Pass the resulting access_token as 'Authorization: Bearer <token>' on subsequent API calls
Known gotchas
Tokens requested with expires=false never need refreshing and remain valid until the user changes their password or email — mixing token lifetimes in one app requires tracking which type each token is
The redirect_uri sent to /oauth/authorize must exactly match a host name registered on the application or the request is rejected with an invalid_redirect_url error
Endpoints requiring an OAuth scope reject HTTP Basic auth outright; Basic auth (consumer key/secret as username/password) only works on endpoints that don't require a scope, such as basic search
Give your agent this knowledge — and 15,500+ more routes
One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp
Need this verified for your stack — or a route we don't have yet?