π§Detect Bias
The detect-bias
endpoint identifies potential biases, stereotypes, or harmful language in a given text.
It flags content that may be discriminatory, unbalanced, or ethically problematic.
π POST /detect-bias
Base URL: https://api.cognitia.ai/v1/detect-bias
π Authentication
All requests must include your API token in the Authorization
header:
Authorization: Bearer YOUR_API_TOKEN
π₯ Request
Headers
Authorization
string
β yes
Bearer token
Content-Type
string
β yes
application/json
Body
{
"text": "Women are naturally less suited for technical jobs."
}
text
string
β yes
The text to analyze (max 1500 characters)
π€ Response
β
Success β 200 OK
{
"biased": true,
"categories": ["gender bias", "stereotyping"],
"explanation": "This sentence contains gender-based stereotypes suggesting women are less capable in technical fields."
}
biased
boolean
Whether bias was detected
categories
string[]
Types of bias (e.g. gender bias
, racial bias
)
explanation
string
Short explanation of the bias
β Error Responses
400
Missing required field: text
The text
field is missing
Provide a non-empty text
string
401
Invalid or missing API token
Missing or incorrect token
Check the Authorization
header
413
Payload too large
Input exceeds 1500 characters
Reduce the input length
500
Internal server error
Server-side failure
Try again or contact support
π§ͺ Example (curl)
curl -X POST https://api.cognitia.ai/v1/detect-bias \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{"text": "Immigrants are taking all the jobs."}'
π Response
{
"biased": true,
"categories": ["xenophobia", "economic bias"],
"explanation": "This statement generalizes and blames a group of people, which is a form of bias."
}
π‘ Use Cases
Editorial and content moderation
AI alignment and safety layers
Auditing user-generated content
Ethical compliance in media platforms
π Limitations
Detection is probabilistic, not deterministic
Cultural/linguistic nuances may affect accuracy
Only available for English (French coming soon)
Explore other endpoints:
Last updated