Predict
Predict fraud risk for a reservation
POST /predict/str-fraud
Analyzes 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
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| x-api-key | header | string | false | API Authentication Key |
| body | body | ReservationFeatures | false | Reservation 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
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | Successful prediction with fraud probability and risk tier | PredictionResult |
| 400 | Bad Request | Invalid input - validation errors | ValidationErrorResponse |
| 500 | Internal Server Error | Internal server error | ErrorResponse |
Code samples
"""
Python Code Snippet
"""
import requests
input_body = {
"lead_time_days": 7,
"nights": 3,
"guests_count": 2,
"price_total": 450
}
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'x-api-key': 'string'
}
r = requests.post('https://data.autohost.ai/v1/predict/str-fraud', json=input_body, 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);
Schemas
ReservationFeatures
{
"lead_time_days": 0,
"nights": 1,
"guests_count": 1,
"booking_hour": 12,
"is_weekend_booking": 0,
"price_total": 0,
"has_phone": 0,
"name_word_count": 2,
"risk_color_numeric": 0,
"stripe_fraud_numeric": 0,
"blacklist_count": 0,
"verification_status_numeric": 0,
"stripe_decline_count": 0,
"idv_attempt_count": 0,
"idv_success_count": 0,
"idv_failure_count": 0,
"idv_success_ratio": 0,
"blurred_front_count": 0,
"blurred_back_count": 0,
"payment_event_count": 0,
"payment_success_count": 0,
"payment_failure_count": 0,
"payment_failure_ratio": 0,
"distinct_cards": 0,
"has_chargeback": 0,
"has_dispute": 0,
"has_refund": 0,
"has_stolen_card_flag": 0,
"has_fraudulent_flag": 0,
"has_lost_card_flag": 0,
"has_highest_risk_flag": 0,
"has_blocklist_flag": 0,
"insufficient_funds_count": 0,
"do_not_honor_count": 0,
"fingerprint_count": 0,
"distinct_fingerprints": 0,
"distinct_ips": 0,
"has_stripe_fp": 0,
"has_fpjspro_fp": 0,
"has_default_fp": 0,
"prior_res_same_email_30d": 0,
"prior_res_same_email_90d": 0,
"distinct_listings_90d": 0,
"has_booking_data": 1,
"has_idv_data": 0,
"has_payment_data": 0,
"has_fingerprint_data": 0,
"has_velocity_data": 0,
"email_domain_freq": 0,
"booking_source_freq": 0,
"first_idv_status_freq": 0,
"last_idv_status_freq": 0,
"first_recognition_status_STAGE_VALID": 0,
"first_recognition_status_UNCERTAIN": 0,
"first_recognition_status_VALID": 0,
"first_recognition_status_unknown": 0,
"last_recognition_status_STAGE_VALID": 0,
"last_recognition_status_UNCERTAIN": 0,
"last_recognition_status_VALID": 0,
"last_recognition_status_unknown": 0,
"earliest_fp_engine_fpjspro": 0,
"earliest_fp_engine_guesty": 0,
"earliest_fp_engine_stripe": 0,
"earliest_fp_engine_unknown": 0,
"price_per_night": 0,
"has_idv_failure": 0,
"payment_risk_score": 0,
"high_velocity_flag": 0,
"multiple_cards_flag": 0
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| lead_time_days | number | false | none | Days between booking and check-in |
| nights | number | false | none | Length of stay in nights |
| guests_count | number | false | none | Number of guests |
| booking_hour | number | false | none | Hour of day booking was made (0-23) |
| is_weekend_booking | number | false | none | 1 if booked on weekend, 0 otherwise |
| price_total | number | false | none | Total booking price |
| has_phone | number | false | none | 1 if phone number provided |
| name_word_count | number | false | none | Words in guest name |
| risk_color_numeric | number | false | none | Risk color (0=green, 1=yellow, 2=orange, 3=red, 4=black) |
| stripe_fraud_numeric | number | false | none | Stripe fraud level (0-2) |
| blacklist_count | number | false | none | Blacklist match count |
| verification_status_numeric | number | false | none | Verification status (0-2) |
| stripe_decline_count | number | false | none | Prior Stripe declines |
| idv_attempt_count | number | false | none | ID verification attempts |
| idv_success_count | number | false | none | Successful ID verification attempts |
| idv_failure_count | number | false | none | Failed ID verification attempts |
| idv_success_ratio | number | false | none | ID verification success rate |
| blurred_front_count | number | false | none | Blurred front ID scans |
| blurred_back_count | number | false | none | Blurred back ID scans |
| payment_event_count | number | false | none | Total payment events |
| payment_success_count | number | false | none | Successful payments |
| payment_failure_count | number | false | none | Failed payments |
| payment_failure_ratio | number | false | none | Payment failure rate |
| distinct_cards | number | false | none | Distinct cards used |
| has_chargeback | number | false | none | 1 if has chargeback |
| has_dispute | number | false | none | 1 if has dispute |
| has_refund | number | false | none | 1 if has refund |
| has_stolen_card_flag | number | false | none | 1 if stolen card detected |
| has_fraudulent_flag | number | false | none | 1 if fraudulent flag |
| has_lost_card_flag | number | false | none | 1 if lost card detected |
| has_highest_risk_flag | number | false | none | 1 if highest risk |
| has_blocklist_flag | number | false | none | 1 if on blocklist |
| insufficient_funds_count | number | false | none | Insufficient funds events |
| do_not_honor_count | number | false | none | Do not honor events |
| fingerprint_count | number | false | none | Total fingerprints |
| distinct_fingerprints | number | false | none | Distinct fingerprints |
| distinct_ips | number | false | none | Distinct IP addresses |
| has_stripe_fp | number | false | none | Has Stripe fingerprint |
| has_fpjspro_fp | number | false | none | Has FPJSPro fingerprint |
| has_default_fp | number | false | none | Has default fingerprint |
| prior_res_same_email_30d | number | false | none | Prior bookings same email (30 days) |
| prior_res_same_email_90d | number | false | none | Prior bookings same email (90 days) |
| distinct_listings_90d | number | false | none | Distinct listings booked (90 days) |
| has_booking_data | number | false | none | Has booking data |
| has_idv_data | number | false | none | Has ID verification data |
| has_payment_data | number | false | none | Has payment data |
| has_fingerprint_data | number | false | none | Has fingerprint data |
| has_velocity_data | number | false | none | Has velocity data |
| email_domain_freq | number | false | none | Email domain frequency encoding |
| booking_source_freq | number | false | none | Booking source frequency encoding |
| first_idv_status_freq | number | false | none | First IDV status encoding |
| last_idv_status_freq | number | false | none | Last IDV status encoding |
| first_recognition_status_STAGE_VALID | number | false | none | none |
| first_recognition_status_UNCERTAIN | number | false | none | none |
| first_recognition_status_VALID | number | false | none | none |
| first_recognition_status_unknown | number | false | none | none |
| last_recognition_status_STAGE_VALID | number | false | none | none |
| last_recognition_status_UNCERTAIN | number | false | none | none |
| last_recognition_status_VALID | number | false | none | none |
| last_recognition_status_unknown | number | false | none | none |
| earliest_fp_engine_fpjspro | number | false | none | none |
| earliest_fp_engine_guesty | number | false | none | none |
| earliest_fp_engine_stripe | number | false | none | none |
| earliest_fp_engine_unknown | number | false | none | none |
| price_per_night | number | false | none | Price per night |
| has_idv_failure | number | false | none | Has IDV failure |
| payment_risk_score | number | false | none | Composite payment risk score |
| high_velocity_flag | number | false | none | High booking velocity |
| multiple_cards_flag | number | false | none | Multiple cards used |
PredictionResult
{
"fraud_probability": 1,
"risk_tier": "auto_approve",
"action": "string",
"threshold_info": {
"auto_approve_max": 0.13,
"review_min": 0.13,
"flag_min": 0.325
}
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| fraud_probability | number | true | none | Probability of fraud (0.0 to 1.0) |
| risk_tier | string | true | none | Risk classification tier |
| action | string | true | none | Recommended action based on risk tier |
| threshold_info | object | true | none | Threshold configuration used for classification |
| » auto_approve_max | number | false | none | none |
| » review_min | number | false | none | none |
| » flag_min | number | false | none | none |
Enumerated Values
| Property | Value |
|---|---|
| risk_tier | auto_approve |
| risk_tier | review |
| risk_tier | flag |
ValidationErrorResponse
{
"error": "Invalid input",
"details": [
{
"loc": [
"string"
],
"msg": "string",
"type": "string"
}
]
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| error | string | false | none | Error type |
| details | [object] | true | none | Validation error details |
| » loc | [string] | false | none | none |
| » msg | string | false | none | none |
| » type | string | false | none | none |
ErrorResponse
{
"error": "string"
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| error | string | false | none | none |