Overview
Stayforge API Keys are credentials used for authentication and authorization. All API requests must include a valid API Key in order to access resources.
Quick Start
Obtain an API Key
- Sign in to the Stayforge Dashboard
- Navigate to Settings → API Keys
- Create a new API Key
Usage
Include the API Key in the HTTP request header:
Code
Example request:
Code
API Key Format
API Keys must follow this format:
{prefix}{payload}.{signature}
Security Features
IP Restrictions
API Keys can be configured with IP whitelists to restrict requests to specific IP addresses or CIDR ranges:
- Empty list means no restrictions (all IPs allowed)
- Once IP ranges are configured, only requests from allowed IPs will be accepted
- IP range settings can be managed in the Dashboard
Permission Control
Each API Key has specific permission scopes (scopes) to ensure it can only access authorized resources.
Error Handling
Common Error Codes
All Error codes are present API Key Error Codes
Error Response Format
All error responses follow this structure:
Code
Error Handling Example
Code
Best Practices
- Secure Storage: Store API Keys in environment variables or secure key management services, never commit them to version control
- Regular Rotation: Regularly update API Keys to enhance security
- Principle of Least Privilege: Only grant necessary permissions to API Keys
- IP Restrictions: Configure IP whitelists in production environments
- Error Handling: Implement appropriate error handling and retry logic
- Monitoring: Monitor API Key usage and error rates
Related Resources
- Dashboard: https://dash.stayforge.io/settings/apikeys
- API Documentation: See the complete API reference documentation
- Error Code Details: Refer to API Key Error Codes Documentation
- Support Email: [email protected]
Important Notes
- Once an API Key is created, store it securely as the system will not display the complete key again
- If an API Key is compromised, immediately revoke it in the Dashboard and create a new one
- Ensure API Keys are not expired, expired keys will not work
- All API requests must use HTTPS (production environment)
Last modified on