cURL Examples
Raw HTTP requests for testing, shell scripting, and API exploration. These examples work with any HTTP client and are perfect for quick testing.
Authentication & API Keys
Register, login, and manage API keys
terminal
# cURL Examples for Authentication & API Keys
# Register new user account
curl -X POST https://api.tenzro.com/auth/register \
-H "Content-Type: application/json" \
-d '{
"email": "user@example.com",
"password": "secure_password",
"full_name": "John Doe",
"organization_name": "Acme Corp"
}'
# Login to get session token
curl -X POST https://api.tenzro.com/auth/login \
-H "Content-Type: application/json" \
-d '{
"email": "user@example.com",
"password": "secure_password"
}'
# Create API key
curl -X POST https://api.tenzro.com/auth/api-keys \
-H "X-API-Key: sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"name": "Production API Key",
"permissions": ["read", "write", "admin"],
"expires_at": "2025-12-31T23:59:59Z",
"rate_limits": {
"requests_per_minute": 1000,
"ai_operations_per_day": 10000
}
}'
Tips & Tricks
💡 Environment Variables
Set your API key as an environment variable to avoid repetition
export TENZRO_API_KEY="sk_your_key_here"
curl -H "X-API-Key: $TENZRO_API_KEY" ...
📋 Response Formatting
Pipe responses through jq for better JSON formatting
curl ... | jq '.'
🔧 Debugging
Use -v flag for verbose output to debug requests
curl -v -X POST ...
📁 File Uploads
Use -F for multipart form data with file uploads
curl -F "file=@image.jpg" ...
Shell Script Examples
Batch AI Text Generation
Generate multiple AI responses in sequence
batch_generate.sh
#!/bin/bash
# Batch generate text with different prompts
PROMPTS=(
"Explain quantum computing"
"What is machine learning?"
"How does blockchain work?"
"Describe artificial intelligence"
)
for prompt in "${PROMPTS[@]}"; do
echo "Generating: $prompt"
curl -X POST https://api.tenzro.com/cortex/generate \
-H "X-API-Key: $TENZRO_API_KEY" \
-H "Content-Type: application/json" \
-d "{\"prompt\": \"$prompt\", \"model\": \"gpt-4o\"}" \
| jq '.content' > "output_${prompt// /_}.txt"
echo "Saved to output_${prompt// /_}.txt"
sleep 1 # Rate limiting
done
Deployment Monitor Script
Monitor deployment status until completion
monitor_deployment.sh
#!/bin/bash
DEPLOYMENT_ID="$1"
if [ -z "$DEPLOYMENT_ID" ]; then
echo "Usage: $0 <deployment_id>"
exit 1
fi
echo "Monitoring deployment: $DEPLOYMENT_ID"
while true; do
STATUS=$(curl -s -X GET \
"https://api.tenzro.com/factory/deployments/$DEPLOYMENT_ID" \
-H "X-API-Key: $TENZRO_API_KEY" \
| jq -r '.status')
echo "[$(date)] Status: $STATUS"
if [[ "$STATUS" == "running" || "$STATUS" == "failed" ]]; then
echo "Deployment finished with status: $STATUS"
break
fi
sleep 30
done
Next Steps
Quick Start
- 1Get your API key from platform.tenzro.com
- 2Set environment variable:
export TENZRO_API_KEY="sk_..."
- 3Copy and run any cURL example above
- 4Check the API Reference for all endpoints
Need help? Check out our Quick Start guide or contact support