# Create comments

URL: https://docs.hanzo.ai/docs/openapi/team/post-team-docs-by-id-comments

> Comments on a document, as the caller.

`POST /v1/team/docs/{id}/comments`

> [Team →](https://docs.hanzo.ai/docs/openapi/team) · [All API references →](https://docs.hanzo.ai/docs/openapi) · [Get started →](https://docs.hanzo.ai/docs/guides)

|               |                                                   |
| ------------- | ------------------------------------------------- |
| **Address**   | `https://api.hanzo.ai/v1/team/docs/{id}/comments` |
| **Method**    | `POST`                                            |
| **Operation** | `post_team_docs_by_id_comments`                   |
| **Auth**      | `Authorization: Bearer $HANZO_API_KEY`            |

Comments on a document, as the caller.

It is a message attached to the document, written through the Team client's
own path: the people subscribed to the document and anyone mentioned are
notified, and an agent mentioned answers with a comment of its own. It can be
replied to, reacted to, edited and deleted with the message ops.

## Request

9 fields, body `application/json` (required).

| Field          | In   | Type               | Required | Description                                                                                  |
| -------------- | ---- | ------------------ | -------- | -------------------------------------------------------------------------------------------- |
| `id`           | path | string             | yes      | ID is the document, from the path.                                                           |
| `files`        | body | team.teamFileIn\[] | —        | Files attaches blobs already uploaded to the space.                                          |
| `files[].file` | body | string             | —        | File is the blob id — the uuid the file was uploaded under with POST /v1/team/files/{space}. |
| `files[].name` | body | string             | —        | Name is the file's name as a person should see it.                                           |
| `files[].size` | body | integer (int64)    | —        | Size is the file's length in bytes.                                                          |
| `files[].type` | body | string             | —        | Type is the file's media type, e.g. "image/png".                                             |
| `id`           | body | string             | —        | ID is the document, from the path.                                                           |
| `space`        | body | string             | —        | Space is the space uuid holding it.                                                          |
| `text`         | body | string             | —        | Text is the comment, with the same `&lt;@account-uuid&gt;` mentions a message takes.         |

## Response

| Status    | Body             | Meaning |
| --------- | ---------------- | ------- |
| `201`     | team.teamMessage | created |
| `default` | problem-details  | refused |

`201` body — 21 fields.

| Field                  | In   | Type                 | Always | Description                                                                                                                                         |
| ---------------------- | ---- | -------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| `author`               | body | string               | —      | Author is the team account uuid that wrote it.                                                                                                      |
| `createdOn`            | body | integer (int64)      | —      | CreatedOn is unix MILLIseconds, which is what the platform stamps.                                                                                  |
| `doc`                  | body | string               | —      | Doc is the document this message is a comment on.                                                                                                   |
| `editedOn`             | body | integer (int64)      | —      | EditedOn is when the author last edited the message, unix milliseconds.                                                                             |
| `files`                | body | team.teamFile\[]     | —      | Files are the files attached to the message.                                                                                                        |
| `files[].file`         | body | string               | —      | File is the blob id, readable at GET /v1/team/files/{space}/{name}?file={file}.                                                                     |
| `files[].id`           | body | string               | —      | ID is the attachment document's own id.                                                                                                             |
| `files[].name`         | body | string               | —      | Name is the file's name as the person uploaded it.                                                                                                  |
| `files[].size`         | body | integer (int64)      | —      | Size is the file's length in bytes, as the uploader stated it.                                                                                      |
| `files[].type`         | body | string               | —      | Type is the media type the uploader declared.                                                                                                       |
| `id`                   | body | string               | —      | ID is the message document's own id.                                                                                                                |
| `lastReply`            | body | integer (int64)      | —      | LastReply is when the thread was last answered, unix milliseconds.                                                                                  |
| `mentions`             | body | string\[]            | —      | Mentions are the account uuids the message @-mentions — exactly the people notify.go told they were mentioned.                                      |
| `reactions`            | body | team.teamReaction\[] | —      | Reactions are the emoji people reacted with, one entry per emoji, in the order each emoji was first used.                                           |
| `reactions[].accounts` | body | string\[]            | —      | Accounts are the account uuids that reacted with it, earliest first.                                                                                |
| `reactions[].count`    | body | integer (int64)      | —      | Count is how many people reacted with it.                                                                                                           |
| `reactions[].emoji`    | body | string               | —      | Emoji is the reaction itself, as the person picked it.                                                                                              |
| `replies`              | body | integer (int64)      | —      | Replies is how many replies the message's thread holds.                                                                                             |
| `room`                 | body | string               | —      | Room is the room it was said in — the same id the room listing answers with, so a caller holding a message can name its room without a second read. |
| `text`                 | body | string               | —      | Text is the message as PLAIN TEXT.                                                                                                                  |
| `thread`               | body | string               | —      | Thread is the message this one replies to.                                                                                                          |

Failure carries the platform error shape — see [Errors](https://docs.hanzo.ai/docs/errors).

## Examples

**CLI**

`hanzo` has no subcommand for this operation — the CLI serves only what cloud's live route table confirms. Use HTTP or an SDK.

**SDK**

**.ts**

```ts
import { Configuration, TeamApi } from 'hanzoai';

const api = new TeamApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.postTeamDocsByIdComments({ id: 'id', files: [{"file":"<file>","name":"<name>","size":0,"type":"<type>"}], id: "<id>" });
```

**.py**

```python
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import TeamApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = TeamApi(client).post_team_docs_by_id_comments(id='id', files=[{"file":"<file>","name":"<name>","size":0,"type":"<type>"}], id="<id>")
```

**.go**

```go
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.TeamAPI.PostTeamDocsByIdComments(context.Background()).Execute()
if err != nil {
	return err
}
```

**.rs**

```rust
use hanzo_client::apis::{configuration::Configuration, team_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = team_api::post_team_docs_by_id_comments(&cfg, Default::default()).await?;
```

**.java**

```java
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.TeamApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new TeamApi(client).postTeamDocsByIdComments();
```

**HTTP**

```bash
curl -X POST https://api.hanzo.ai/v1/team/docs/<id>/comments \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "files": [
         {
           "file": "<file>",
           "name": "<name>",
           "size": 0,
           "type": "<type>"
         }
       ],
       "id": "<id>"
     }'
```

**MCP**

MCP reaches **team** through the `team` tool, which names its 33 operations with its own verbs — this one among them, under a name only MCP declares. `describe` explains any of them:

```bash
curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "describe",
         "arguments": {
           "op": "list_team_account_providers"
         }
       }
     }'
```

---

[Team API](https://docs.hanzo.ai/docs/openapi/team) · [All Hanzo APIs](https://docs.hanzo.ai/docs/openapi) · [Interactive reference](https://docs.hanzo.ai/docs/openapi/reference)
