Secure your API requests with API key authentication
All requests to the Omni API require authentication using an API key. This ensures that only authorized users can access the API and helps us track usage for billing purposes.
You can obtain an API key by signing up for an account on the Omni dashboard. Once you've created an account, you can generate API keys from the dashboard.
Your API key is a secret that grants access to the API. Keep it secure and never share it publicly. If you suspect your API key has been compromised, you can revoke it and generate a new one from the dashboard.
To authenticate your API requests, include your API key in the X-API-Key
header of your HTTP requests:
X-API-Key: your_api_key_here
curl -X POST https://api.omnimoderate.com/v1/moderate \
-H "Content-Type: application/json" \
-H "X-API-Key: your_api_key_here" \
-d '{
"input": [
{ "type": "text", "text": "This is a sample text to moderate." }
]
}'
If you don't include an API key or if the API key is invalid, you'll receive an error response:
{
"error": {
"code": "missing_api_key",
"message": "API key is required. Please include an X-API-Key header."
}
}
{
"error": {
"code": "invalid_api_key",
"message": "The provided API key is invalid or has been revoked."
}
}
You can manage your API keys from the Omni dashboard. The dashboard allows you to: