API Key Authentication
Postiz uses API key authentication for all public API requests. Include your API key in theAuthorization header of every request.
Getting Your API Key
- Log in to your Postiz dashboard
- Navigate to Settings → API Keys
- Click Generate New API Key
- Copy your API key and store it securely
Using Your API Key
Include the API key in theAuthorization header:
OAuth Tokens
Postiz also supports OAuth 2.0 tokens for API authentication. OAuth tokens start with the prefixpos_.
When using an OAuth token, include it in the Authorization header the same way as an API key:
Environment Variables
For security best practices, store your API key as an environment variable:Self-Hosted Instances
If you’re using a self-hosted Postiz instance, you can specify a custom API URL:Authentication Errors
401 Unauthorized
You’ll receive a401 status code if:
- No API key is provided
- The API key is invalid
- The API key has been revoked
Missing Subscription
For cloud instances with Stripe enabled, you must have an active subscription:Best Practices
Rotate Keys Regularly
Rotate Keys Regularly
Generate new API keys periodically and revoke old ones to minimize security risks.
Use Environment Variables
Use Environment Variables
Never hardcode API keys in your source code. Use environment variables or secure vaults.
Limit Key Scope
Limit Key Scope
If building a multi-tenant application, generate separate API keys for each organization.
Monitor Usage
Monitor Usage
Track API usage to detect unauthorized access or unusual patterns.
Next Steps
Rate Limits
Learn about API rate limiting
Create a Post
Make your first authenticated request