---
title: "Physician visit closed"
method: POST
path: "thread.visit_closed"
---

# Physician visit closed

`POST thread.visit_closed` (webhook)

Fires when a physician visit closes. AI and terminated threads do not emit this event ever. `closed_at` is the thread's `expires_at` at that moment. If the expiry is later extended and the visit closes again, a follow-up event fires with a later `closed_at`. Handle it as a new close. Dedupe repeat deliveries on `data.thread.id` and `closed_at` together.

## Payload

- object
  - `type` 'thread.visit_closed', required
  - `data` object, required
    - `thread` object, required
      - `id` string, uuid, required: The thread ID
      - `user_id` string, uuid, required: The user ID that the thread belongs to. Not necessarily the same as the sender ID.
    - `closed_at` string, date-time, required: The thread's `expires_at` when the physician visit closed. A follow-up close of the same thread carries a later value.
  - `id` string, uuid, required
  - `timestamp` string, date-time, required: datetime in ISO 8601 format

## Acknowledgement `200`

Return 200 if the webhook is accepted

## Other responses

- `429`: Return 429 to rate limit the webhook with a retry-after header. Max retry-after is 900 seconds (15 minutes) in the future.

---

[API](https://skmtc.dev/counselhealth/apis/counsel-api.md) - [All operations](https://skmtc.dev/counselhealth/apis/counsel-api/llms.txt) - [OpenAPI document](https://skmtc.dev/counselhealth/apis/counsel-api/revisions/4110a89127e8?raw)
