# upload_comment_attachment

Source: https://modulify.ai/docs/api/comments/upload-comment-attachment

Attaches one or more images to a comment or a reply.

- Title: Attach an image to a comment
- Scope: `comments:write`
- Access: Makes changes
- Endpoint: `POST /v1/upload_comment_attachment`

Every item needs all three of `file`, `filename` and `type`. An item missing any of them is dropped before anything is uploaded, and a call left with no items is refused.

Only PNG, JPEG and WEBP are accepted, up to 30 MB each, and a comment holds at most 5 attachments in total. A call that would take the comment past that total is refused as a whole. A file that is too large or the wrong type is dropped silently rather than failing the call, so compare the returned list against what you sent.

Every uploaded image gets a world-readable public URL, and the tool tells the client never to attach anything private. The Comments panel does not show attached images and people viewing the site through its shared link never see them, but `list_comment_attachments` reads them back. See [Comments](https://modulify.ai/docs/editor/comments#from-an-ai-client-over-mcp).

## Request

Call it with a `POST` to `https://api.modulify.ai/v1/upload_comment_attachment`, sending the inputs below as a JSON object. The token needs the `comments:write` scope.

It makes changes, so send an [Idempotency-Key](https://modulify.ai/docs/api/idempotency) header whenever you might retry it. A retry with the same key gets the first answer back instead of running again.

```bash
curl -X POST https://api.modulify.ai/v1/upload_comment_attachment \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"commentId":"COMMENT_ID","files":[]}'
```

Over MCP, the same method is the [upload_comment_attachment tool](https://modulify.ai/docs/mcp/comments/upload-comment-attachment).

## Inputs

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `commentId` | string | Yes | The comment or reply to attach them to. |
| `files` | array of objects | Yes | The images to attach, at most 5 items. Each item needs all three of `file` (the image as a base64 data URL, such as `data:image/png;base64,...`), `filename` (such as `screenshot.png`) and `type` (the MIME type, `image/png`, `image/jpeg` or `image/webp`), or it is dropped. |

## Response

Every call answers with the [JSON envelope](https://modulify.ai/docs/api/requests-and-responses#the-response) of `success`, `message`, `data`, `code` and `version`. `data` holds the result described above, and on a method that returns a total, `count` carries it. The [response headers](https://modulify.ai/docs/api/requests-and-responses#headers-on-every-method-call) carry the call's `X-Request-Id` and what is left of your per-minute budget in `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`. [Errors](https://modulify.ai/docs/api/errors) explains every status code a call can answer with.