Guest Update
Update a Guest
Whenever a guest asks to change their details, or you just need to fix a typo, you can use this endpoint to smoothly update their profile information. You are able to easily modify their contact details, address, preferences, and other essential guest information. When you send updates, our system will double-check everything, making sure the new info is valid and won't clash with any existing accounts.
Endpoint
PATCH /api/v1/client/guests/{guestId}Example curl
curl "/api/v1/client/guests/f1b2c3d4-5678-49ab-9cde-112233445566" \
-X PATCH \
-H "accept: application/json" \
-H "content-type: application/json" \
-H "origin: https://docs.hostelmate.co" \
--data-raw '{
"guest": {
"phone": "+447712345678",
"address": {
"line1": "Westminster",
"city": "London",
"postal_code": "SW1A 1AA",
"country_code": "GB"
},
"preferences": {
"language": "en",
"newsletter": false,
"marketing": true
}
}
}'Pro-Tip: This is a partial update! That means you only need to include the exact fields you want to change. No need to send over data that's staying exactly the same.
Request Payload
Here's exactly what you can include in your update.
Top-level Fields
guest
object
The main container for all your updates, covering contact details, address, and preferences.
Guest Object (updatable)
first_name
string
The guest's updated first name.
last_name
string
The guest's updated last name.
email
string
The guest's updated email address. (Just make sure it's a valid email format!)
phone
string
The guest's updated phone number. We highly recommend using the E.164 format.
country_code
string
The guest's new country code. (Needs to be ISO 3166-1 alpha-2)
address
object
The guest's updated postal address (see the breakdown below).
date_of_birth
string
The guest's updated date of birth (Use the format: YYYY-MM-DD).
nationality
string
The guest's updated nationality. (Needs to be ISO 3166-1 alpha-2)
preferences
object
The guest's updated preferences (see the breakdown below).
Address Object
line1
string
The main street address line.
city
string
The city they reside in.
postal_code
string
Their postal or ZIP code.
country_code
string
Their country code in ISO 3166-1 alpha-2 format (e.g., GB).
Preferences Object
language
string
Their preferred language code (e.g., en, fr).
newsletter
boolean
Let us know if they want to subscribe to newsletters.
marketing
boolean
Let us know if they consented to marketing communications.
Response (200 OK)
If everything goes perfectly, you'll receive a response looking like this:
Validation Rules
To keep your data pristine, we enforce a few simple rules:
You only have to send the data you want to change! Missing fields are safely ignored and left as-is.
If you decide to send an
email, we'll check to make sure it's valid and isn't already claimed by another guest.The
date_of_birthneeds to use the classic YYYY-MM-DD format.Both
country_codeandnationalityrequire standard ISO 3166-1 alpha-2 codes.If you include a
phonenumber, the standard E.164 format works best!
Error Codes
Sometimes things don't go according to plan! Here's a quick cheat sheet for interpreting the errors:
400
bad_request
Something looks slightly off with the fields or payload structure you provided.
404
guest_not_found
We couldn't seem to find a guest sharing that specific guestId.
409
email_conflict
Looks like that new email address is already being used by another guest!
422
invalid_country_code
The country code or nationality you gave us doesn't seem valid.
422
invalid_date_format
The date format for date_of_birth wasn't recognized.
500
server_error
An unexpected server hiccup occurred on our end.
Last updated