Authentication
Comprehensive guide to StableStack API authentication and environment setup
Overview
This document outlines the authentication methods and environment setup for the StableStack API.
Base URLs
The StableStack API is available in different environments. The base URL depends on your environment:
Environment | Base URL |
---|---|
Production | https://api.stablestack.xyz |
Sandbox | https://api-staging.stablestack.xyz |
Authentication
The StableStack API uses Bearer token authentication. All API requests must include an Authorization header with your API token.
Getting Your API Token
- Log in to your StableStack dashboard
- Navigate to Settings > API Keys
- Generate a new API key or use an existing one
Using the API Token
Include your API token in the Authorization header of all requests:
Environment Detection
The API automatically detects the environment based on your API token. Each token is associated with a specific environment (Production, Staging, or Development). You don’t need to specify the environment separately - just use the appropriate base URL for your environment.
Security Best Practices
- Never share your API token - Keep it secure and don’t commit it to version control
- Use environment variables to store your API token
- Rotate your tokens regularly for enhanced security
Example Implementation
Using Environment Variables
Making Authenticated Requests
Key Management
Create new API key via your dashboard
Error Handling
If authentication fails, you’ll receive a 401 Unauthorized response:
Rate Limiting
API tokens are subject to rate limiting. See the Error Handling documentation for more details about rate limits and error responses.