> ## Documentation Index
> Fetch the complete documentation index at: https://learn.nexudus.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Visitor

> Update an existing Visitor record.

Updates an existing Visitor record. You must include the `Id` of the record to update along with all required fields.

## Authentication

<Note>
  This endpoint requires OAuth2 authentication. Include a valid bearer token in the `Authorization` header.
  The authenticated user must be a full unrestricted administrator or have the **`Visitor-Edit`** role.
</Note>

## Enums

<Accordion title="eVisitorSource — VisitorSource values">
  | Value | Name          |
  | ----- | ------------- |
  | 1     | Administrator |
  | 2     | NexIO         |
  | 3     | Customer      |
</Accordion>

<Accordion title="eVisitorHostApprovalStatus — HostApprovalStatus values">
  | Value | Name             |
  | ----- | ---------------- |
  | 1     | NotRequired      |
  | 2     | Requested        |
  | 3     | Rejected         |
  | 4     | AcceptedAndHold  |
  | 5     | AcceptedAndGrant |
</Accordion>

## Request Body

### Required Fields

<ParamField body="Id" type="integer" required>
  The Id of the Visitor record to update.
</ParamField>

<ParamField body="BusinessId" type="integer" required>
  Business Id.
</ParamField>

<ParamField body="FullName" type="string" required>
  Visitor full name.
</ParamField>

<ParamField body="Email" type="string" required>
  Visitor email.
</ParamField>

<ParamField body="VisitorSource" type="integer" required>
  Visitor source.
</ParamField>

<ParamField body="HostApprovalStatus" type="integer" required>
  Host approval status.
</ParamField>

<ParamField body="ExpectedArrival" type="string" required>
  Expected arrival date and time.
</ParamField>

### Optional Fields

<ParamField body="CoworkerId" type="integer">
  Coworker Id.
</ParamField>

<ParamField body="CheckedInAt" type="string">
  Location checked in at.
</ParamField>

<ParamField body="Notes" type="string">
  Notes.
</ParamField>

<ParamField body="CustomerNotes" type="string">
  Customer notes.
</ParamField>

<ParamField body="VisitReason" type="string">
  Reason for visit.
</ParamField>

<ParamField body="CompanyName" type="string">
  Visitor company name.
</ParamField>

<ParamField body="PhoneNumber" type="string">
  Visitor phone number.
</ParamField>

<ParamField body="Arrived" type="boolean">
  Whether the visitor has arrived.
</ParamField>

<ParamField body="ArrivalDate" type="string">
  Actual arrival date.
</ParamField>

<ParamField body="DepartureDate" type="string">
  Departure date.
</ParamField>

<ParamField body="Notified" type="boolean">
  Notified.
</ParamField>

<ParamField body="Internal" type="boolean">
  Internal.
</ParamField>

<ParamField body="IsTour" type="boolean">
  Whether this is a tour visit.
</ParamField>

<ParamField body="HasAgreedTerms" type="boolean">
  Whether the visitor has agreed to terms.
</ParamField>

<ParamField body="TourConfirmed" type="boolean">
  Whether the tour is confirmed.
</ParamField>

<ParamField body="AccessControlScheduledJobId" type="string">
  Access Control Scheduled Job Id.
</ParamField>

<ParamField body="CheckInNow" type="boolean">
  Check in the visitor now.
</ParamField>

## Code Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl -X PUT \
    "https://spaces.nexudus.com/api/spaces/visitors" \
    -H "Authorization: Bearer YOUR_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "BusinessId": 0,
      "FullName": "",
      "Email": "",
      "VisitorSource": 0,
      "HostApprovalStatus": 0,
      "ExpectedArrival": null,
      "Id": 87654321
  }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://spaces.nexudus.com/api/spaces/visitors',
    {
      method: 'PUT',
      headers: {
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        BusinessId: 0,
        FullName: '',
        Email: '',
        VisitorSource: 0,
        HostApprovalStatus: 0,
        ExpectedArrival: null,
        Id: 87654321
      })
    }
  );

  const data = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.put(
      'https://spaces.nexudus.com/api/spaces/visitors',
      headers={
          'Authorization': 'Bearer YOUR_TOKEN',
          'Content-Type': 'application/json'
      },
      json={
          'BusinessId': 0,
          'FullName': '',
          'Email': '',
          'VisitorSource': 0,
          'HostApprovalStatus': 0,
          'ExpectedArrival': None,
          'Id': 87654321
      }
  )

  data = response.json()
  ```
</CodeGroup>

## Response

### 200

<ResponseField name="Status" type="integer">
  HTTP status code. `200` on success.
</ResponseField>

<ResponseField name="Message" type="string">
  A human-readable message confirming the update.
</ResponseField>

<ResponseField name="Value" type="object">
  Contains the `Id` of the updated record.
</ResponseField>

<ResponseField name="WasSuccessful" type="boolean">
  `true` if the visitor was updated successfully.
</ResponseField>

<ResponseField name="Errors" type="array">
  `null` on success.
</ResponseField>

```json Example Response theme={null}
{
  "Status": 200,
  "Message": "Visitor was successfully updated.",
  "Value": {
    "Id": 87654321
  },
  "OpenInDialog": false,
  "OpenInWindow": false,
  "RedirectURL": null,
  "JavaScript": null,
  "UpdatedOn": "2025-01-15T10:30:00Z",
  "UpdatedBy": "admin@example.com",
  "Errors": null,
  "WasSuccessful": true
}
```

### 400

<ResponseField name="Message" type="string">
  A summary of the validation error(s), in the format `PropertyName: error message`.
</ResponseField>

<ResponseField name="Value" type="any">
  `null` on validation failure.
</ResponseField>

<ResponseField name="Errors" type="object[]">
  Array of validation errors.

  <Expandable>
    <ResponseField name="AttemptedValue" type="any">
      The value that was submitted for the field, or `null` if missing.
    </ResponseField>

    <ResponseField name="Message" type="string">
      The validation error message.
    </ResponseField>

    <ResponseField name="PropertyName" type="string">
      The name of the property that failed validation.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="WasSuccessful" type="boolean">
  `false` when the request fails validation.
</ResponseField>

```json Example Response theme={null}
{
  "Message": "FullName: is a required field",
  "Value": null,
  "Errors": [
    {
      "AttemptedValue": null,
      "Message": "is a required field",
      "PropertyName": "FullName"
    }
  ],
  "WasSuccessful": false
}
```
