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

# Submits a message to an agent conversation.

POST https://api.awork.com/api/v1/agents/threads/{threadId}/messages
Content-Type: application/json

Submits a new message to an existing agent conversation for processing.
Provide text, attachments, or both. The message starts processing or enters the thread's queue.
The response confirms acceptance; it does not contain the agent's reply.
Read [GET /agents/threads/\{threadId}/messages](https://developers.awork.com/apiv1/agent-threads/get-agents-threads-messages-by-thread-id) to retrieve replies.
Each request submits a new message. Retrying after a lost response can submit the message again.
Processing is subject to the workspace's AI availability and usage limits.
The user must have permission to contribute to the thread.

Reference: https://developers.awork.com/apiv1/agent-threads/post-agents-threads-messages-by-thread-id

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Path parameters

- `threadId` (string, required) — The id of the thread to send the message in.

### Body (application/json)

This endpoint expects an AgentThreadMessageRequestModel.

- `content` (string, optional, nullable) — The message text. Required when no attachments are supplied.
- `attachments` (list of AgentThreadAttachmentRequestModel, optional, nullable) — Up to 20 distinct files attached to this message. Each file can contain up to 20 MiB. Upload new files before submitting their identifiers.
- `modelProvider` (string, optional, nullable) — The provider for a model override. Supply it together with modelName.
- `modelName` (string, optional, nullable) — The model to use for this message. It must be available in the workspace.
- `reasoningLevel` (string, optional, nullable) — The reasoning level for this message. Supported values depend on the selected model.
- `toolAccess` (AgentToolAccessOptionsModel, optional) — Per-message agent tool access options.
- `connectorIds` (list of string, optional, nullable) — The connector selection for this message.
- `connectorConnections` (list of AgentMessageConnectorConnectionRequestModel, optional, nullable) — Connection choices for custom-agent connectors. These do not change agent settings.
- `skillIds` (list of string, optional, nullable) — The skill selection for this message.
- `answerToInterruptId` (string, optional, nullable) — The interrupt identifier returned with the question being answered.

## Response

### 200

OK

- `threadId` (string, optional) — The thread id.
- `threadRunId` (string, optional, nullable) — The run id when the message started immediately.
- `acceptedMessageId` (string, optional, nullable) — The server-assigned message id. This identity is retained while queued and when execution starts.
- `queuedMessageId` (string, optional, nullable) — The persisted queue entry id when the message must wait.
- `queueOrder` (integer, optional, nullable) — The message's current queue position when it must wait.
- `threadUpdatedOn` (string, optional, nullable) — The parent timestamp saved with queue acceptance, absent for immediate execution.
- `isQueued` (boolean, optional) — Whether the backend stored the message in the queue.
- `status` (enum, optional) — Whether the message was accepted for execution, queued behind another message, or failed to start.
  - Allowed values: `accepted`, `queued`, `failed`

## Errors

### 400 Bad Request Error

Bad Request

- `code` (string, required) — The error code.
- `description` (string, required) — The description of the error.
- `link` (string, required) — The link to the API documentation page.
- `details` (list of string, optional, nullable) — A list of details describing the error.
- `validationErrors` (list of ValidationErrorResponse, optional, nullable) — If a validation error occurred, this contains the validation errors for each property.
- `traceId` (string, optional, nullable) — The request trace id for tracking the request.

### 404 Not Found Error

Not Found

- `code` (string, required) — The error code.
- `description` (string, required) — The description of the error.
- `link` (string, required) — The link to the API documentation page.
- `details` (list of string, optional, nullable) — A list of details describing the error.
- `validationErrors` (list of ValidationErrorResponse, optional, nullable) — If a validation error occurred, this contains the validation errors for each property.
- `traceId` (string, optional, nullable) — The request trace id for tracking the request.

### 503 Service Unavailable Error

Service Unavailable

- `code` (string, required) — The error code.
- `description` (string, required) — The description of the error.
- `link` (string, required) — The link to the API documentation page.
- `details` (list of string, optional, nullable) — A list of details describing the error.
- `validationErrors` (list of ValidationErrorResponse, optional, nullable) — If a validation error occurred, this contains the validation errors for each property.
- `traceId` (string, optional, nullable) — The request trace id for tracking the request.

## Types

### AgentThreadAttachmentRequestModel

References an attached file. Supply exactly one of temporaryFileId or aworkFileId.

- `temporaryFileId` (string, optional, nullable) — The identifier returned when uploading a temporary file. Do not also supply aworkFileId.
- `aworkFileId` (string, optional, nullable) — The identifier of an existing awork file the caller can read. Do not also supply temporaryFileId.

### AgentToolAccessOptionsModel

Per-message agent tool access options.

- `awork` (boolean, optional) — Whether awork tools are enabled for this run.
- `webSearch` (boolean, optional) — Whether web search is enabled for this run.
- `googleGenAi` (boolean, optional) — Whether Google GenAI tools are enabled for this run.
- `openAiImageGeneration` (boolean, optional) — Whether OpenAI image generation is enabled for this run.

### AgentMessageConnectorConnectionRequestModel

Selects a connection for a Custom agent connector.

- `connectorId` (string, optional) — The connector identifier.
- `connectionId` (string, optional) — The connection identifier.

### ValidationErrorResponse

The validation error response.

- `property` (string, optional, nullable) — The name of the property that failed validation.
- `message` (string, optional, nullable) — The reason why this property failed validation.

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "threadId": "6cbb219e-839d-4d23-b273-3a78bbd842ae",
  "threadRunId": "8f934a03-8f8b-44ea-9137-3ca563bb75e8",
  "acceptedMessageId": "66fcbdc5-2ae6-43bd-b3ab-f18ccd24909a",
  "queuedMessageId": "1d7279ac-342c-431c-bba5-16c65f2342c3",
  "queueOrder": 1,
  "threadUpdatedOn": "2026-09-15T15:47:35.9586190Z",
  "isQueued": false,
  "status": "accepted"
}
```

**SDK Code**

```python
import requests

url = "https://api.awork.com/api/v1/agents/threads/threadId/messages"

payload = {}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://api.awork.com/api/v1/agents/threads/threadId/messages';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{}'
};

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"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.awork.com/api/v1/agents/threads/threadId/messages"

	payload := strings.NewReader("{}")

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

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	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.awork.com/api/v1/agents/threads/threadId/messages")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{}"

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.awork.com/api/v1/agents/threads/threadId/messages")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.awork.com/api/v1/agents/threads/threadId/messages', [
  'body' => '{}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.awork.com/api/v1/agents/threads/threadId/messages");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.awork.com/api/v1/agents/threads/threadId/messages")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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()
```