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

# Update Contact: Modify an Existing Contact's Fields

> Use PUT /api/v1/contacts/{identifier} to update profile fields on an existing ChatbotX contact, identified by internal ID, email, or phone number.

The Update Contact endpoint modifies fields on an existing contact record. You identify the target contact using the same flexible identifier format used across the API — internal ID, email, or phone number. The endpoint accepts any combination of updatable profile fields in the request body. A successful update returns HTTP `204 No Content`.

<Info>
  **PUT** `/api/v1/contacts/{identifier}`
</Info>

## Path Parameters

<ParamField path="identifier" type="string" required>
  A contact lookup string using one of the three supported prefix formats. Minimum length: 1 character.

  | Format          | Example                  |
  | --------------- | ------------------------ |
  | `id:<value>`    | `id:123456789`           |
  | `email:<value>` | `email:user@example.com` |
  | `phone:<value>` | `phone:+84708123123`     |
</ParamField>

## Request Body

Send any combination of the following fields you wish to update. Fields you omit are left unchanged.

<ParamField body="firstName" type="string">
  Updated first name. Maximum 100 characters.
</ParamField>

<ParamField body="lastName" type="string">
  Updated last name. Maximum 100 characters.
</ParamField>

<ParamField body="email" type="string">
  Updated email address. Must be a valid email format.
</ParamField>

<ParamField body="phoneNumber" type="string">
  Updated phone number. Must be 10–20 digits. Pattern: `\+?\d{10,20}`.
</ParamField>

<ParamField body="avatar" type="string">
  URL of the contact's profile image.
</ParamField>

<ParamField body="gender" type="string">
  One of: `male`, `female`, `unknown`.
</ParamField>

## Code Examples

<CodeGroup>
  ```bash curl theme={null}
  curl --request PUT \
    --url "https://app.chatbotx.io/api/v1/contacts/email:user@example.com" \
    --header "Authorization: Bearer YOUR_API_TOKEN" \
    --header "Content-Type: application/json" \
    --data '{
      "firstName": "Jane",
      "lastName": "Smith",
      "gender": "female"
    }'
  ```

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

  identifier = "email:user@example.com"
  url = f"https://app.chatbotx.io/api/v1/contacts/{identifier}"
  headers = {
      "Authorization": "Bearer YOUR_API_TOKEN",
      "Content-Type": "application/json"
  }
  payload = {
      "firstName": "Jane",
      "lastName": "Smith",
      "gender": "female"
  }

  response = requests.put(url, json=payload, headers=headers)
  print(response.status_code)  # 204 on success
  ```

  ```javascript JavaScript theme={null}
  const identifier = 'email:user@example.com';
  const options = {
    method: 'PUT',
    headers: {
      Authorization: 'Bearer YOUR_API_TOKEN',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      firstName: 'Jane',
      lastName: 'Smith',
      gender: 'female'
    })
  };

  fetch(`https://app.chatbotx.io/api/v1/contacts/${identifier}`, options)
    .then(res => {
      if (res.status === 204) console.log('Contact updated successfully');
    })
    .catch(err => console.error(err));
  ```
</CodeGroup>

## Response

A successful request returns **HTTP 204 No Content** with no response body. If the contact is not found or the identifier is malformed, the API returns an appropriate error status code.

```
HTTP/1.1 204 No Content
```
