API Keys
API keys provide a way to authenticate server-to-server requests or grant third-party access to your APSO API.
Overview
APSO supports two types of API keys:
| Type | Scope | Use Case |
|---|---|---|
| Service Keys | Single service | Backend integrations |
| Organization Keys | All services | Multi-service access |
Creating API Keys
From Dashboard
- Navigate to your service (or organization settings)
- Go to Settings > API Keys
- Click Create API Key
- Configure the key:
- Name — Descriptive name
- Permissions — Read, Write, or Full Access
- Expiration — Optional expiry date
- Click Create
- Copy the key immediately — it won’t be shown again
From CLI
# Create a service API key
apso api-key create --name "Integration Key" --permissions read
# Create with expiration
apso api-key create --name "Temp Key" --expires 30d
# List all keys
apso api-key listUsing API Keys
Request Header
Include the API key in the X-API-Key header:
curl -X GET https://api.example.com/api/v1/projects \
-H "X-API-Key: apso_sk_live_xxxxxxxxxxxxx"SDK Configuration
import { ApsoClient } from '@apso/sdk';
const client = new ApsoClient({
baseUrl: 'https://api.example.com',
apiKey: process.env.APSO_API_KEY,
});Key Permissions
Read Only
GETrequests only- Cannot create, update, or delete
- Best for: Analytics, reporting, dashboards
Write Only
POST,PATCH,DELETErequests- Cannot read data
- Best for: Webhook receivers, import tools
Full Access
- All HTTP methods
- Complete API access
- Best for: Full integrations, admin tools
Custom Permissions
For granular control:
{
"permissions": {
"projects": ["read", "write"],
"users": ["read"],
"tasks": ["read", "write", "delete"]
}
}Key Scopes
Service Scope
Access limited to a single service:
apso_sk_svc_xxxxxxxxxx- Tied to one service
- Permissions apply to that service only
- Deleted when service is deleted
Organization Scope
Access to all services in the organization:
apso_sk_org_xxxxxxxxxx- Access all organization services
- Must be used carefully
- Best for: Organization-wide tools
Key Security
Best Practices
-
Never expose in client code
// WRONG - exposed to users const client = new ApsoClient({ apiKey: 'apso_sk_live_xxxxx', // Never do this! }); // RIGHT - server-side only const client = new ApsoClient({ apiKey: process.env.APSO_API_KEY, }); -
Use minimal permissions
- Grant only the permissions needed
- Prefer read-only when possible
-
Set expiration dates
- Temporary integrations should expire
- Review and rotate regularly
-
Use environment variables
APSO_API_KEY=apso_sk_live_xxxxx -
Monitor usage
- Check API logs regularly
- Set up alerts for unusual activity
Key Rotation
To rotate a key:
- Create a new key with the same permissions
- Update your integration to use the new key
- Verify the integration works
- Revoke the old key
# Create new key
apso api-key create --name "Integration Key v2"
# After updating integration, revoke old key
apso api-key revoke apso_sk_live_oldkeyManaging Keys
View Keys
From dashboard:
- Go to Settings > API Keys
- See all active keys with:
- Name
- Created date
- Last used
- Permissions
Edit Key
Keys cannot be edited after creation. To change permissions:
- Create a new key with desired permissions
- Update your integration
- Revoke the old key
Revoke Key
From dashboard:
- Go to Settings > API Keys
- Find the key to revoke
- Click Revoke
- Confirm revocation
From CLI:
apso api-key revoke apso_sk_live_xxxxxWarning: Revoked keys stop working immediately.
Rate Limits
API keys have rate limits based on your plan:
| Plan | Requests/minute | Requests/day |
|---|---|---|
| Free | 60 | 10,000 |
| Pro | 1,000 | 1,000,000 |
| Enterprise | Custom | Custom |
Rate limit headers:
X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 950
X-RateLimit-Reset: 1640995200Monitoring
API Key Logs
View usage in the dashboard:
- Go to Settings > API Keys
- Click on a key
- View Usage tab
Logs show:
- Request count
- Endpoints accessed
- Error rates
- Geographic distribution
Alerts
Set up alerts for:
- High error rates
- Unusual request patterns
- Near rate limit
- Key approaching expiration
Troubleshooting
401 Unauthorized
{
"statusCode": 401,
"message": "Invalid API key"
}Solutions:
- Check key is not revoked
- Verify key hasn’t expired
- Ensure correct header name (
X-API-Key) - Check for extra whitespace
403 Forbidden
{
"statusCode": 403,
"message": "Insufficient permissions"
}Solutions:
- Check key permissions match the request
- Verify key scope covers the service
- Create a new key with correct permissions
429 Too Many Requests
{
"statusCode": 429,
"message": "Rate limit exceeded"
}Solutions:
- Implement request throttling
- Cache responses when possible
- Upgrade plan for higher limits
- Contact support for temporary increases
Related
Last updated on