---
title: "Close or reopen a thread"
method: PATCH
path: "/v2/agent/org/issues/{issueId}/state"
tags: ["agent"]
---

# Close or reopen a thread

`PATCH /v2/agent/org/issues/{issueId}/state`

## Request

- Base URL: `https://api.cardog.app`
- URL: `https://api.cardog.app/v2/agent/org/issues/{issueId}/state`
- Auth: one of:
  - API key in header `x-api-key`
  - HTTP bearer

Changes the thread's state as the person the grant names, but only if the state is still what the request expects: if it changed since the draft, the call is a 409. Only the organization that owns the thread (or Cardog staff) may close or reopen it; anyone else gets a 404.

The agent calls this only after the person approved the change. Costs 0 credits.

## Path parameters

- `issueId` string, uuid, required

## Headers

- `X-Cardog-Agent-Grant` string, required

## Request body

- AgentOrgIssueStateRequest
  - `state` 'open' | 'closed', required: The state to set: `open` or `closed`
  - `expectedState` 'open' | 'closed': The state you expect the thread to be in now. If it has changed, the call fails with a conflict. Default: the opposite of `state`.

## Response `200`

The thread's new state

- AgentOrgIssueState
  - `issue` object, required: The thread and its new state
    - `id` string, required: The thread ID
    - `state` 'open' | 'closed', required: The thread's state now: `open` or `closed`
  - `links` object, required: Where to go next
    - `issue` string, required: Where to read the thread: `GET /v2/agent/org/issues/{issueId}`

## Other responses

- `400`: The request is invalid. The error response names each bad value in `refs` or `details` and, where it can, suggests the nearest valid ref in `suggestions`. We never fall back to a fuzzy match.
- `401`: No valid API key or session
- `403`: Your credential cannot use this endpoint (`forbidden`)
- `404`: Resource not found
- `409`: The record changed since it was read (`conflict`); read it again
- `429`: Per-minute rate limit exceeded
- `500`: Internal error
- `503`: Temporarily unavailable (`unavailable`); retry with backoff

## Changes

- **2026-11-20** `d7a9494f5c04`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/cardog/apis/cardog-api-v2/changes/v2/agent/org/issues/:issueId/state/patch.md)

---

[API](https://skmtc.dev/cardog/apis/cardog-api-v2.md) - [All operations](https://skmtc.dev/cardog/apis/cardog-api-v2/llms.txt) - [OpenAPI document](https://skmtc.dev/cardog/apis/cardog-api-v2/revisions/016058226dc5?raw)
