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

# Update a contact

> Update fields on an existing contact.

Update an existing contact by id.

## Endpoint

```
PUT /api/v1/{subdomain}/contacts/{id}
```

Required ability: `contacts.update`.

## Headers

| Header          | Value                        |
| --------------- | ---------------------------- |
| `Authorization` | `Bearer <your-64-hex-token>` |
| `Content-Type`  | `application/json`           |
| `Accept`        | `application/json`           |

## Path parameters

<ParamField path="subdomain" type="string" required={true}>
  Your workspace subdomain.
</ParamField>

<ParamField path="id" type="integer" required={true}>
  Contact id.
</ParamField>

## Body parameters

<ParamField body="firstname" type="string" required={true}>
  First name. Max 255 characters.
</ParamField>

<ParamField body="lastname" type="string" required={true}>
  Last name. Max 255 characters. **Required on update.**
</ParamField>

<ParamField body="phone" type="string" required={true}>
  Phone number. Max 20 characters. Unique per workspace.
</ParamField>

<ParamField body="type" type="string" required={true}>
  `lead` or `customer`.
</ParamField>

<ParamField body="email" type="string" required={false}>
  Max 191 characters. Unique per workspace when provided.
</ParamField>

<ParamField body="source_id" type="integer" required={false}>
  Id of a [Source](/developers/data-types#source). Nullable on update.
</ParamField>

<ParamField body="status_id" type="integer" required={false}>
  Id of a [Status](/developers/data-types#status). Nullable, max `50`.
</ParamField>

<ParamField body="company" type="string" required={false}>
  Max 255 characters.
</ParamField>

<ParamField body="description" type="string" required={false}>
  Freeform description.
</ParamField>

<ParamField body="country_id" type="integer" required={false}>
  Country id.
</ParamField>

<ParamField body="assigned_id" type="integer" required={false}>
  Owner user id.
</ParamField>

<ParamField body="groups" type="string" required={false}>
  Comma-separated group names. Missing groups are auto-created.
</ParamField>

## Example request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X PUT https://dash.xobito.com/api/v1/acme/contacts/451 \
    -H "Authorization: Bearer <your_token>" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -d '{
      "firstname": "John",
      "lastname": "Doe",
      "phone": "+14155551234",
      "type": "customer",
      "status_id": 3
    }'
  ```

  ```javascript JavaScript theme={null}
  const res = await fetch(
    "https://dash.xobito.com/api/v1/acme/contacts/451",
    {
      method: "PUT",
      headers: {
        Authorization: "Bearer <your_token>",
        "Content-Type": "application/json",
        Accept: "application/json",
      },
      body: JSON.stringify({
        firstname: "John",
        lastname: "Doe",
        phone: "+14155551234",
        type: "customer",
        status_id: 3,
      }),
    }
  );
  const body = await res.json();
  ```

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

  r = requests.put(
      "https://dash.xobito.com/api/v1/acme/contacts/451",
      headers={
          "Authorization": "Bearer <your_token>",
          "Accept": "application/json",
      },
      json={
          "firstname": "John",
          "lastname": "Doe",
          "phone": "+14155551234",
          "type": "customer",
          "status_id": 3,
      },
  )
  body = r.json()
  ```

  ```php PHP theme={null}
  <?php
  $ch = curl_init('https://dash.xobito.com/api/v1/acme/contacts/451');
  curl_setopt_array($ch, [
      CURLOPT_CUSTOMREQUEST => 'PUT',
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_HTTPHEADER => [
          'Authorization: Bearer <your_token>',
          'Content-Type: application/json',
          'Accept: application/json',
      ],
      CURLOPT_POSTFIELDS => json_encode([
          'firstname' => 'John',
          'lastname'  => 'Doe',
          'phone'     => '+14155551234',
          'type'      => 'customer',
          'status_id' => 3,
      ]),
  ]);
  $body = json_decode(curl_exec($ch), true);
  curl_close($ch);
  ```
</CodeGroup>

## Example response

```json 200 OK theme={null}
{
  "status": "success",
  "message": "Contact updated successfully",
  "data": {
    "id": 451,
    "tenant_id": 13,
    "firstname": "John",
    "lastname": "Doe",
    "phone": "+14155551234",
    "email": "john@example.com",
    "type": "customer",
    "source_id": 2,
    "status_id": 3,
    "updated_at": "2026-04-16T13:01:10.000000Z"
  }
}
```

## Error responses

| Status | When                    | Example body                                                                                                 |
| ------ | ----------------------- | ------------------------------------------------------------------------------------------------------------ |
| `401`  | Missing / invalid token | `{"status":"error","message":"Invalid API token"}`                                                           |
| `403`  | Missing ability         | `{"status":"error","message":"Token does not have the required ability: contacts.update"}`                   |
| `404`  | Contact not found       | `{"status":"error","message":"Contact not found"}`                                                           |
| `422`  | Validation              | `{"status":"error","message":"Validation failed","errors":{"lastname":["The lastname field is required."]}}` |
| `429`  | Rate limit              | `{"message":"Too many requests","retry_after":45}`                                                           |
| `500`  | Server error            | `{"status":"error","message":"Failed to update contact"}`                                                    |
