What are API Keys?
API keys authenticate requests to your Granite endpoints. Without a valid key, requests are rejected.Creating an API Key
1
Go to API Management
Navigate to API Management in the sidebar
2
Click Create Key
In the API Keys section, click + Create Key
3
Name Your Key
Give it a descriptive name:
- “Production Backend”
- “CI/CD Pipeline”
- “Partner Integration”
4
Copy Immediately
Important: Copy the key now. It’s only shown once!
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
Example error:
Security
API keys are:- Encrypted at rest
- Hashed for storage (we don’t store the plaintext)
- Scoped to your organization
- Logged on every use
SDK Usage
Using the TypeScript SDK:Next Steps
Create Endpoints
Make your automation callable
Invoke Automations
Call your endpoints