Skip to main content

Loyalty

Predict guest loyalty for a reservation

POST /loyalty/guest-loyalty

Predict guest rebooking probability and lifetime value for short-term rentals. Returns rebooking probability score (0-100) with loyalty tier, and predicted Guest Lifetime Value (USD) with value tier.

Parameters

NameInTypeRequiredDescription
x-api-keyheaderstringfalseAPI Authentication Key
bodybodyGuestLoyaltyFeaturesfalseGuest loyalty features for prediction

Body parameter

{
"lead_time_days": 7,
"nights": 3,
"number_of_guests": 2,
"total_price": 450
}

Example responses

Successful loyalty prediction with rebooking score and GLV

{
"rebooking_score": 75.5,
"rebooking_tier": "high_loyalty",
"rebooking_tier_description": "Top prospects for re-engagement",
"predicted_glv": 2500,
"glv_tier": "high_value",
"glv_tier_description": "VIP treatment candidates",
"threshold_info": {
"rebooking_high_min": 70,
"rebooking_medium_min": 40,
"glv_high_min": 2000,
"glv_medium_min": 500
}
}
{
"rebooking_score": 20.3,
"rebooking_tier": "low_loyalty",
"rebooking_tier_description": "Unlikely to rebook",
"predicted_glv": 150,
"glv_tier": "low_value",
"glv_tier_description": "Standard service",
"threshold_info": {
"rebooking_high_min": 70,
"rebooking_medium_min": 40,
"glv_high_min": 2000,
"glv_medium_min": 500
}
}

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 loyalty prediction with rebooking score and GLVLoyaltyPredictionResult
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,
"number_of_guests": 2,
"total_price": 450
}

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

r = requests.post('https://data.autohost.ai/v1/loyalty/guest-loyalty', json=input_body, headers=headers)

print(r.json())

/*
TypeScript Code Snippet
*/

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

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

Look up RFM segment for a guest

GET /loyalty/guest-segmentation/{segment}

Look up RFM segment for a guest. The segment path parameter accepts a guest ID (email address or phone number). Optionally filter by property manager.

Parameters

NameInTypeRequiredDescription
segmentpathstringtrueGuest ID (email address or phone number)
property_manager_idquerystringfalseOptional filter for specific property manager
x-api-keyheaderstringfalseAPI Authentication Key

Example responses

RFM segmentation result

{
"guest_id": "guest@example.com",
"property_manager_id": "pm_12345",
"timestamp": "2026-01-15T10:30:00Z",
"segment": {
"name": "Champions",
"tier": 1,
"description": "Best customers who book frequently and spend the most",
"recommended_action": "Offer exclusive perks and early access",
"offer_type": "VIP",
"priority": "CRITICAL"
},
"rfm_scores": {
"recency": 5,
"frequency": 5,
"monetary": 4,
"composite": "554"
},
"metrics": {
"days_since_last_stay": 15,
"last_stay_date": "2026-01-01",
"first_stay_date": "2024-06-15",
"total_stays": 8,
"total_revenue": 4200,
"total_nights": 24,
"avg_booking_value": 525,
"nights_equivalent": 3,
"customer_tenure_days": 549
},
"data_quality": {
"confidence": "HIGH",
"has_email": true,
"has_phone": true,
"is_ota_masked": false,
"identifier_type": "email"
},
"top_factors": [
{
"factor": "total_stays",
"value": "8",
"impact": "positive",
"description": "Frequent repeat guest"
},
{
"factor": "total_revenue",
"value": "4200",
"impact": "positive",
"description": "High lifetime spending"
}
],
"flags": {
"is_corporate_account": false,
"is_ota_guest": false,
"has_future_booking": true,
"is_seasonal_guest": false
}
}

Guest not found

{
"error": "GUEST_NOT_FOUND",
"message": "No RFM data found for guest: unknown@example.com",
"suggestions": [
"Verify the guest ID (email or phone) is correct",
"Guest may not have enough booking history",
"Try searching with a different identifier"
]
}

503 Response

{
"error": "string"
}

Responses

StatusMeaningDescriptionSchema
200OKRFM segmentation resultRFMSegmentResult
404Not FoundGuest not foundRFMNotFoundError
503Service UnavailableService unavailableErrorResponse

Code samples

"""
Python Code Snippet
"""
import requests

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

r = requests.get('https://data.autohost.ai/v1/loyalty/guest-segmentation/{segment}', headers=headers)

print(r.json())

/*
TypeScript Code Snippet
*/

import fetch from 'node-fetch';

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

const response = await fetch('https://data.autohost.ai/v1/loyalty/guest-segmentation/{segment}', {
method: 'get',

headers,
});
const responseJson = await response.json();
console.log(responseJson);

Schemas

GuestLoyaltyFeatures

{
"booking_month": 6,
"booking_dow": 3,
"booking_hour": 12,
"checkin_dow": 4,
"checkin_month": 6,
"email_domain_rank": 0,
"risk_color_encoded": 0,
"city_rank": 0,
"lead_time_days": 14,
"nights": 2,
"total_price": 300,
"average_daily_rate": 150,
"number_of_guests": 2,
"price_tier": 2,
"revenue_per_guest_night": 75,
"bedrooms": 1,
"guest_density": 2,
"prior_bookings_30d": 0,
"prior_bookings_90d": 0,
"prior_bookings_365d": 0,
"prior_revenue_total": 0,
"prior_bookings_same_pm": 0,
"days_since_last_booking": 0,
"booking_intensity": 0,
"max_guests": 4,
"capacity_utilization": 0.5,
"payment_success_count": 0,
"payment_failure_count": 0,
"distinct_cards": 0,
"payment_success_ratio": 0,
"idv_attempt_count": 0,
"idv_success_count": 0,
"idv_success_ratio": 0,
"portal_started": 0,
"portal_completed": 0,
"screens_count": 0,
"total_activity_events": 0,
"portal_completion_rate": 0,
"distinct_fingerprints": 0,
"distinct_ips": 0,
"total_fingerprint_events": 0,
"avg_confidence": 0,
"incident_count": 0,
"is_direct_booking": 0,
"is_ota_booking": 0,
"is_free_email": 0,
"is_booking_guest": 1,
"is_long_stay": 0,
"has_prior_booking": 0,
"has_idv_enabled": 0,
"has_payment_data": 0,
"has_payment_issues": 0,
"has_idv_data": 0,
"idv_completed": 0,
"has_payment_failure": 0,
"has_activity_data": 0,
"has_multiple_devices": 0,
"has_fingerprint_data": 0,
"has_chargeback_incident": 0,
"has_fraud_warning": 0,
"has_creditcard_incident": 0,
"has_any_incident": 0,
"is_verified": 0,
"guestportal_completed_flag": 0
}

Properties

NameTypeRequiredRestrictionsDescription
booking_monthnumberfalsenoneMonth of booking (1-12)
booking_downumberfalsenoneDay of week for booking (0=Mon, 6=Sun)
booking_hournumberfalsenoneHour of day booking was made (0-23)
checkin_downumberfalsenoneDay of week for check-in (0=Mon, 6=Sun)
checkin_monthnumberfalsenoneMonth of check-in (1-12)
email_domain_ranknumberfalsenoneEmail domain frequency rank (lower = more common)
risk_color_encodednumberfalsenoneRisk color encoding (0=green, 1=yellow, 2=orange, 3=red, 4=black)
city_ranknumberfalsenoneCity frequency rank (lower = more common)
lead_time_daysnumberfalsenoneDays between booking and check-in
nightsnumberfalsenoneLength of stay in nights
total_pricenumberfalsenoneTotal booking price in USD
average_daily_ratenumberfalsenoneAverage price per night
number_of_guestsnumberfalsenoneNumber of guests
price_tiernumberfalsenonePrice tier category (0-5, higher = more expensive)
revenue_per_guest_nightnumberfalsenoneRevenue per guest per night
bedroomsnumberfalsenoneNumber of bedrooms in listing
guest_densitynumberfalsenoneGuests per bedroom
prior_bookings_30dnumberfalsenonePrior bookings by this guest in last 30 days
prior_bookings_90dnumberfalsenonePrior bookings by this guest in last 90 days
prior_bookings_365dnumberfalsenonePrior bookings by this guest in last 365 days
prior_revenue_totalnumberfalsenoneTotal revenue from prior bookings
prior_bookings_same_pmnumberfalsenonePrior bookings with the same property manager
days_since_last_bookingnumberfalsenoneDays since guest's last booking (0 if first booking)
booking_intensitynumberfalsenoneBooking frequency score
max_guestsnumberfalsenoneMaximum guests allowed at listing
capacity_utilizationnumberfalsenoneRatio of guests to max capacity
payment_success_countnumberfalsenoneSuccessful payment count
payment_failure_countnumberfalsenoneFailed payment count
distinct_cardsnumberfalsenoneNumber of distinct payment cards used
payment_success_rationumberfalsenoneRatio of successful to total payment attempts
idv_attempt_countnumberfalsenoneID verification attempt count
idv_success_countnumberfalsenoneSuccessful ID verification count
idv_success_rationumberfalsenoneID verification success rate
portal_startednumberfalsenoneGuest portal started count
portal_completednumberfalsenoneGuest portal completed count
screens_countnumberfalsenoneNumber of portal screens viewed
total_activity_eventsnumberfalsenoneTotal activity log events
portal_completion_ratenumberfalsenonePortal completion rate
distinct_fingerprintsnumberfalsenoneNumber of distinct device fingerprints
distinct_ipsnumberfalsenoneNumber of distinct IP addresses
total_fingerprint_eventsnumberfalsenoneTotal fingerprint events
avg_confidencenumberfalsenoneAverage fingerprint confidence score
incident_countnumberfalsenoneTotal incident count for guest
is_direct_bookingnumberfalsenone1 if direct booking, 0 otherwise
is_ota_bookingnumberfalsenone1 if OTA booking (Airbnb, VRBO, etc.)
is_free_emailnumberfalsenone1 if using free email provider (gmail, yahoo, etc.)
is_booking_guestnumberfalsenone1 if guest made the booking themselves
is_long_staynumberfalsenone1 if stay is 7+ nights
has_prior_bookingnumberfalsenone1 if guest has prior bookings
has_idv_enablednumberfalsenone1 if ID verification was enabled for this booking
has_payment_datanumberfalsenone1 if payment data available
has_payment_issuesnumberfalsenone1 if any payment issues occurred
has_idv_datanumberfalsenone1 if ID verification data available
idv_completednumberfalsenone1 if ID verification was completed
has_payment_failurenumberfalsenone1 if any payment failures
has_activity_datanumberfalsenone1 if activity log data available
has_multiple_devicesnumberfalsenone1 if multiple devices detected
has_fingerprint_datanumberfalsenone1 if fingerprint data available
has_chargeback_incidentnumberfalsenone1 if guest has chargeback history
has_fraud_warningnumberfalsenone1 if fraud warning on record
has_creditcard_incidentnumberfalsenone1 if credit card incident on record
has_any_incidentnumberfalsenone1 if any incident on record
is_verifiednumberfalsenone1 if guest identity is verified
guestportal_completed_flagnumberfalsenone1 if guest portal was completed

LoyaltyPredictionResult

{
"rebooking_score": 100,
"rebooking_tier": "high_loyalty",
"rebooking_tier_description": "string",
"predicted_glv": 0,
"glv_tier": "high_value",
"glv_tier_description": "string",
"threshold_info": {
"rebooking_high_min": 70,
"rebooking_medium_min": 40,
"glv_high_min": 2000,
"glv_medium_min": 500
}
}

Properties

NameTypeRequiredRestrictionsDescription
rebooking_scorenumbertruenoneRebooking probability score (0-100)
rebooking_tierstringtruenoneLoyalty classification tier
rebooking_tier_descriptionstringtruenoneDescription of the loyalty tier
predicted_glvnumbertruenonePredicted Guest Lifetime Value in USD
glv_tierstringtruenoneGLV classification tier
glv_tier_descriptionstringtruenoneDescription of the GLV tier
threshold_infoobjecttruenoneThreshold configuration used for classification
» rebooking_high_minnumberfalsenonenone
» rebooking_medium_minnumberfalsenonenone
» glv_high_minnumberfalsenonenone
» glv_medium_minnumberfalsenonenone

Enumerated Values

PropertyValue
rebooking_tierhigh_loyalty
rebooking_tiermedium_loyalty
rebooking_tierlow_loyalty
glv_tierhigh_value
glv_tiermedium_value
glv_tierlow_value

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

RFMBatchRequest

{
"guest_ids": [
"string"
],
"property_manager_id": "string"
}

Properties

NameTypeRequiredRestrictionsDescription
guest_ids[string]truenoneMax 100 guest IDs per request
property_manager_idstringfalsenonenone

RFMBatchResult

{
"results": [
{
"guest_id": "string",
"property_manager_id": "string",
"timestamp": "string",
"segment": {},
"rfm_scores": {},
"metrics": {},
"data_quality": {},
"top_factors": [],
"flags": {}
}
],
"not_found": [
"string"
],
"total_requested": 0,
"total_found": 0
}

Properties

NameTypeRequiredRestrictionsDescription
results[object]truenonenone
» guest_idstringfalsenonenone
» property_manager_idstringfalsenonenone
» timestampstringfalsenonenone
» segmentobjectfalsenonenone
» rfm_scoresobjectfalsenonenone
» metricsobjectfalsenonenone
» data_qualityobjectfalsenonenone
» top_factorsarrayfalsenonenone
» flagsobjectfalsenonenone
not_found[string]truenonenone
total_requestednumbertruenonenone
total_foundnumbertruenonenone

RFMSegmentResult

{
"guest_id": "string",
"property_manager_id": "string",
"timestamp": "string",
"segment": {
"name": "Champions",
"tier": 1,
"description": "string",
"recommended_action": "string",
"offer_type": "string",
"priority": "CRITICAL"
},
"rfm_scores": {
"recency": 1,
"frequency": 2,
"monetary": 1,
"composite": "string"
},
"metrics": {
"days_since_last_stay": 0,
"last_stay_date": "string",
"first_stay_date": "string",
"total_stays": 0,
"total_revenue": 0,
"total_nights": 0,
"avg_booking_value": 0,
"nights_equivalent": 0,
"customer_tenure_days": 0
},
"data_quality": {
"confidence": "HIGH",
"has_email": true,
"has_phone": true,
"is_ota_masked": true,
"identifier_type": "string"
},
"top_factors": [
{
"factor": "string",
"value": "string",
"impact": "string",
"description": "string"
}
],
"flags": {
"is_corporate_account": false,
"is_ota_guest": true,
"has_future_booking": false,
"is_seasonal_guest": false
}
}

Properties

NameTypeRequiredRestrictionsDescription
guest_idstringtruenonenone
property_manager_idstringtruenonenone
timestampstringtruenonenone
segmentobjecttruenoneSegment classification with actionable guidance
» namestringtruenoneSegment name
» tiernumbertruenonePriority tier (1=highest)
» descriptionstringtruenonenone
» recommended_actionstringtruenonenone
» offer_typestringtruenonenone
» prioritystringtruenonenone
rfm_scoresobjecttruenoneRFM score breakdown
» recencynumbertruenonenone
» frequencynumbertruenonenone
» monetarynumbertruenonenone
» compositestringtruenoneCombined RFM score (e.g. '554')
metricsobjecttruenoneGuest behavioral metrics
» days_since_last_staynumbertruenonenone
» last_stay_datestringtruenonenone
» first_stay_datestringtruenonenone
» total_staysnumbertruenonenone
» total_revenuenumbertruenonenone
» total_nightsnumbertruenonenone
» avg_booking_valuenumbertruenonenone
» nights_equivalentnumbertruenonenone
» customer_tenure_daysnumbertruenonenone
data_qualityobjecttruenoneData quality indicators
» confidencestringtruenonenone
» has_emailbooleantruenonenone
» has_phonebooleantruenonenone
» is_ota_maskedbooleantruenonenone
» identifier_typestringtruenone'email' or 'phone'
top_factors[object]truenoneExplanation factors for segment assignment
» factorstringtruenonenone
» valuestringtruenonenone
» impactstringtruenone'positive' or 'negative'
» descriptionstringtruenonenone
flagsobjecttruenoneGuest classification flags
» is_corporate_accountbooleanfalsenonenone
» is_ota_guestbooleanfalsenonenone
» has_future_bookingbooleanfalsenonenone
» is_seasonal_guestbooleanfalsenonenone

Enumerated Values

PropertyValue
nameChampions
nameHigh Value Active
nameHigh Value At Risk
nameHigh Value Slipping
nameLoyal Active
nameLoyal At Risk
namePotential Loyalists
nameRepeat At Risk
namePromising First-Timers
nameRecent First-Timers
nameFirst-Timers Need Attention
nameHibernating
nameOther
priorityCRITICAL
priorityHIGH
priorityMEDIUM
priorityLOW
confidenceHIGH
confidenceMEDIUM
confidenceLOW
confidenceUNKNOWN

RFMNotFoundError

{
"error": "GUEST_NOT_FOUND",
"message": "string",
"suggestions": [
"string"
]
}

Properties

NameTypeRequiredRestrictionsDescription
errorstringfalsenonenone
messagestringtruenonenone
suggestions[string]truenonenone