API Key Overview
Triqai uses API keys to authenticate requests. Each key is associated with an organization and determines:- Access permissions: Which endpoints you can access
- Rate limits: How many requests you can make per minute
- Credit usage: Which organization’s credits are consumed
Key Formats
Triqai API key format is as follows:triq_xxxxx...
Getting Your API Key
Sign in to your account
Go to triqai.com/login and sign in.
Using Your API Key
Include your API key in theX-API-Key header with every request:
Authentication Errors
If authentication fails, you’ll receive a401 Unauthorized response:
Common Authentication Issues
| Error | Cause | Solution |
|---|---|---|
| Missing API key | No X-API-Key header provided | Add the header to your request |
| Invalid API key | Key doesn’t exist or is malformed | Check for typos; regenerate if needed |
| Revoked API key | Key has been revoked | Generate a new key in the dashboard |
| Invalid format | Key doesn’t match expected pattern | Ensure key starts with triq_ |
Security Best Practices
Do’s
- Store API keys in environment variables
- Use server-side code to make API requests
- Rotate keys periodically
- Use separate keys for development and production
- Monitor API usage in your dashboard
Don’ts
- Commit API keys to version control
- Include keys in client-side JavaScript
- Share keys via insecure channels
- Use production keys for testing
Environment Variables
Store your API key in environment variables:.env
Managing API Keys
Rotating Keys
If you suspect a key has been compromised:- Generate a new key in your dashboard
- Update your application to use the new key
- Revoke the old key once the new one is active
Multiple Keys
You can create multiple API keys for different purposes:- Production key: For your live application
- Development key: For local development
- CI/CD key: For automated testing pipelines
- Partner keys: For third-party integrations
Organization Context
API keys are scoped to organizations:- Each key belongs to exactly one organization
- All requests authenticated with a key are attributed to that organization
- Credits are deducted from the organization’s balance
- Rate limits are applied per organization