## Resolve a chat

**post** `/v1/chats/{chat}/resolve`

Resolves the chat and starts the satisfaction survey Apple asks for at
resolution.

**Errors**

- HTTP 404 `code` 2001 when the chat does not exist for your brand:
  the same answer `/clarify` gives: both resolve the chat before they
  touch a flow.

**Behavior**

- No request body.
- Returns HTTP 202: the resolution is applied a moment after the
  response.
- Idempotent for 10 minutes: a second resolve inside that window returns
  HTTP 202 with `action: "already_resolved"` and does nothing, so a
  customer who answers the survey late is never surveyed twice. Past the
  window, a chat that genuinely finishes again can be resolved again.
- The survey runs as a platform flow: the chat's `owner` becomes `flow`
  while the satisfaction card awaits an answer, and your sends during
  that window return HTTP 409 `code` 2011. The flow ends on the
  customer's reply (the next message is consumed as the survey answer;
  one asking for a person escalates instead) or after 120 seconds of
  silence, and the turn then returns, recorded by `chat.owner_changed`.
  So resolve when the conversation is finished: a customer who writes
  back inside that window is answering the survey, not restarting the
  thread with you.

### Path Parameters

- `chat: string`

### Returns

- `action: "resolved" or "already_resolved"`

  `resolved`: the CSAT flow was started; `already_resolved`: this chat was resolved within the last 10 minutes, so the call was a no-op; never retry it.

  - `"resolved"`

  - `"already_resolved"`

### Example

```http
curl https://messages.api.linqapp.com/v1/chats/$CHAT/resolve \
    -X POST \
    -H "Authorization: Bearer $LINQ_AMB_API_KEY"
```

#### Response

```json
{
  "action": "resolved"
}
```
