Risk Check API
Check Risk
Check text content for potential risks and get detailed analysis.
Request
Request Structure
const response = await fetch('https://api.xstereotype.com/api/bias/check-bias', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-Api-Key': 'YOUR_API_KEY' }, body: JSON.stringify({ text: "His handwriting is like a asian boy" })});
import requests
response = requests.post( 'https://api.xstereotype.com/api/bias/check-bias', headers={ 'X-Api-Key': 'YOUR_API_KEY' }, json={ 'text': 'His handwriting is like a asian boy' })
$ch = curl_init();curl_setopt($ch, CURLOPT_URL, 'https://api.xstereotype.com/api/bias/check-bias');curl_setopt($ch, CURLOPT_POST, 1);curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'X-Api-Key: YOUR_API_KEY'));curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([ 'text' => 'His handwriting is like a asian boy']));
$response = curl_exec($ch);
using (var client = new HttpClient()){ client.DefaultRequestHeaders.Add("X-Api-Key", "YOUR_API_KEY");
var response = await client.PostAsync( "https://api.xstereotype.com/api/bias/check-bias", new StringContent( JsonSerializer.Serialize(new { text = "His handwriting is like a asian boy" }), Encoding.UTF8, "application/json" ) );}
client := &http.Client{}requestBody := map[string]string{ "text": "His handwriting is like a asian boy",}jsonBody, _ := json.Marshal(requestBody)
req, _ := http.NewRequest("POST", "https://api.xstereotype.com/api/bias/check-bias", bytes.NewBuffer(jsonBody))req.Header.Set("Content-Type", "application/json")req.Header.Set("X-Api-Key", "YOUR_API_KEY")
response, err := client.Do(req)
require 'net/http'require 'json'
uri = URI('https://api.xstereotype.com/api/bias/check-bias')http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Post.new(uri)request['Content-Type'] = 'application/json'request['X-Api-Key'] = 'YOUR_API_KEY'request.body = { text: 'His handwriting is like a asian boy'}.to_json
response = http.request(request)
HttpClient client = HttpClient.newHttpClient();HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://api.xstereotype.com/api/bias/check-bias")) .header("Content-Type", "application/json") .header("X-Api-Key", "YOUR_API_KEY") .POST(HttpRequest.BodyPublishers.ofString( "{\"text\": \"His handwriting is like a asian boy\"}" )) .build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
{ "text": "His handwriting is like a asian boy"}
Headers
Header | Required | Description |
---|---|---|
X-Api-Key | Yes | Your API authentication key |
Content-Type | Yes | Must be application/json |
Response
{ "data": { "content_id": "aa3b8b64-71eb-41d2-8e19-e4f8239bbf5c", "bias_Label": "race", "explanation": "The query \"His handwriting is like an asian boy\" perpetuates a stereotype based on race by suggesting that handwriting can be categorized by ethnicity. This aligns with the \"race\" label found in several retrieved results that associate characteristics with specific racial groups.", "recommendation": "Rephrase the query to focus on the characteristics of the handwriting itself, avoiding racial generalizations. For example, try \"His handwriting is neat and precise\" or \"His handwriting is small and delicate.\"", "bias_score": 61.71, "detail": "Successfully checked risk." }, "message": "Operation successful", "isSuccess": true}
{ "message": "Invalid or missing API key", "isSuccess": false}
{ "message": "Invalid request format", "isSuccess": false}
{"id": 0,"data": null,"isSuccess": false,"message": "Insufficient balance, Please Recharge!!!"}
Response Fields
Field | Type | Description |
---|---|---|
content_id | string | Unique identifier for the analyzed content |
bias_Label | string | Category of detected bias (e.g., race, gender) |
explanation | string | Detailed explanation of the detected risk |
recommendation | string | Suggestions for removing or reducing risk |
bias_score | number | Numerical score indicating risk severity (0-100) |
detail | string | Additional processing information |
message | string | Operation status message |
isSuccess | boolean | Indicates if the operation was successful |
Bias Score Ranges
Range | Description |
---|---|
0-30 | Low risk |
31-70 | Moderate risk |
71-100 | High risk |