> ## 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 EmailAccount

> Update an existing EmailAccount record.

Updates an existing EmailAccount 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 **`EmailAccount-Edit`** role.
</Note>

## Request Body

### Required Fields

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

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

<ParamField body="DisplayName" type="string" required>
  Display Name.
</ParamField>

<ParamField body="EmailAddress" type="string" required>
  Email Address.
</ParamField>

<ParamField body="IncomingServer" type="string" required>
  Incoming Server.
</ParamField>

<ParamField body="IncomingServerType" type="integer" required>
  Incoming Server Type.
</ParamField>

<ParamField body="IncomingServerPort" type="integer" required>
  Incoming Server Port.
</ParamField>

<ParamField body="IncomingServerUsername" type="string" required>
  Incoming Server Username.
</ParamField>

<ParamField body="DeleteMessageSettings" type="integer" required>
  Delete Message Settings.
</ParamField>

<ParamField body="OutgoingServer" type="string" required>
  Outgoing Server.
</ParamField>

<ParamField body="OutgoingServerPort" type="integer" required>
  Outgoing Server Port.
</ParamField>

<ParamField body="OutgoingServerUsername" type="string" required>
  Outgoing Server Username.
</ParamField>

<ParamField body="LastMessageId" type="integer" required>
  Last Message Id.
</ParamField>

<ParamField body="ErrorCount" type="integer" required>
  Error Count.
</ParamField>

### Optional Fields

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

<ParamField body="SendNotificationOnNewMessages" type="boolean">
  Send Notification On New Messages.
</ParamField>

<ParamField body="NotificationEmailAddress" type="string">
  Notification Email Address.
</ParamField>

<ParamField body="IncomingServerSSL" type="boolean">
  Incoming Server SSL.
</ParamField>

<ParamField body="OutgoingServerSSL" type="boolean">
  Outgoing Server SSL.
</ParamField>

<ParamField body="ReplyToEmail" type="string">
  Reply To Email.
</ParamField>

<ParamField body="LastCheckTime" type="string">
  Last Check Time.
</ParamField>

<ParamField body="GoogleAccessToken" type="string">
  Google Access Token.
</ParamField>

<ParamField body="Office365AccessToken" type="string">
  Office365Access Token.
</ParamField>

## Code Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl -X PUT \
    "https://spaces.nexudus.com/api/crm/emailaccounts" \
    -H "Authorization: Bearer YOUR_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "BusinessId": 0,
      "DisplayName": "",
      "EmailAddress": "",
      "IncomingServer": "",
      "IncomingServerType": 0,
      "IncomingServerPort": 0,
      "IncomingServerUsername": "",
      "DeleteMessageSettings": 0,
      "OutgoingServer": "",
      "OutgoingServerPort": 0,
      "OutgoingServerUsername": "",
      "LastMessageId": 0,
      "ErrorCount": 0,
      "Id": 87654321
  }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://spaces.nexudus.com/api/crm/emailaccounts',
    {
      method: 'PUT',
      headers: {
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        BusinessId: 0,
        DisplayName: '',
        EmailAddress: '',
        IncomingServer: '',
        IncomingServerType: 0,
        IncomingServerPort: 0,
        IncomingServerUsername: '',
        DeleteMessageSettings: 0,
        OutgoingServer: '',
        OutgoingServerPort: 0,
        OutgoingServerUsername: '',
        LastMessageId: 0,
        ErrorCount: 0,
        Id: 87654321
      })
    }
  );

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

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

  response = requests.put(
      'https://spaces.nexudus.com/api/crm/emailaccounts',
      headers={
          'Authorization': 'Bearer YOUR_TOKEN',
          'Content-Type': 'application/json'
      },
      json={
          'BusinessId': 0,
          'DisplayName': '',
          'EmailAddress': '',
          'IncomingServer': '',
          'IncomingServerType': 0,
          'IncomingServerPort': 0,
          'IncomingServerUsername': '',
          'DeleteMessageSettings': 0,
          'OutgoingServer': '',
          'OutgoingServerPort': 0,
          'OutgoingServerUsername': '',
          'LastMessageId': 0,
          'ErrorCount': 0,
          '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 emailaccount was updated successfully.
</ResponseField>

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

```json Example Response theme={null}
{
  "Status": 200,
  "Message": "EmailAccount 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": "DisplayName: is a required field",
  "Value": null,
  "Errors": [
    {
      "AttemptedValue": null,
      "Message": "is a required field",
      "PropertyName": "DisplayName"
    }
  ],
  "WasSuccessful": false
}
```
