API Keys
API keys are used for all API communication. They provide full access to your project’s data and automatically include the project context.Creating an API Key
- Go to your Gately dashboard
- Navigate to Settings > API Keys
- Click Create API Key
- Give your key a descriptive name
- Copy and securely store the key (it won’t be shown again)
Using API Keys
Include the API key in theAuthorization header:
API Key Prefixes
| Prefix | Environment |
|---|---|
gately_sk_live_ | Production |
gately_sk_test_ | Test/Development |
JWT Tokens (Client-side)
JWT tokens are used for client-side authentication when users log in to your application.Obtaining a JWT Token
Using JWT Tokens
Token Expiry
| Token Type | Expiry |
|---|---|
| Access Token | 1 hour |
| Refresh Token | 7 days |
Refreshing Tokens
Authentication Summary
| Method | Authorization Header | Use Case |
|---|---|---|
| API Key | Bearer gately_xxxxx | Server-to-server |
| JWT Token | Bearer eyJhbG... | Client-side apps |
Security Best Practices
Rotate API Keys Regularly
Rotate API Keys Regularly
Create new API keys periodically and revoke old ones to minimize risk.
Use Environment Variables
Use Environment Variables
Store API keys in environment variables, never in source code.
Limit Key Permissions
Limit Key Permissions
Create separate keys for different services with minimal required permissions.
Monitor Usage
Monitor Usage
Regularly review API key usage in your dashboard to detect anomalies.
