OAuth2
For more information about registering an OAuth client, contact beehiiv Support.
For integrations looking to integrate more seamlessly with beehiiv, the beehiiv API supports the standard OAuth2 authorization code flow.
OAuth2 endpoints are served under the /oauth namespace on the app domain (for example, https://app.beehiiv.com/oauth/...).
This guide will walk you through the steps to implement the OAuth2 authorization code flow for your integration.
Authorization Code Flow
Redirect the user to authorize your app
Send users to GET /oauth/authorize with:
client_idredirect_uriresponse_type=codescope(space-delimited)state(recommended for CSRF protection)code_challengeandcode_challenge_method(recommended for public clients)
Example:
Receive an authorization code
After login and consent, beehiiv redirects to your redirect_uri with:
codestate(if provided)
Exchange the code for tokens
Call POST /oauth/token with application/x-www-form-urlencoded body:
grant_type=authorization_codecoderedirect_uriclient_idclient_secret(confidential clients)code_verifier(when using PKCE)
The response contains access_token, token_type, expires_in, and refresh_token (when available).
Refreshing tokens
Use POST /oauth/token with:
grant_type=refresh_tokenrefresh_tokenclient_idclient_secret(confidential clients)
Token utilities
POST /oauth/revokerevokes access or refresh tokens.POST /oauth/introspectchecks token activity and metadata.GET /oauth/token/inforeturns metadata for the current bearer token.
Available scopes
Each scope maps to a resource type (for example, posts:* scopes apply to posts endpoints).
Scope permission levels map to endpoint actions:
:readpermits read actions (for example,GETrequests).:writeis required for mutating actions (for example,POST,PUT, andDELETErequests).
Default scope:
identify:read
Optional scopes:
automations:read,automations:writecustom_fields:read,custom_fields:writesubscriptions:read,subscriptions:writepolls:read,polls:writeposts:read,posts:writepublications:read,publications:writereferral_program:read,referral_program:writesegments:read,segments:writetiers:read,tiers:writewebhooks:read,webhooks:write