LinkedIn API endpoint

LinkedIn comment API: AI comments, human approval

Swarmhit's LinkedIn comment API posts a comment on a lead's most recent post from a connected sender, with one POST to /accounts/{id}/post-comments and the exact text you choose. In campaigns, the comment step goes further: AI writes a comment from the lead's latest post and your instructions, and each draft can wait in an approval queue until a person approves, edits or regenerates it.

Endpoints

  • POST/accounts/{id}/post-comments

    Comment on the lead's last post

  • GET/pending-comments

    List AI drafts awaiting approval

  • POST/pending-comments/{id}/approve

    Approve a draft

POST

/accounts/{id}/post-comments

api/v1
curl -X POST https://app.swarmhit.com/api/v1/accounts/acc_123/post-comments \
  -H "Authorization: Bearer $SWARMHIT_API_KEY" \
  -H "Idempotency-Key: 6f1c2f3e-comment-ana" \
  -H "Content-Type: application/json" \
  -d '{
    "profileUrl": "https://www.linkedin.com/in/ana-lopez",
    "text": "Great breakdown of SDR ramp time, Ana. The point on territory design is underrated."
  }'

How the LinkedIn comment API works

  • The direct call posts exactly the text you send on the lead's latest post, and returns 422 when the lead has no recent post.
  • In a campaign, the AI drafts are listed by GET /pending-comments, then approved, rejected or regenerated through /pending-comments/{id}/approve, /reject and /regenerate. A comment.pending webhook tells your product a draft is waiting.
  • Comments posted by a direct call are logged as direct actions with type post_comment, including the postUrl and the comment text.

As a campaign step

The same action runs inside sequences as the comment_post step: one POST /campaigns sets up the whole sequence, and the engine schedules each step per sender and mailbox, inside the sending window, with rotation across senders.

  • comment_post takes a prompt, the instruction the AI follows with the lead's latest post as context, up to 10,000 characters and with {{variables}}.
  • requireApproval holds each draft for a human; without it the comment posts automatically. maxPostAgeDays (1 to 365, 30 by default) skips leads whose latest post is older, so the sender never comments on stale content.

Limits and safety

  • Comments count against the sender's daily post-comment cap; past it, the API answers 429 with details { limit, used, scope, resetAt }.
  • Every sender runs on its own dedicated proxy with managed warmup and health checks, behind 250+ safeguards monitored 24/7.

LinkedIn senders cost $16.90 a month each for the first 50, tiered down to $6.90, with no minimum. See pricing.

Webhooks

Direct calls answer synchronously with the action record. In campaigns, comment.pending flags an AI draft waiting for review and lead.status_changed fires when a lead reaches a resting status.

Events to subscribe to: comment.pending, lead.status_changed. Deliveries are signed and retried. How LinkedIn webhooks work

LinkedIn comment API, answered

Can AI write LinkedIn comments automatically?

Yes, in campaigns. The comment_post step sends the lead's latest post and your prompt to the AI, which writes a comment for that post. You decide whether each draft posts automatically or waits for approval, and how old a post can be before the lead skips the step.

How does the approval queue for AI comments work?

With requireApproval on, every draft lands in a queue readable through GET /pending-comments, and a comment.pending webhook fires. A person can approve it as is, edit it, reject it or ask for a new version. Nothing posts until it is approved.

Which LinkedIn post gets the comment?

The lead's most recent post. Direct calls return 422 if there is no recent post; campaign steps skip leads whose latest post is older than maxPostAgeDays, 30 days by default.

More LinkedIn API endpoints

  • Sequencer built in
  • 250+ safeguards monitored 24/7
  • REST API and signed webhooks

Comment on a post from your product.
Safeguards included.

Get an API key, connect a sender through a hosted link, and make your first call in minutes.