# Add or Update Booking Attendee

<mark style="color:green;">`POST`</mark> `[PlatformAddress]/api/1.0/venue?action=addOrUpdateBookingAttendee`

Adds or updates the details of a venue booking attendee. NOTE: The venue must have access to add or update booking attendee in order to call this api action.

{% tabs %}
{% tab title="200 " %}

```javascript
{
  "success": true,
  "id": 8821,
}
```

{% endtab %}

{% tab title="200 " %}

```javascript
{
  "errorCode": 400,
  "message": "The request contains invalid data",
  "specificCode": 24413,
  "additionalMessages": [
      "firstName: *Value is required and can't be empty*"
  ]
}
```

{% endtab %}

{% tab title="200 " %}

```javascript
{
  "errorCode": 500,
  "message": "An error has occurred",
  "specificCode": 24412,
  "additionalMessages": []
}
```

{% endtab %}
{% endtabs %}

### Booking Attendee

| Property           | Type    | Required | Description                                                                                                                        |
| ------------------ | ------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| id                 | integer | optional | The unique id of the booking attendee to update.                                                                                   |
| hash               | string  | optional | The unique hash of the booking attendee to update.                                                                                 |
| venueId            | integer | required | The id of the venue to which the booking attendee belongs                                                                          |
| bookingId          | integer | required | The id of the booking to which the new booking attendee will be assigned.                                                          |
| firstName          | string  | required | The first name of the booking attendee.                                                                                            |
| lastName           | string  | required | The last name of the booking attendee.                                                                                             |
| phone              | string  | required | The phone number of the booking attendee.                                                                                          |
| email              | string  | required | The email address of the booking attendee.                                                                                         |
| dietaryRequirement | string  | optional | The dietary requirements of the booking attendee.                                                                                  |
| menuItems          | array   | optional | The list of menu items that is included in the booking attendee menu. See [Menu Item](#menu-item) section for details of each item |

### Add Or Update

When id or hash are not provided, it will create new booking attendee. Other wise it will update booking attendee based on hash/id. When id and hash both are present in the request, hash will be ignored.

### Menu Item

A menu item is an object with the following details.

| Property    | Type    | Required | Description                                                  |
| ----------- | ------- | -------- | ------------------------------------------------------------ |
| sessionId   | integer | required | The id of the session to which the booking menu belongs      |
| menuId      | integer | required | The id of the attendee to which the booking attendee belongs |
| inventoryId | integer | required | The id of the attendee to which the booking attendee belongs |

#### Updating items

While updating you can skip the menuItems parameter, this will not change any of the menu items. Passing menuItems will replace the menu items with the given items.

### Example Request

```javascript
{
    "venueId": 1,
    "bookingId": 4407,
    "firstName": "First Name",
    "lastName": "Last Name",
    "phone": "123456",
    "dietaryRequirement": "Something required for my diet",
    "email" : "test@email.com",
    "menuItems": [
    {
        "sessionId": "2447",
        "menuId": 225,
        "inventoryId": 14
    },
    {
        "sessionId": "2447",
        "menuId": 225,
        "inventoryId": 15
    },
    {
        "sessionId": "2448",
        "menuId": 226,
        "inventoryId": 16
    }
  ]
}
```

### Returns

| Property | Description                                                  |
| -------- | ------------------------------------------------------------ |
| success  | Whether or not the booking attendee was added/updated        |
| id       | The unique id of the booking attendee that was added/updated |

### Throws

| Code                 | Description                         |
| -------------------- | ----------------------------------- |
| Specific Code: 24410 | The booking does not exist          |
| Specific Code: 24411 | The booking attendee does not exist |
| Specific Code: 24412 | An error has occurred               |
| Specific Code: 24413 | The request contains invalid data   |
| Specific Code: 24414 | The request contains invalid data   |


---

# 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://developer.ivvy.com/venues/getoraddbookingdata/add-or-update-booking-attendee.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.
