Facebook Pixel
APILinkedIn Posts

Comment on a LinkedIn post

Add a comment to a LinkedIn post. Comments increase engagement and visibility. Set `tagPostAuthor` to true to tag the post author with a real @mention that notifies them. Supports posting as a company page if you have admin access. Rate limit: 100 comments per day.

POST/posts/comment
Authentication requiredPosts

Code Examples

curl -X POST 'https://api.connectsafely.ai/linkedin/posts/comment' \
-H 'Authorization: Bearer <your_api_key>' \
-H 'Content-Type: application/json' \
-d '{"postUrl":"https://linkedin.com/posts/example-post","comment":"Great breakdown, {{author}} — thanks for sharing this!","tagPostAuthor":true}'

Parameters

No parameters.

Request Body

FieldTypeRequiredDescription
accountIdstringNoLinkedIn account ID to use. If not provided, uses the default account.
postUrlstringYesFull URL of the LinkedIn post to comment on
commentstringYesComment text content. Supports @mentions and hashtags. When tagPostAuthor is true, place a {{author}} placeholder where the author tag should appear — otherwise the author name is prepended.
tagPostAuthorbooleanNoWhen true, tags the post author with a real @mention that notifies them. The tag is inserted at a {{author}} placeholder in comment if present, otherwise the author name is prepended.
companyUrnstringNoCompany URN to post comment as company page instead of personal profile

Example

{
  "postUrl": "https://linkedin.com/posts/example-post",
  "comment": "Great breakdown, {{author}} — thanks for sharing this!",
  "tagPostAuthor": true
}

Responses

StatusDescription
200Comment posted successfully
400Bad request - Missing required fields or validation error
401Unauthorized - Invalid or missing API key
429Rate limit exceeded
500Server error - Failed to post comment

Rate Limit Headers

All responses include rate limit information in the headers:

HeaderDescription
X-RateLimit-ActionThe action type being rate limited
X-RateLimit-LimitMaximum actions allowed per period
X-RateLimit-UsedActions used in current period
X-RateLimit-RemainingActions remaining
X-RateLimit-ResetISO 8601 timestamp when limit resets

200 Response Parameters

NameTypeDescription
successboolean
messagestringSuccess message
postUrlstringURL of the post that was commented on
commentstringThe comment text that was posted
accountIdstringLinkedIn account ID that posted the comment
postDetailsobjectDetails about the post that was commented on

200 Example

{
  "success": true,
  "message": "Successfully posted comment",
  "postUrl": "https://www.linkedin.com/feed/update/urn:li:activity:7430667226199830528/",
  "comment": "Great insights! Thanks for sharing.",
  "accountId": "696ce9e780e0483585e4e553",
  "postDetails": {
    "activityUrn": "urn:li:activity:7430667226199830528",
    "ugcPostUrn": null,
    "shareUrn": "urn:li:share:7430667225633550337",
    "featuredActivityUrn": null,
    "content": "Discover proven LinkedIn strategies for consultants to attract high-value clients..."
  }
}

400 Response Parameters

NameTypeDescription
errorstring

400 Example

{
  "error": "postUrl is required",
  "success": false
}

401 Response Parameters

NameTypeDescription
errorstring

401 Example

{
  "error": "Unauthorized"
}

429 Response Parameters

NameTypeDescription
errorstring
successboolean

429 Example

{
  "error": "Rate limit exceeded for COMMENT: 100/100 used. Resets at 2024-01-16T00:00:00.000Z",
  "success": false
}

500 Response Parameters

NameTypeDescription
errorstring

500 Example

{
  "error": "Failed to post comment",
  "success": false
}