What are API Keys?
API keys authenticate requests to your Granite endpoints. Without a valid key, requests are rejected.Creating an API Key
Name Your Key
Give it a descriptive name:
- “Production Backend”
- “CI/CD Pipeline”
- “Partner Integration”
Using API Keys
Include the key in theX-Granite-API-Key header:
- cURL
- JavaScript
- Python
Managing Keys
View Keys
In API Management, you see:- Key name
- Creation date
- Last used date
- Partial key (last 4 characters)
Revoke Keys
To revoke a compromised or unused key:- Find the key in the list
- Click the trash icon
- Confirm revocation
Best Practices
Use separate keys for different purposes
Use separate keys for different purposes
Create distinct keys for:
- Production
- Staging
- CI/CD
- Each partner integration
Rotate keys periodically
Rotate keys periodically
Every 90 days:
- Create a new key
- Update your systems
- Revoke the old key
Never commit keys to git
Never commit keys to git
Use environment variables or secret managers:
Monitor usage
Monitor usage
Check Analytics for unexpected patterns that might indicate a leak.
Error Responses
| Status | Meaning |
|---|---|
401 | Missing or invalid API key |
403 | Key valid but lacks permission |
Security
API keys are:- Encrypted at rest
- Hashed for storage (we don’t store the plaintext)
- Scoped to your organization
- Logged on every use