API Documentation
Base URL
https://your-app.onrender.com
Replace with your deployed Render URL
GET
/
Health check endpoint. Returns service status.
Response
{
"status": "online",
"service": "AuthentiText AI API",
"version": "1.0.0",
"endpoints": {
"POST /predict": "Analyze text for AI generation probability"
}
}
POST
/predict
Analyze text and predict whether it is AI-generated or human-written.
Request Headers
Content-Type: application/json
Request Body
{
"text": "Your text to analyze (minimum 50 words)"
}
✅ Success Response (200)
{
"prediction": "AI Generated",
"confidence": 0.8733,
"label": 1,
"word_count": 70,
"human_probability": 0.1267,
"ai_probability": 0.8733
}
Response Fields
| Field | Type | Description |
|---|---|---|
| prediction | string | "AI Generated" or "Human Written" |
| confidence | float | Confidence score (0 to 1) |
| label | int | 0 = Human, 1 = AI |
| word_count | int | Number of words in input |
| human_probability | float | Probability of being human-written |
| ai_probability | float | Probability of being AI-generated |
❌ Error Responses
400 — { "error": "Text too short. Minimum 50 words required. You provided 12 words." }
400 — { "error": "Text field is empty. Please provide text to analyze." }
400 — { "error": "Invalid request. Please send JSON with a 'text' field." }
📎 cURL Example
curl -X POST https://your-app.onrender.com/predict \
-H "Content-Type: application/json" \
-d '{"text": "Your text to analyze goes here..."}'
📎 JavaScript (fetch) Example
const response = await fetch('/predict', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ text: 'Your text here...' })
});
const data = await response.json();
console.log(data.prediction, data.confidence);