Skip to main content

Predict

Predict STR Fraud

POST /predict/str-fraud

Predict fraud risk for Short-Term Rental reservations

Analyzes STR reservation features using a trained ML model and returns a fraud probability score with risk tier classification. All input features are optional with sensible defaults. The model performs best when more features are provided.

Parameters

NameInTypeRequiredDescription
x-api-keyheaderstringfalseAPI Authentication Key
bodybodyReservationFeaturesfalseReservation features for fraud prediction

Body parameter

{
"lead_time_days": 7,
"nights": 3,
"guests_count": 2,
"price_total": 450
}

Example responses

Successful prediction with fraud probability and risk tier

{
"fraud_probability": 0.065,
"risk_tier": "auto_approve",
"action": "Automatic approval - low risk",
"threshold_info": {
"auto_approve_max": 0.13,
"review_min": 0.13,
"flag_min": 0.325
}
}
{
"fraud_probability": 0.22,
"risk_tier": "review",
"action": "Human review required",
"threshold_info": {
"auto_approve_max": 0.13,
"review_min": 0.13,
"flag_min": 0.325
}
}
{
"fraud_probability": 0.78,
"risk_tier": "flag",
"action": "Flag for immediate attention - high risk",
"threshold_info": {
"auto_approve_max": 0.13,
"review_min": 0.13,
"flag_min": 0.325
}
}

Invalid input - validation errors

{
"error": "Invalid input",
"details": [
{
"loc": [
"nights"
],
"msg": "Input should be greater than or equal to 0",
"type": "greater_than_equal"
}
]
}

500 Response

{
"error": "string"
}

Responses

StatusMeaningDescriptionSchema
200OKSuccessful prediction with fraud probability and risk tierPredictionResult
400Bad RequestInvalid input - validation errorsValidationErrorResponse
500Internal Server ErrorInternal server errorErrorResponse

Code samples

"""
Python Code Snippet
"""
import requests

headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'x-api-key': 'string'
}

r = requests.post('https://data.autohost.ai/v1/predict/str-fraud', headers=headers)

print(r.json())

/*
TypeScript Code Snippet
*/

import fetch from 'node-fetch';
const inputBody = {
"lead_time_days": 7,
"nights": 3,
"guests_count": 2,
"price_total": 450
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'x-api-key':'string'
};

const response = await fetch('https://data.autohost.ai/v1/predict/str-fraud', {
method: 'post',
body: JSON.stringify(inputBody),
headers,
});
const responseJson = await response.json();
console.log(responseJson);