---
title: "Comment on or reply to a provider post"
description: "PubNio API comments.create: comment on or reply to a provider post. Request fields, examples in five clients, errors, and idempotency."
---

> Documentation Index
> Fetch the complete documentation index at: https://pubnio.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Comment on or reply to a provider post

Comment on or reply to a provider post with [`POST /api/v1/comments`](https://pubnio.com/api/v1/docs#tag/comments/POST/api/v1/comments). Requires an API key with the `engage` scope or a signed-in workspace member.

## Request

Send a provider target ID or public permalink. The server derives provider, account, and target kind when unambiguous, checks the comment scope before one provider call, and replays the same idempotency key without a duplicate comment. Facebook and Instagram use Page/media comment endpoints, Threads publishes a reply container, X replies with a tweet, and LinkedIn uses the socialActions comment endpoint.

| Parameter     | In    | Type | Required |
| ------------- | ----- | ---- | -------- |
| `workspaceId` | query | UUID | Yes      |

| Body field   | Type                  | Required |
| ------------ | --------------------- | -------- |
| `accountId`  | UUID                  | No       |
| `provider`   | one of 12 strings     | No       |
| `target`     | string                | Yes      |
| `targetKind` | `"post"`, `"comment"` | No       |
| `text`       | string                | Yes      |

## Response

- HTTP 201: `CommentCreated` with `actionId`, `idempotencyKey`, `commentId`, `target`, `targetId`, `targetKind`, `accountId`, `provider`, `status`, `permalink`, `replayed`.
  - `targetKind`: `post`, `comment`
  - `provider`: `bluesky`, `facebook`, `instagram`, `linkedin`, `pinterest`, `reddit`, `snapchat`, `tiktok`, `threads`, `x`, `youtube`, `google_business`

The [OpenAPI document](https://pubnio.com/api/v1/openapi) has each field's type.

## Examples

### TypeScript

The TypeScript SDK has no method for this operation yet; send it over HTTP as the cURL tab shows.

### Python

```python
result = workspace.comments.create(
    account_id=account_id,
    target="https://www.instagram.com/p/C0abc123XYZ/",
    text="Thanks for the shout-out!",
)
```

### cURL

```sh
curl -X POST "https://pubnio.com/api/v1/comments?workspaceId=$WORKSPACE_ID" \
  -H "Authorization: Bearer $PUBNIO_API_KEY" \
  -H "Idempotency-Key: $IDEMPOTENCY_KEY" \
  -H "Content-Type: application/json" \
  -d '{"accountId":"'"$ACCOUNT_ID"'","target":"https://www.instagram.com/p/C0abc123XYZ/","text":"Thanks for the shout-out!"}'
```

### CLI

```sh
pnio comments create --account-id "$ACCOUNT_ID" --target https://www.instagram.com/p/C0abc123XYZ/ --text "Thanks for the shout-out!"
```

### MCP execute

```js
async () => {
  const accountId = "<accountId>";
  // One key per intent; reuse it only to retry this same request.
  const idempotencyKey = crypto.randomUUID();
  const response = await codemode.request({
    method: "POST",
    path: "/api/v1/comments",
    query: { workspaceId: codemode.workspaceId },
    headers: { "Idempotency-Key": idempotencyKey },
    body: {
      accountId: accountId,
      target: "https://www.instagram.com/p/C0abc123XYZ/",
      text: "Thanks for the shout-out!",
    },
  });
  return response.data;
};
```

## Errors

- [`comment-target-invalid`](https://pubnio.com/docs/problems/comment-target-invalid/): HTTP 400, Comment target invalid
- [`comment-unresolved`](https://pubnio.com/docs/problems/comment-unresolved/): HTTP 409, Comment outcome unresolved
- [`idempotency-conflict`](https://pubnio.com/docs/problems/idempotency-conflict/): HTTP 409, Idempotency key already used
- [`account-ambiguous`](https://pubnio.com/docs/problems/account-ambiguous/): HTTP 422, Account ambiguous
- [`provider-mismatch`](https://pubnio.com/docs/problems/provider-mismatch/): HTTP 422, Provider mismatch
- [`publish-account-not-found`](https://pubnio.com/docs/problems/publish-account-not-found/): HTTP 422, Publishing account not found
- [`comment-rejected`](https://pubnio.com/docs/problems/comment-rejected/): HTTP 422, Comment rejected

It also declares the problems [most operations](https://pubnio.com/docs/reference/#shared-problems) declare.

## Idempotency

Optional. A retry with the same `Idempotency-Key` returns the first result for 24 hours. Make one key per intent, such as `crypto.randomUUID()` or Python's `uuid4()`, and reuse it only to retry the same request. See [Idempotency](https://pubnio.com/docs/concepts/idempotency/).

## Limits

- Field lengths and ranges are in the [OpenAPI document](https://pubnio.com/api/v1/openapi).

## Related

- [Comments operations](https://pubnio.com/docs/reference/#comments)

Source: https://pubnio.com/docs/reference/comments-create/index.mdx
