Authentication
Unizo uses API key authentication for all requests. You'll need to include your API key in the Authorization
header of every request.
Getting Your API Key
- Sign up for a Unizo account at app.unizo.ai
- Navigate to the API Keys section in your dashboard
- Create a new API key with the appropriate scopes
- Copy your API key and store it securely
Never expose your API key in client-side code, public repositories, or logs. Always store it as an environment variable or in a secure configuration management system.
Making Authenticated Requests
Include your API key in the Authorization
header using the Bearer
token format:
curl -H "Authorization: Bearer your_api_key_here" \
-H "Content-Type: application/json" \
https://api.unizo.ai/v1/connectors
Environment Variables
We recommend storing your API key as an environment variable:
export UNIZO_API_KEY="your_api_key_here"
Then reference it in your code:
- JavaScript
- Python
- cURL
const UNIZO_API_KEY = process.env.UNIZO_API_KEY;
const response = await fetch('https://api.unizo.ai/v1/connectors', {
headers: {
'Authorization': `Bearer ${UNIZO_API_KEY}`,
'Content-Type': 'application/json'
}
});
import os
import requests
UNIZO_API_KEY = os.getenv('UNIZO_API_KEY')
headers = {
'Authorization': f'Bearer {UNIZO_API_KEY}',
'Content-Type': 'application/json'
}
response = requests.get('https://api.unizo.ai/v1/connectors', headers=headers)
curl -H "Authorization: Bearer $UNIZO_API_KEY" \
-H "Content-Type: application/json" \
https://api.unizo.ai/v1/connectors
API Key Scopes
When creating an API key, you can limit its access to specific scopes:
connectors:read
- Read connector configurationsconnectors:write
- Create and update connectorsticketing:read
- Read tickets from connected servicesticketing:write
- Create and update ticketssource-code:read
- Read repositories and codesource-code:write
- Create repositories and push codecommunications:write
- Send messages and notifications
Follow the principle of least privilege by only granting the scopes your application actually needs.
Testing Your Authentication
You can test your API key by making a request to the health endpoint:
curl -H "Authorization: Bearer $UNIZO_API_KEY" \
https://api.unizo.ai/v1/health
Expected response:
{
"status": "ok",
"timestamp": "2024-01-01T12:00:00Z",
"version": "1.0.0"
}
Error Responses
If authentication fails, you'll receive a 401 Unauthorized
response:
{
"error": "unauthorized",
"message": "Invalid or missing API key",
"code": "INVALID_API_KEY"
}
Common authentication errors:
- Missing Authorization Header: Include
Authorization: Bearer your_api_key
- Invalid API Key: Check that your API key is correct and hasn't been revoked
- Insufficient Scope: Ensure your API key has the required scopes for the endpoint
Next Steps
Now that you have authentication set up, you can: