Skip to content

Comment on or reply to a provider post

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

Comment on or reply to a provider post with 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 has each field’s type.

Examples

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

result = workspace.comments.create(
    account_id=account_id,
    target="https://www.instagram.com/p/C0abc123XYZ/",
    text="Thanks for the shout-out!",
)
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!"}'
pnio comments create --account-id "$ACCOUNT_ID" --target https://www.instagram.com/p/C0abc123XYZ/ --text "Thanks for the shout-out!"
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

It also declares the problems most operations 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.

Limits

Type to search…

↑↓ navigate↵ selectEsc close