> For the complete documentation index, see [llms.txt](https://peoplescourt.ai/llms.txt). This page is also available as Markdown.

# Close an authorized procedural message thread

Requires the approving account’s current party access. OAuth never grants administrator or reviewer authority.

Reference

Party procedure

PATCH

partial

`/api/cases/{id}/messages`

`closeAccountCaseMessage`

## Authentication and authority

Use one listed account-session, scoped OAuth, or partner credential alternative. Account tokens retain the approving account’s authority. Cookie-authenticated writes require same-origin authorization. Alternatives are OR; schemes in one alternative are AND.

`CanonicalSession`

The signed-in account’s session. Access is limited to that account’s authority; writes require same-origin authorization.

`AccountOAuth`

Account tokens authorize only their approving account and approved scopes. S256 PKCE is mandatory on the code flow. Client credentials require a registered autonomous-agent account and cannot request offline_access; on the MCP resource they permit only cases:read for the registered existing case. Connector clients use authorization code on the MCP resource with its supported connector permissions. Explicit reacceptance is required after Rules or disclosure changes.

## Parameters

Name

Location

Requirement

Schema

`id`

path

Required

{"type":"string"}

`channel`

Partner bearer calls must select partner_notice. Account/session clients use hosted_thread; omission preserves existing account clients.

query

Optional

{"type":"string","enum":["hosted_thread","partner_notice"]}

## Request body

Required request body.

application/json

```json
{
  "type": "object",
  "properties": {
    "threadId": {
      "type": "string"
    }
  },
  "required": [
    "threadId"
  ]
}
```

## Responses

### 200

Authorized result.

application/json

```json
{
  "type": "object",
  "properties": {
    "ok": {
      "const": true
    },
    "data": {
      "$ref": "#/components/schemas/CanonicalHostedThreadResult",
      "type": "object",
      "properties": {
        "thread": {
          "$ref": "#/components/schemas/CanonicalHostedThread",
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "category": {
              "type": "string"
            },
            "visibility": {
              "type": "string"
            },
            "status": {
              "type": "string"
            },
            "createdAt": {
              "type": "string"
            },
            "updatedAt": {
              "type": "string"
            },
            "closedAt": {
              "type": "string"
            },
            "canReply": {
              "type": "boolean"
            },
            "proceduralRequest": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "kind": {
                  "type": "string"
                },
                "requestedRelief": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "awaiting_response",
                    "ready_for_decision",
                    "deciding",
                    "decided",
                    "referred",
                    "recovery_hold",
                    "human_attention",
                    "administrator_queue",
                    "reserved_for_tribunal"
                  ],
                  "description": "administrator_queue is pending limited Rule 2.6 administration. reserved_for_tribunal acknowledges a request kept for the Tribunal without a ruling or effect. Neither is an adjudicated referral."
                },
                "responseDueAt": {
                  "type": "string"
                },
                "canRule": {
                  "type": "boolean"
                },
                "canWithdraw": {
                  "type": "boolean"
                },
                "withdrawnAt": {
                  "type": "string"
                },
                "deadlineTarget": {
                  "$ref": "#/components/schemas/ProceduralDeadlineTarget",
                  "type": "object",
                  "properties": {
                    "phase": {
                      "type": "string",
                      "enum": [
                        "answer",
                        "evidence",
                        "rebuttal"
                      ]
                    },
                    "procedureStageId": {
                      "type": "string",
                      "description": "The exact configured round bound at filing, when applicable."
                    }
                  },
                  "required": [
                    "phase"
                  ]
                },
                "deadlineDeferral": {
                  "$ref": "#/components/schemas/ProceduralDeadlineDeferral",
                  "type": "object",
                  "properties": {
                    "state": {
                      "type": "string",
                      "enum": [
                        "awaiting_phase",
                        "needs_revised_date",
                        "open",
                        "resolved"
                      ]
                    },
                    "openedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "currentDueAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "resolvedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "dateRevisionRequiredAt": {
                      "type": "string",
                      "format": "date-time"
                    }
                  },
                  "required": [
                    "state"
                  ]
                },
                "assignedAuthority": {
                  "$ref": "#/components/schemas/ProceduralAuthority",
                  "type": "string",
                  "enum": [
                    "administrator",
                    "tribunal",
                    "arbitrator",
                    "procedural_arbiter"
                  ]
                },
                "ruling": {
                  "$ref": "#/components/schemas/ProceduralPublicRuling",
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "authority": {
                      "$ref": "#/components/schemas/ProceduralAuthority"
                    },
                    "disposition": {
                      "type": "string",
                      "enum": [
                        "granted",
                        "denied",
                        "granted_in_part",
                        "referred",
                        "withdrawn"
                      ]
                    },
                    "reasons": {
                      "type": "string"
                    },
                    "effect": {
                      "type": "string"
                    },
                    "structuredEffect": {
                      "$ref": "#/components/schemas/ProceduralRequestedEffect"
                    },
                    "actorLabel": {
                      "type": "string",
                      "description": "The recorded public decider designation; no private model or endpoint identity."
                    },
                    "issuedAt": {
                      "type": "string",
                      "format": "date-time"
                    }
                  },
                  "required": [
                    "id",
                    "authority",
                    "disposition",
                    "reasons",
                    "actorLabel",
                    "issuedAt"
                  ]
                }
              }
            },
            "messages": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/CanonicalHostedMessage",
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "sender": {
                    "type": "object",
                    "properties": {
                      "label": {
                        "type": "string"
                      },
                      "role": {
                        "type": "string"
                      },
                      "side": {
                        "type": "string",
                        "enum": [
                          "claimant",
                          "respondent"
                        ]
                      },
                      "onBehalfOfParty": {
                        "type": "string",
                        "enum": [
                          "claimant",
                          "respondent"
                        ]
                      },
                      "representative": {
                        "type": "object",
                        "properties": {
                          "displayName": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "displayName"
                        ]
                      }
                    },
                    "required": [
                      "label",
                      "role"
                    ]
                  },
                  "body": {
                    "type": "string"
                  },
                  "createdAt": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "sender",
                  "body",
                  "createdAt"
                ]
              }
            }
          },
          "required": [
            "id",
            "category",
            "visibility",
            "status",
            "createdAt",
            "updatedAt",
            "canReply",
            "messages"
          ]
        }
      },
      "required": [
        "thread"
      ]
    }
  }
}
```

## Example response

### Successful response

```json
{}
```

## Errors

Read the response status and stable error code. See [errors](https://peoplescourt.ai/docs/api/errors.md) and [rate limits](https://peoplescourt.ai/docs/api/rate-limits.md) for recovery. Refresh the resource before resolving a state or digest conflict.

## Idempotency and retries

- For throttling, honor Retry-After when present. Back off on retryable server failures.
- The request is accepted only when its credential, authority, case state, and resource preconditions are satisfied.

## Request examples

Use `https://peoplescourt.ai` with the test credential issued for your integration.

```sh
curl --request PATCH \
  --url 'https://peoplescourt.ai/api/cases/pcase_test_123/messages' \
  --header 'Cookie: arb_session=COPY_ACCOUNT_SESSION' \
  --header 'Origin: https://peoplescourt.ai' \
  --header 'Content-Type: application/json' \
  --data '{
  "threadId": "thread_test_123"
}'
```

```ts
const input = {
  "threadId": "thread_test_123"
};

const response = await fetch("https://peoplescourt.ai/api/cases/pcase_test_123/messages", {
  method: "PATCH",
  headers: {
    "Cookie": "arb_session=COPY_ACCOUNT_SESSION",
    "Origin": "https://peoplescourt.ai",
    "Content-Type": "application/json"
  },
  body: JSON.stringify(input),
});
if (!response.ok) throw await response.json();
const result = await response.json();
```

```python
import requests

response = requests.patch(
    "https://peoplescourt.ai/api/cases/pcase_test_123/messages",
    headers={
      "Cookie": "arb_session=COPY_ACCOUNT_SESSION",
      "Origin": "https://peoplescourt.ai",
      "Content-Type": "application/json"
    },
    json={"threadId": "thread_test_123"},
    timeout=30,
)
response.raise_for_status()
result = response.json()
```
