# Close and open the next

`POST /api/v1/actions/{kind}/{rid}/close`

Closes the action with its result and optionally opens the next task in the chain (same company and project). `mode: keep` leaves the action open and only adds the next task.

## Path parameters

| Field | Type | Description |
|---|---|---|
| `kind` (required) | string | Action kind: `task`, `visit` (next action of a visit), `demo` (next action of a trial), `step` (opportunity step). Values: `task`, `visit`, `demo`, `step` |
| `rid` (required) | integer | Action id (`id` in the list). |

## Body

| Field | Type | Description |
|---|---|---|
| `result` | string | Result. |
| `next_title` | string | Next task's title. |
| `next_date` | string | Next task's due date. |
| `next_assigned` | integer | Next task's assignee. |
| `next_priority` | string | Priority. Values: `Düşük`, `Normal`, `Yüksek`, `Acil` |
| `mode` | string | `close` closes, `keep` leaves it open. Values: `close`, `keep` |

## Response

```json 200
{
  "action": {
    "act": {
      "addr": "Ankara Organize Sanayi Bölgesi, 8. Cadde No: 35, Ankara, Ankara",
      "c": 3,
      "mail": "cem.polat@lotusmedikal.example",
      "n": "Lotus Medikal Ambalaj San. Tic. Ltd. Şti.",
      "tel": "0 (312) 000 46 49",
      "url": "/customers/3",
      "wa": "903120004649",
      "who": "Cem Polat"
    },
    "chain_after": [
      [
        {
          "date": "2026-10-04",
          "done": false,
          "id": 24,
          "key": "task:24",
          "kind": "task",
          "label": "Teklif hazırla",
          "src": "Görev",
          "state": "soon"
        }
      ]
    ],
    "chain_before": [],
    "customer": "Lotus Medikal Ambalaj San. Tic. Ltd. Şti.",
    "customer_id": 3,
    "date": "2026-09-26",
    "detail": "",
    "done": true,
    "done_at": "2026-10-02T20:07:01",
    "editable": true,
    "icon": "📋",
    "id": 1,
    "key": "task:1",
    "kind": "task",
    "label": "Numune sonucu için ara",
    "opp": "Yeni Müşteri · 2026",
    "opp_id": 33,
    "others": [
      {
        "customer": "",
        "customer_id": null,
        "date": "2026-10-03",
        "icon": "📋",
        "id": 19,
        "key": "task:19",
        "kind": "task",
        "label": "Kargo takip numarasını ilet",
        "opp": "Yeni Müşteri · 2026",
        "opp_id": 33,
        "src": "Görev",
        "state": "soon",
        "url": "/action/task/19"
      }
    ],
    "result": "Müşteri aradı, teklif istendi",
    "rid": "00Tc4zPI4VpXeWp",
    "src": "Görev",
    "state": "done",
    "threads": [],
    "threads_n": 0,
    "user": {
      "full_name": "Deniz Aksoy",
      "id": 1,
      "role": "admin",
      "role_label": "Yönetici",
      "username": "admin"
    }
  },
  "next_task": {
    "assignee": {
      "full_name": "Deniz Aksoy",
      "id": 1,
      "role": "admin",
      "role_label": "Yönetici",
      "username": "admin"
    },
    "completed_at": null,
    "customer": "Lotus Medikal Ambalaj San. Tic. Ltd. Şti.",
    "customer_id": 3,
    "detail": "↳ Görev #1 (Numune sonucu için ara) sonrası: Müşteri aradı, teklif istendi",
    "due_date": "2026-10-04",
    "due_time": "",
    "id": 24,
    "opp": "Yeni Müşteri · 2026",
    "opp_id": 33,
    "priority": "Normal",
    "result": "",
    "rid": "00TfYtMol2EnOoG",
    "source_key": "task:1",
    "state": "soon",
    "status": "Açık",
    "title": "Teklif hazırla"
  },
  "ok": true
}
```
