Overview
The Gumroad API uses OAuth 2.0 for authentication, implemented via the Doorkeeper gem. This allows you to securely access the API on behalf of Gumroad users.All API requests must be authenticated using an access token obtained through the OAuth 2.0 flow.
OAuth 2.0 Flow
Gumroad supports three OAuth 2.0 grant types:- Authorization Code - For web applications
- Password Credentials - For trusted applications
- Client Credentials - For application-level access
Authorization Code Flow
This is the most common flow for web applications:Step 1: Register Your Application
First, register your application at:- Client ID - Your application identifier
- Client Secret - Your application secret (keep this secure!)
Step 2: Redirect User to Authorization URL
Redirect the user to Gumroad’s authorization endpoint:Your application’s client ID
The URL to redirect to after authorization (must match registered URI)
Must be
code for authorization code flowOptional CSRF protection token
Step 3: Exchange Code for Access Token
After the user authorizes your application, they’ll be redirected to yourredirect_uri with a code parameter:
Token Response
Gumroad access tokens do not expire (
expires_in: null), but refresh tokens are still provided for future compatibility.Password Credentials Flow
For trusted applications, you can use the password flow to authenticate with username/password:Using Access Tokens
Once you have an access token, include it in all API requests using theAuthorization header:
Scopes
Scopes control what your application can access. When requesting authorization, specify the scopes you need:View public profile information (default scope)
View detailed profile information
Create, update, and delete products
View sales data and customer information
View payout information
Mark sales as shipped with tracking information
Process refunds for sales
Edit sales, resend receipts, and perform other sale operations
Access revenue share information
Integration with IFTTT (special scope)
Requesting Multiple Scopes
Request multiple scopes by separating them with spaces:The
mobile_api, creator_api, unfurl, and helper_api scopes are reserved for internal use and not available to public applications.Refresh Tokens
Although Gumroad access tokens don’t expire, you can use refresh tokens to obtain new access tokens:Token Management
Users can manage authorized applications at:Testing Authentication
Test your access token by fetching the authenticated user:Security Best Practices
- Store credentials securely - Use environment variables or secure vaults
- Use HTTPS only - Never send tokens over unencrypted connections
- Implement CSRF protection - Use the
stateparameter in OAuth flows - Validate redirect URIs - Ensure redirect URIs match exactly
- Rotate secrets regularly - Periodically rotate client secrets
- Request minimal scopes - Only request scopes you actually need
- Handle token expiration - Implement proper error handling for 401 responses
Common Errors
Invalid Client Credentials
client_id and client_secret are correct.
Invalid Authorization Code
Insufficient Scope
Next Steps
API Overview
Learn about available endpoints and API structure
Products API
Start managing your products via the API
Sales API
Retrieve and manage sales data
Webhooks
Set up real-time notifications for events