Authentication Method
All Offergrid API endpoints require authentication using a Team API Key passed in the request headers.API Key Header
Include your API key in thex-api-key header with every request:
Example Requests
Team Roles and Permissions
Your API key’s permissions depend on your team’s role:Provider Teams
Access to Provider endpoints:POST /provider/offers- Create offersGET /provider/offers- List your offersGET /provider/offers/{id}- Get offer detailsPATCH /provider/offers/{id}- Update offersDELETE /provider/offers/{id}- Delete offersGET /provider/orders- List orders to fulfillGET /provider/orders/{itemId}- Get order detailsPATCH /provider/orders/{itemId}/status- Update order status
Reseller Teams
Access to Reseller endpoints:GET /reseller/catalog- Browse available offersGET /reseller/catalog/{id}- Get offer detailsPOST /reseller/orders- Place ordersGET /reseller/orders- List your ordersGET /reseller/orders/{id}- Get order detailsPATCH /reseller/orders/{id}/cancel- Cancel orders
Hybrid Teams
Some teams have both provider AND reseller roles. Hybrid teams can access all endpoints with the same API key.Authentication Errors
401 Unauthorized
Missing or invalid API key:- API key not provided in headers
- Invalid or revoked API key
- Incorrect header name (must be
x-api-key)
403 Forbidden
Valid API key but insufficient permissions:- Reseller team trying to access provider endpoints
- Provider team trying to access reseller endpoints
- Team role not properly configured
Security Best Practices
Store Keys Securely
Use environment variables
Use environment variables
✅ Good:❌ Bad:
Use secrets management
Use secrets management
For production, use:
- AWS: AWS Secrets Manager
- Azure: Azure Key Vault
- GCP: Secret Manager
- HashiCorp: Vault
- 1Password: 1Password CLI
Rotate keys regularly
Rotate keys regularly
Generate new API keys periodically and revoke old ones:
- Every 90 days for active keys
- Immediately if compromised
- When team members leave
Use HTTPS Only
Always usehttps:// endpoints, never http://:
Don’t Expose Keys Client-Side
Make API calls from your backend server only.Separate Keys by Environment
Use different API keys for:- Development: Testing and development work
- Staging: Pre-production testing
- Production: Live customer transactions
Rate Limiting
Offergrid enforces rate limits to ensure fair usage:- Burst limit: 100 requests per minute
- Sustained limit: 10,000 requests per hour
Rate Limit Headers
Check these headers in responses:429 Too Many Requests
If you exceed rate limits:Managing API Keys
Generating Keys
- Sign in to offergrid.io
- Navigate to Settings → API Keys
- Click Generate New Key
- Copy immediately - you won’t see it again!
- Store securely in environment variables or secrets manager
Revoking Keys
If a key is compromised:- Go to Settings → API Keys
- Find the compromised key
- Click Revoke
- Generate a new key
- Update your applications
401 Unauthorized immediately.
Key Naming
Give keys descriptive names:Production API KeyStaging EnvironmentDevelopment - John's LaptopCI/CD Pipeline
Troubleshooting
”Invalid API key” error
Check:- Header name is exactly
x-api-key(lowercase, with hyphen) - API key was copied correctly (no extra spaces)
- API key hasn’t been revoked
- Request is going to correct base URL
”Forbidden” error
Check:- Team has the correct role (provider or reseller)
- Endpoint matches team role
- Account is active and verified
Keys not working in production
Check:- Using production API key (not development key)
- Environment variables set correctly
- Key has proper permissions
- Not hitting rate limits