# Create and update bookings

**Booking update**

In the case of a booking update, it is essential to return ALL the attributes of the booking & customer objects. If some attributes are not included in an update **they will be set to NULL or deleted.**

## Request&#x20;

<mark style="color:orange;">**POST**</mark>  &#x20;

{% code overflow="wrap" %}

```url
https://interface.experience-hotel.com/api/xp-store-bookings/bookings
```

{% endcode %}

```json
{
"bookings" : [
	{
		"reference": "test",
		"status": "valid",
		"creation": "2021-06-01 15:22:00",
		"arrival": "2021-09-17",
		"departure": "2021-09-20",
            	"arrival_time": "14:50:00",
		"ratecode": "PAKG",
		"sourcecode": "XP API",
		"segmentcode": "OTA",
	        "adult_count": "2",
	        "extra_attributes": {
	        	"Payment":"pending",
	                "linkId":"126",
	                "xp-company":"Air France"
            	},
		"rooms": [
			{
				"type": "DBL",
				"name": "Double",
				"number": 16
			}
		],
		"totalamount": "460",
		"currency": "EUR",
		"customer": {
			"reference": "12456789",
			"title": "Mr",
			"firstname": "John",
			"lastname": "Doe",
                		"email": "testemail@test.com",
			"phone": "+336464848",
			"birthdate": "1972-08-27",
			"country": "AU",
			"language": "en",
	                "address_street_number_and_name": "122 Grand Street",
	                "address_postal_code":"75001",
	                "address_state":"Ile de France",
	                "address_city": "Paris",
	                "nationality":"FR",
	                "identity_document_number":"1234567890",
	                "extra_attributes": {
	                    "vip":"1"
	                }
		}
	}
]
}
```

###

## Fields

\*Mandatory fields

### Bookings

<table><thead><tr><th>Fields</th><th>Type</th><th width="100">Required<select><option value="prV0j4Oss05W" label="Required" color="blue"></option><option value="w9q37pq5aTSs" label="Optional" color="blue"></option></select></th><th>Description</th></tr></thead><tbody><tr><td>reference*</td><td>string</td><td><span data-option="prV0j4Oss05W">Required</span></td><td>Unique reference of the booking</td></tr><tr><td>status*</td><td>string</td><td><span data-option="prV0j4Oss05W">Required</span></td><td>Status of the booking. valid, option, cancelled</td></tr><tr><td>creation</td><td>string ($ISO 8601)</td><td><span data-option="w9q37pq5aTSs">Optional</span></td><td>Date the booking was created (optional)</td></tr><tr><td>arrival*</td><td>string ($ISO 8601)</td><td><span data-option="prV0j4Oss05W">Required</span></td><td>Date the client will arrive at the hotel</td></tr><tr><td>departure*</td><td>string ($ISO 8601)</td><td><span data-option="prV0j4Oss05W">Required</span></td><td>Date the client will leave the hotel</td></tr><tr><td>arrival_time </td><td>string ($time hh:mm:ss)</td><td><span data-option="w9q37pq5aTSs">Optional</span></td><td>Format H:i:s (Hour:Minutes:Secondes "14:50:00")</td></tr><tr><td>ratecode</td><td>string</td><td><span data-option="w9q37pq5aTSs">Optional</span></td><td>ratecode of the booking </td></tr><tr><td>sourcecode</td><td>string</td><td><span data-option="w9q37pq5aTSs">Optional</span></td><td>source of the booking</td></tr><tr><td>segmentcode</td><td>string</td><td><span data-option="w9q37pq5aTSs">Optional</span></td><td>code used for the segmentation of the booking</td></tr><tr><td>totalamount</td><td>number ($float)</td><td><span data-option="w9q37pq5aTSs">Optional</span></td><td>Price of the booking including taxe</td></tr><tr><td>currency</td><td>string ($ISO 4217)</td><td><span data-option="w9q37pq5aTSs">Optional</span></td><td>currency use for the price</td></tr><tr><td>adult_count</td><td>number</td><td><span data-option="w9q37pq5aTSs">Optional</span></td><td>number of adult</td></tr><tr><td>child_count</td><td>number</td><td><span data-option="w9q37pq5aTSs">Optional</span></td><td>number of children</td></tr><tr><td>infant_count</td><td>number</td><td><span data-option="w9q37pq5aTSs">Optional</span></td><td>number of infant</td></tr><tr><td>extra_attributes</td><td>Object</td><td><span data-option="w9q37pq5aTSs">Optional</span></td><td>Array of key/value to be associated to the booking</td></tr><tr><td>xp-company</td><td>string</td><td><span data-option="w9q37pq5aTSs">Optional</span></td><td>Company of the guest. This field must be inside extra_attributes</td></tr><tr><td>rooms</td><td>array</td><td><span data-option="w9q37pq5aTSs">Optional</span></td><td>Rooms associated with the booking</td></tr><tr><td>customer</td><td>Object</td><td><span data-option="prV0j4Oss05W">Required</span></td><td>Customer associated with the booking</td></tr></tbody></table>

#### Booking Status

Accepted `status` of the booking:&#x20;

* `valid`
* `option`
* `cancelled`

### Room Object

<table><thead><tr><th>Fields</th><th width="100">Type</th><th width="100">Required<select><option value="7F2p7J5CJd28" label="Required" color="blue"></option><option value="nEWOtmO1s1ZF" label="Optional" color="blue"></option></select></th><th>Description</th></tr></thead><tbody><tr><td>number</td><td>string</td><td><span data-option="nEWOtmO1s1ZF">Optional</span></td><td>Name or number of the room </td></tr><tr><td>name</td><td>string</td><td><span data-option="nEWOtmO1s1ZF">Optional</span></td><td><strong>Category</strong> name for the room, can be unique or not </td></tr><tr><td>type</td><td>string</td><td><span data-option="nEWOtmO1s1ZF">Optional</span></td><td><strong>Category</strong> code of the room, can be unique or not</td></tr></tbody></table>

####

### Customer Object&#x20;

<table><thead><tr><th>Fields</th><th width="100">Type</th><th width="100">Required<select><option value="XmhIvyiVedXx" label="Required" color="blue"></option><option value="gsrOuZSZCg7T" label="Optional" color="blue"></option></select></th><th>Description</th></tr></thead><tbody><tr><td>reference*</td><td>string</td><td><span data-option="XmhIvyiVedXx">Required</span></td><td>Unique identifier of the customer</td></tr><tr><td>title</td><td>string</td><td><span data-option="gsrOuZSZCg7T">Optional</span></td><td>Title or civility of the customer </td></tr><tr><td>firstname</td><td>string</td><td><span data-option="gsrOuZSZCg7T">Optional</span></td><td>Firstname of the customer</td></tr><tr><td>lastname</td><td>string</td><td><span data-option="gsrOuZSZCg7T">Optional</span></td><td>Lastname of the customer</td></tr><tr><td>email</td><td>string</td><td><span data-option="gsrOuZSZCg7T">Optional</span></td><td>Email of the customer</td></tr><tr><td>phone</td><td>string</td><td><span data-option="gsrOuZSZCg7T">Optional</span></td><td>Phone number</td></tr><tr><td>birthdate</td><td>string ($ISO 8601)</td><td><span data-option="gsrOuZSZCg7T">Optional</span></td><td>Birthdate of the customer</td></tr><tr><td>country</td><td>string ($ISO 3166-1 alpha-2)</td><td><span data-option="gsrOuZSZCg7T">Optional</span></td><td>Country of the customer</td></tr><tr><td>language</td><td>string ($ISO 639-1)</td><td><span data-option="gsrOuZSZCg7T">Optional</span></td><td>Language of the customer. If not present, the language can be deduce from the country</td></tr><tr><td>address_street_number_and_name</td><td>string</td><td><span data-option="gsrOuZSZCg7T">Optional</span></td><td>Customer's address street and number</td></tr><tr><td>address_postal_code</td><td>string</td><td><span data-option="gsrOuZSZCg7T">Optional</span></td><td>Customer's address postal code</td></tr><tr><td>address_state</td><td>string</td><td><span data-option="gsrOuZSZCg7T">Optional</span></td><td>Customer's address state</td></tr><tr><td>address_city</td><td>string</td><td><span data-option="gsrOuZSZCg7T">Optional</span></td><td>Customer's address city</td></tr><tr><td>nationality</td><td>string ($ISO 3166-1 alpha-2)</td><td><span data-option="gsrOuZSZCg7T">Optional</span></td><td>Nationality of the customer</td></tr><tr><td>identity_document_number</td><td>string</td><td><span data-option="gsrOuZSZCg7T">Optional</span></td><td>Number of the identity document (ID, passport)</td></tr><tr><td>extra_attributes</td><td>Object</td><td><span data-option="gsrOuZSZCg7T">Optional</span></td><td>Array of key/value to be associated to the customer (optional)</td></tr></tbody></table>

## Response

200 OK

```html
1 bookings updated
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://experience-crm.gitbook.io/experience-crm-api/reservations/pms-api/create-and-update-bookings.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
