# Create a guest

Creates a guest.
The REST API does not check whether a guest already exists in Sitecore CDP when you create a guest. To avoid creating duplicates, first retrieve guests by their email address or other identifying information.

In the response, the ref key contains the guest reference.

## Find the guest in Sitecore CDP
You can also use the guest reference to find data about the guest in Sitecore CDP. In Sitecore CDP, click Guests, and select the Guest type: All filter. Then, in the search dropdown, select Guest reference and then enter the guest reference in the search field. Then, Sitecore CDP lists the guest profile for the guest.

Endpoint: POST /v2.1/guests
Version: v2.1
Security: BasicAuth

## Request fields (application/json):

  - `guestType` (string, required)
    The level of identity obtained. The "traveller" value is only applicable to certain industries.
    Enum: "visitor", "customer", "traveller"

  - `city` (string)
    The guest's city.

Example values: "Dublin", "London", "Madrid", "Paris"
    Example: "Dublin"

  - `country` (string)
    The guest's country.

Example values: "IE", "GB", "ES", "FR"
    Example: "IE"

  - `dateOfBirth` (string)
    The guest's date of birth. Validation: Date must be in the past.
    Example: "1991-01-01T16:17:16.000Z"

  - `email` (string)
    The email address of the guest.
    Example: "john.doe@gmail.com"

  - `emails` (array)
    All the email addresses of the guest.
    Example: ["john.doe@gmail.com"]

  - `firstName` (string)
    The guest's first name.
    Example: "John"

  - `gender` (string)
    The guest's gender.

Example values: "male", "female", "unknown"
    Example: "male"

  - `href` (string)
    The URL of the guest.
    Example: "https://api-engage-eu.sitecorecloud.io/v2.1/guests/f7aabbca-1c1b-4fc2-be72-3e16294a4f03"

  - `identifiers` (array)
    A list of identifiers for the guest.

  - `identifiers.id` (string, required)
    The identifier ID.
    Example: "B7524AE6-CF1C-440F-B1A2-0C9D42F5CB41"

  - `identifiers.provider` (string, required)
    The identifier provider.
    Example: "ProfileSystem"

  - `identifiers.expiryDate` (string)
    The expiry date of the identifier.
    Example: "2025-01-01T16:17:16.000Z"

  - `lastName` (string)
    The guest's last name.
    Example: "Doe"

  - `nationality` (string)
    The guest's nationality.

Example values: "Irish", "British", "Spanish", "French"
    Example: "Irish"

  - `passportExpiry` (string)
    The expiry date of the guest's passport.
    Example: "2025-01-01T00:00:00.000Z"

  - `passportNumber` (string)
    The passport number of the guest.
    Example: "PZ4A9565"

  - `phoneNumbers` (array)
    The phone numbers of the guest.
    Example: ["+353161123345","+353161123346"]

  - `postCode` (string)
    The guest's zipcode.
    Example: "D2"

  - `ref` (string)
    The Guest's reference.
    Example: "f7aabbca-1c1b-4fc2-be72-3e16294a4f03"

  - `state` (string)
    The state (address) of the guest.
    Example: "Oregon"

  - `street` (array)
    The street address of the guest.
    Example: ["Ashford House","Tara Street","Dublin 2"]

  - `title` (string)
    The title of the guest.

Example values: "Br", "Brigadier", "Capt", "Colonel", "Dame", "Dr", "Elder", "Fr", "General", "Hon", "Judge", "Lord", "Master", "Miss", "Mr", "Mrs", "Ms", "Mstr", "Prof", "Rabbi", "Rev", "Shaikha", "Sheikh", "Sir", "Sister", "Sr"
    Example: "Mr"

## Response 201 fields (application/json):

  - `guestType` (string, required)
    The level of identity obtained. The "traveller" value is only applicable to certain industries.
    Enum: "visitor", "customer", "traveller"

  - `city` (string)
    The guest's city.

Example values: "Dublin", "London", "Madrid", "Paris"
    Example: "Dublin"

  - `country` (string)
    The guest's country.

Example values: "IE", "GB", "ES", "FR"
    Example: "IE"

  - `createdAt` (string)
    The date and time when the resource was created in Sitecore CDP.
    Example: "2024-01-01T16:17:16.000Z"

  - `dateOfBirth` (string)
    The guest's date of birth. Validation: Date must be in the past.
    Example: "1991-01-01T16:17:16.000Z"

  - `email` (string)
    The email address of the guest.
    Example: "john.doe@gmail.com"

  - `emails` (array)
    All the email addresses of the guest.
    Example: ["john.doe@gmail.com"]

  - `firstName` (string)
    The guest's first name.
    Example: "John"

  - `firstSeen` (string)
    The first seen date for the guest.
    Example: "2024-01-01T16:17:16.000Z"

  - `gender` (string)
    The guest's gender.

Example values: "male", "female", "unknown"
    Example: "male"

  - `href` (string)
    The URL of the guest.
    Example: "https://api-engage-eu.sitecorecloud.io/v2.1/guests/f7aabbca-1c1b-4fc2-be72-3e16294a4f03"

  - `identifiers` (array)
    A list of identifiers for the guest.

  - `identifiers.id` (string, required)
    The identifier ID.
    Example: "B7524AE6-CF1C-440F-B1A2-0C9D42F5CB41"

  - `identifiers.provider` (string, required)
    The identifier provider.
    Example: "ProfileSystem"

  - `identifiers.expiryDate` (string)
    The expiry date of the identifier.
    Example: "2025-01-01T16:17:16.000Z"

  - `lastName` (string)
    The guest's last name.
    Example: "Doe"

  - `lastSeen` (string)
    The last time the guest interacted with your brand. If the guest is currently online and is interacting with your brand, this returns the date and timestamp of when the current session started.
    Example: "2024-01-01T16:17:16.000Z"

  - `modifiedAt` (string)
    The date and time when the resource was updated in Sitecore CDP.
    Example: "2024-01-01T16:17:16.000Z"

  - `nationality` (string)
    The guest's nationality.

Example values: "Irish", "British", "Spanish", "French"
    Example: "Irish"

  - `passportExpiry` (string)
    The expiry date of the guest's passport.
    Example: "2025-01-01T00:00:00.000Z"

  - `passportNumber` (string)
    The passport number of the guest.
    Example: "PZ4A9565"

  - `phoneNumbers` (array)
    The phone numbers of the guest.
    Example: ["+353161123345","+353161123346"]

  - `postCode` (string)
    The guest's zipcode.
    Example: "D2"

  - `ref` (string)
    The Guest's reference.
    Example: "f7aabbca-1c1b-4fc2-be72-3e16294a4f03"

  - `state` (string)
    The state (address) of the guest.
    Example: "Oregon"

  - `street` (array)
    The street address of the guest.
    Example: ["Ashford House","Tara Street","Dublin 2"]

  - `title` (string)
    The title of the guest.

Example values: "Br", "Brigadier", "Capt", "Colonel", "Dame", "Dr", "Elder", "Fr", "General", "Hon", "Judge", "Lord", "Master", "Miss", "Mr", "Mrs", "Ms", "Mstr", "Prof", "Rabbi", "Rev", "Shaikha", "Sheikh", "Sir", "Sister", "Sr"
    Example: "Mr"

## Response 400 fields (application/json):

  - `code` (integer)
    The HTTP response status code.
    Example: 400

  - `developerMessage` (string)
    Error description for developers.
    Example: "Attribute guestType is invalid (not a valid value)."

  - `message` (string)
    Error description.
    Example: "guestType: not a valid value"

  - `moreInfoUrl` (string)
    URL to get more information about the error.
    Example: "https://support.sitecore.com"

  - `status` (integer)
    The HTTP request status.
    Example: 400

## Response 401 fields (application/json):

  - `code` (integer)
    The HTTP response status code.
    Example: 401

  - `message` (string)
    Error description.
    Example: "Authentication credentials are required to access the resource. All requests must be authenticated."

  - `moreInfoUrl` (string)
    URL to get more information about the error.
    Example: "https://support.sitecore.com"

  - `status` (string)
    The HTTP request status.
    Example: "UNAUTHORIZED"


