Authorization header of every request.
Getting Your API Key
- Sign in to SpecStory Cloud
- Navigate to Settings → API Keys
- Generate a new API key for your application
- Copy the generated token securely
Making Authenticated Requests
Include your API key in theAuthorization header using the Bearer scheme:
Request Headers
Authentication Examples
Environment Variables
For security and convenience, store your API key as an environment variable:Authentication Errors
The API returns specific error codes for authentication issues:401 Unauthorized
Returned when no authentication token is provided or the token is invalid:- Missing
Authorizationheader - Invalid or expired API key
- Malformed Bearer token format
403 Forbidden
Returned when the authenticated user doesn’t have permission for the requested resource:- Attempting to access another user’s projects or sessions
- API key doesn’t have required permissions
API Key Management
Best Practices
Secure Storage
Secure Storage
- Store API keys in environment variables or secure credential stores
- Never commit API keys to version control
- Use different API keys for different environments (development, staging, production)
Key Rotation
Key Rotation
- Rotate API keys regularly (recommended: every 90 days)
- Generate new keys before revoking old ones to avoid service interruption
- Monitor API key usage in the SpecStory Cloud dashboard
Access Control
Access Control
- Use separate API keys for different applications or services
- Revoke unused or compromised keys immediately
- Monitor API usage patterns for unusual activity
Revoking API Keys
To revoke an API key:- Sign in to SpecStory Cloud
- Navigate to Settings → API Keys
- Find the key you want to revoke
- Click the “Revoke” button
- Confirm the revocation
Testing Authentication
You can test your authentication setup with a simple request to list your projects:GraphQL Authentication
GraphQL requests use the same Bearer token authentication:https://cloud.specstory.com/api/v1/graphql also supports authentication - just add your Bearer token in the headers section.