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

# Update Thread

> Update the status or assignee of a conversation thread

Updates properties of a conversation thread such as its status or assignee. Use this to close threads, reopen them, or reassign them between agents and users.

## Headers

<ParamField header="x-api-key" type="string" required>
  Your API key for authentication.
</ParamField>

## Path Parameters

<ParamField path="threadId" type="string" required>
  The UUID of the thread to update.
</ParamField>

## Body

<ParamField body="status" type="string">
  New status for the thread. Common values: `open`, `closed`.
</ParamField>

<ParamField body="assignee" type="string">
  UUID of the user or agent to assign the thread to. Pass `null` to unassign.
</ParamField>

<ParamField body="assignee_type" type="string">
  Type of assignee: `user` or `agent`. Required when setting `assignee`.
</ParamField>

## Response

Returns the updated thread object.

## Error Codes

* `400 Bad Request` — Invalid fields
* `401 Unauthorized` — Invalid or missing API key
* `404 Not Found` — Thread not found
* `500 Internal Server Error` — Server-side error

## Code Examples

<RequestExample>
  ```bash cURL — Close thread theme={null}
  curl -X PUT "https://api.contactship.ai/v1/thread/thr-b2c3d4e5-f6a7-8901-bcde-f12345678901" \
    -H "x-api-key: your-api-key" \
    -H "Content-Type: application/json" \
    -d '{"status": "closed"}'
  ```

  ```bash cURL — Assign to agent theme={null}
  curl -X PUT "https://api.contactship.ai/v1/thread/thr-b2c3d4e5-f6a7-8901-bcde-f12345678901" \
    -H "x-api-key: your-api-key" \
    -H "Content-Type: application/json" \
    -d '{"assignee": "agent-a1b2c3d4-e5f6-7890-abcd-ef1234567890", "assignee_type": "agent"}'
  ```

  ```javascript JavaScript theme={null}
  const threadId = 'thr-b2c3d4e5-f6a7-8901-bcde-f12345678901';
  const response = await fetch(
    `https://api.contactship.ai/v1/thread/${threadId}`,
    {
      method: 'PUT',
      headers: {
        'x-api-key': 'your-api-key',
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({ status: 'closed' }),
    }
  );
  const thread = await response.json();
  ```

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

  thread_id = 'thr-b2c3d4e5-f6a7-8901-bcde-f12345678901'
  response = requests.put(
      f'https://api.contactship.ai/v1/thread/{thread_id}',
      headers={'x-api-key': 'your-api-key'},
      json={'status': 'closed'},
  )
  print(response.json())
  ```
</RequestExample>

<ResponseExample>
  ```json Example Response theme={null}
  {
    "id": "thr-b2c3d4e5-f6a7-8901-bcde-f12345678901",
    "channel_id": "chn_y0xspd9p1v7vla6wkwc2z01u",
    "channel_type": "WABA",
    "contact_id": "c1d2e3f4-a5b6-7890-cdef-123456789012",
    "organization_id": "org-f1e2d3c4-b5a6-7890-1234-567890abcdef",
    "status": "closed",
    "assignee": null,
    "assignee_type": null,
    "updated_at": "2026-04-06T16:00:00Z"
  }
  ```
</ResponseExample>
