Skip to main content

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

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

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

NameTypeRequiredRestrictionsDescription
lead_time_daysnumberfalsenoneDays between booking and check-in
nightsnumberfalsenoneLength of stay in nights
guests_countnumberfalsenoneNumber of guests
booking_hournumberfalsenoneHour of day booking was made (0-23)
is_weekend_bookingnumberfalsenone1 if booked on weekend, 0 otherwise
price_totalnumberfalsenoneTotal booking price
has_phonenumberfalsenone1 if phone number provided
name_word_countnumberfalsenoneWords in guest name
risk_color_numericnumberfalsenoneRisk color (0=green, 1=yellow, 2=orange, 3=red, 4=black)
stripe_fraud_numericnumberfalsenoneStripe fraud level (0-2)
blacklist_countnumberfalsenoneBlacklist match count
verification_status_numericnumberfalsenoneVerification status (0-2)
stripe_decline_countnumberfalsenonePrior Stripe declines
idv_attempt_countnumberfalsenoneID verification attempts
idv_success_countnumberfalsenoneSuccessful ID verification attempts
idv_failure_countnumberfalsenoneFailed ID verification attempts
idv_success_rationumberfalsenoneID verification success rate
blurred_front_countnumberfalsenoneBlurred front ID scans
blurred_back_countnumberfalsenoneBlurred back ID scans
payment_event_countnumberfalsenoneTotal payment events
payment_success_countnumberfalsenoneSuccessful payments
payment_failure_countnumberfalsenoneFailed payments
payment_failure_rationumberfalsenonePayment failure rate
distinct_cardsnumberfalsenoneDistinct cards used
has_chargebacknumberfalsenone1 if has chargeback
has_disputenumberfalsenone1 if has dispute
has_refundnumberfalsenone1 if has refund
has_stolen_card_flagnumberfalsenone1 if stolen card detected
has_fraudulent_flagnumberfalsenone1 if fraudulent flag
has_lost_card_flagnumberfalsenone1 if lost card detected
has_highest_risk_flagnumberfalsenone1 if highest risk
has_blocklist_flagnumberfalsenone1 if on blocklist
insufficient_funds_countnumberfalsenoneInsufficient funds events
do_not_honor_countnumberfalsenoneDo not honor events
fingerprint_countnumberfalsenoneTotal fingerprints
distinct_fingerprintsnumberfalsenoneDistinct fingerprints
distinct_ipsnumberfalsenoneDistinct IP addresses
has_stripe_fpnumberfalsenoneHas Stripe fingerprint
has_fpjspro_fpnumberfalsenoneHas FPJSPro fingerprint
has_default_fpnumberfalsenoneHas default fingerprint
prior_res_same_email_30dnumberfalsenonePrior bookings same email (30 days)
prior_res_same_email_90dnumberfalsenonePrior bookings same email (90 days)
distinct_listings_90dnumberfalsenoneDistinct listings booked (90 days)
has_booking_datanumberfalsenoneHas booking data
has_idv_datanumberfalsenoneHas ID verification data
has_payment_datanumberfalsenoneHas payment data
has_fingerprint_datanumberfalsenoneHas fingerprint data
has_velocity_datanumberfalsenoneHas velocity data
email_domain_freqnumberfalsenoneEmail domain frequency encoding
booking_source_freqnumberfalsenoneBooking source frequency encoding
first_idv_status_freqnumberfalsenoneFirst IDV status encoding
last_idv_status_freqnumberfalsenoneLast IDV status encoding
first_recognition_status_STAGE_VALIDnumberfalsenonenone
first_recognition_status_UNCERTAINnumberfalsenonenone
first_recognition_status_VALIDnumberfalsenonenone
first_recognition_status_unknownnumberfalsenonenone
last_recognition_status_STAGE_VALIDnumberfalsenonenone
last_recognition_status_UNCERTAINnumberfalsenonenone
last_recognition_status_VALIDnumberfalsenonenone
last_recognition_status_unknownnumberfalsenonenone
earliest_fp_engine_fpjspronumberfalsenonenone
earliest_fp_engine_guestynumberfalsenonenone
earliest_fp_engine_stripenumberfalsenonenone
earliest_fp_engine_unknownnumberfalsenonenone
price_per_nightnumberfalsenonePrice per night
has_idv_failurenumberfalsenoneHas IDV failure
payment_risk_scorenumberfalsenoneComposite payment risk score
high_velocity_flagnumberfalsenoneHigh booking velocity
multiple_cards_flagnumberfalsenoneMultiple 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

NameTypeRequiredRestrictionsDescription
fraud_probabilitynumbertruenoneProbability of fraud (0.0 to 1.0)
risk_tierstringtruenoneRisk classification tier
actionstringtruenoneRecommended action based on risk tier
threshold_infoobjecttruenoneThreshold configuration used for classification
» auto_approve_maxnumberfalsenonenone
» review_minnumberfalsenonenone
» flag_minnumberfalsenonenone

Enumerated Values

PropertyValue
risk_tierauto_approve
risk_tierreview
risk_tierflag

ValidationErrorResponse

{
"error": "Invalid input",
"details": [
{
"loc": [
"string"
],
"msg": "string",
"type": "string"
}
]
}

Properties

NameTypeRequiredRestrictionsDescription
errorstringfalsenoneError type
details[object]truenoneValidation error details
» loc[string]falsenonenone
» msgstringfalsenonenone
» typestringfalsenonenone

ErrorResponse

{
"error": "string"
}

Properties

NameTypeRequiredRestrictionsDescription
errorstringfalsenonenone