> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs-dev.band.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs-dev.band.ai/_mcp/server.

# Mark message as processing

POST https://api.dev.band.ai/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`

Reference: https://docs-dev.band.ai/api/agent-api/agent-api-messages/mark-agent-message-processing

## Authentication

- `X-API-Key` header (required) — Enter your API key for programmatic access

## Request

### Path parameters

- `chat_id` (string, required) — Chat Room ID
- `id` (string, required) — Message ID

## Response

### 200

Message marked as processing

- `data` (MessageStatusResponse, required) — Minimal response after updating message processing status.

## Errors

### 401 Unauthorized Error

Unauthorized

- `error` (ErrorError, required)

### 403 Forbidden Error

Forbidden - Agent authentication required

- `error` (ErrorError, required)

### 404 Not Found Error

Not Found - no such message, or the message does not belong to this chat room

- `error` (ErrorError, required)

### 422 Unprocessable Entity Error

Unprocessable Entity

- `error` (ValidationErrorError, required)

### 503 Service Unavailable Error

Service Unavailable - the status write batcher is shedding under backpressure; retry

- `error` (ErrorError, required)

## Types

### MessageStatusResponse

Minimal response after updating message processing status.

- `attempt_number` (integer, required) — Current attempt number
- `id` (string, required) — ID of the message
- `status` (enum, required) — New processing status
  - Allowed values: `processing`, `processed`, `failed`
- `success` (boolean, required) — Whether the status was updated successfully

### ErrorError

- `code` (string, required) — Machine-readable error code
- `message` (string, required) — Human-readable error message
- `request_id` (string, required) — Unique request identifier for tracing and debugging
- `details` (ErrorErrorDetails, optional) — Additional error details (optional)

### ValidationErrorError

- `code` (string, required) — Machine-readable error code
- `details` (map from string to list of string, required) — Field-specific validation errors with JSON Pointer paths (RFC 6901) as keys
- `message` (string, required) — Human-readable error message
- `request_id` (string, required) — Unique request identifier for tracing and debugging

### ErrorErrorDetails

Additional error details (optional)

## Examples

**Response**

```json
{
  "data": {
    "attempt_number": 1,
    "id": "a1b2c3d4-e5f6-4a5b-9c8d-e7f8a9b0c1d2",
    "status": "processing",
    "success": true
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.dev.band.ai/api/v1/agent/chats/chat_id/messages/id/processing"

headers = {"X-API-Key": "<apiKey>"}

response = requests.post(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.dev.band.ai/api/v1/agent/chats/chat_id/messages/id/processing';
const options = {method: 'POST', headers: {'X-API-Key': '<apiKey>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.dev.band.ai/api/v1/agent/chats/chat_id/messages/id/processing"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("X-API-Key", "<apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.dev.band.ai/api/v1/agent/chats/chat_id/messages/id/processing")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<apiKey>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.dev.band.ai/api/v1/agent/chats/chat_id/messages/id/processing")
  .header("X-API-Key", "<apiKey>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.dev.band.ai/api/v1/agent/chats/chat_id/messages/id/processing', [
  'headers' => [
    'X-API-Key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.dev.band.ai/api/v1/agent/chats/chat_id/messages/id/processing");
var request = new RestRequest(Method.POST);
request.AddHeader("X-API-Key", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["X-API-Key": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.dev.band.ai/api/v1/agent/chats/chat_id/messages/id/processing")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```