Authentication
All Tenzro Cloud API requests require authentication. This guide covers how to obtain and use API keys.
API Key Format
Tenzro API keys use the sk_ prefix followed by a unique identifier:
sk_fa1afb85bfca17a6eab6173788dacaf8fafddb43ab0c178085a9ec35faa86403
Using the API Key
Include your API key in the Authorization header with the Bearer prefix:
curl https://api.cloud.tenzro.com/cloud/ai/models \-H "Authorization: Bearer sk_your_api_key" \-H "Content-Type: application/json"
Project ID
Most endpoints require a projectId to scope the request to your project. Pass it as a query parameter or in the request body:
# As query parametercurl "https://api.cloud.tenzro.com/cloud/vec/databases?projectId=YOUR_PROJECT_ID" \-H "Authorization: Bearer sk_your_api_key"# In request bodycurl https://api.cloud.tenzro.com/cloud/ai/infer \-H "Authorization: Bearer sk_your_api_key" \-H "Content-Type: application/json" \-d '{"projectId": "YOUR_PROJECT_ID", "provider": "google", "model": "gemini-2.5-flash", "prompt": "Hello!"}'
SDK Authentication
When using the SDK, pass your API key to the constructor:
client.ts
import { Tenzro } from '@tenzro/cloud';const client = new Tenzro({apiKey: process.env.TENZRO_API_KEY!,projectId: process.env.TENZRO_PROJECT_ID, // Optional: set default project});// Now all calls use the default projectconst response = await client.ai.chat('Hello!');
Environment Variables
Store your API key in environment variables:
.env
TENZRO_API_KEY=sk_your_api_key_hereTENZRO_PROJECT_ID=your-project-id
Creating API Keys
Create API keys in the Console under API Keys. Each key can have:
- Name - A descriptive name for the key
- Scopes - Which services the key can access
- Rate Limits - Request limits per minute/day
- Expiration - Optional expiration date
Available Scopes
| Scope | Access |
|---|---|
ai:read, ai:write | AI inference and embeddings |
agents:read, agents:write | Agent management and execution |
vec:read, vec:write | Vector database operations |
kev:read, kev:write | Key-value store operations |
data:read, data:write | SQL database operations |
files:read, files:write | File storage operations |
security:read, security:write | Cryptographic operations |
Security Best Practices
- Never expose API keys in client-side code
- Use environment variables for key storage
- Rotate keys periodically
- Use separate keys for development and production
- Enable only the scopes each key needs
- Set rate limits appropriate to your use case
Error Responses
Authentication errors return the following status codes:
| Status | Meaning |
|---|---|
| 401 | Missing or invalid API key |
| 403 | Key doesn't have the required scope |
| 429 | Rate limit exceeded |