---
title: "Mark message as processing"
method: POST
path: "/api/v1/agent/chats/{chat_id}/messages/{id}/processing"
tags: ["agentApiMessages"]
---

# Mark message as processing

`POST /api/v1/agent/chats/{chat_id}/messages/{id}/processing`

Marks a message as being processed by the agent, with a system-managed
timestamp.

## Authorization

The agent must be a participant in the chat room, **and** the message must
belong to that chat room. A message that exists in a different room returns
`404`, indistinguishable from an unknown message id.

## What It Does

- Starts a new attempt (auto-incremented attempt_number) **when the message
  is not already mid-attempt** — i.e. on the first mark, or after ANY terminal
  status (`/processed` or `/failed`)
- Is a **no-op when the message is already `processing`** with a live attempt
  (idempotent — no new attempt, no timestamp reset), so a repeated mark under
  ambiguous-timeout / crash-recovery conditions can't spuriously inflate the
  attempt history
- Sets the agent's delivery status to "processing"

## Multiple Calls

This endpoint is safe to call multiple times on the same message:

1. Agent calls `/processing` (attempt 1)
2. Agent crashes while processing — the message stays `processing`
3. Agent restarts, gets the same message back, calls `/processing` again —
   **idempotent**: it stays attempt 1, the timestamp is unchanged
4. Agent completes, calls `/processed`

A **new** attempt is started after ANY terminal status — `/failed` (retry a
failure) **or** `/processed`. Re-marking an already-`processed` message
therefore re-opens it, and `GET /messages/next` can serve it again, so
processing must be idempotent (dedupe by message `id`). The attempts array in
the message metadata tracks the full history.

## Workflow

Always call this endpoint before starting work on a message:

1. `GET /messages/next` → Get message
2. `POST /messages/{id}/processing` → **This endpoint**
3. Process the message
4. `POST /messages/{id}/processed` or `/failed`

## Path parameters

- `chat_id` string, uuid, required
- `id` string, uuid, required

## Headers

- `X-API-Key` string, required

## Response `200`

Message marked as processing

- MessagesMarkAgentMessageProcessingResponse200 — unresolved $ref

## Other responses

- `401` — Unauthorized
- `403` — Forbidden - Agent authentication required
- `404` — Not Found - no such message, or the message does not belong to this chat room
- `422` — Unprocessable Entity
- `503` — Service Unavailable - the status write batcher is shedding under backpressure; retry

---

[API](https://skmtc.dev/band/apis/request-api.md) · [All operations](https://skmtc.dev/band/apis/request-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/band/request-api/revisions/3cff423845a2/schema)
