Skip to main content
The Comment Post endpoint creates an async task to post a comment on a LinkedIn post. You provide the post’s activity URN and the comment text, and the API handles posting the comment through your team’s oldest admin member’s LinkedIn account.

Endpoint

POST https://api.outx.ai/linkedin-agent/comment-post

Headers

HeaderTypeRequiredDescription
Content-TypestringYesMust be application/json
x-api-keystringYesYour OutX API key

Request Body

FieldTypeRequiredDescription
social_urnstringYesThe LinkedIn activity URN of the post (e.g., "urn:li:activity:7123456789012345678")
comment_textstringYesThe text content of the comment to post
{
  "social_urn": "urn:li:activity:7123456789012345678",
  "comment_text": "Great insights! Thanks for sharing."
}
The comment is posted using your team’s oldest admin member’s LinkedIn account. Make sure this team member is aware that comments will be posted from their account via the API.

Response

The endpoint returns immediately with a task ID:
{
  "success": true,
  "api_agent_task_id": "550e8400-e29b-41d4-a716-446655440000",
  "message": "Comment post task created successfully"
}
FieldTypeDescription
successbooleanWhether the task was created successfully
api_agent_task_idstringUUID to poll for results via Get Task Status
messagestringHuman-readable confirmation

Polling for Results

Poll the Get Task Status endpoint to confirm the comment was posted:
GET https://api.outx.ai/linkedin-agent/get-task-status?api_agent_task_id=550e8400-e29b-41d4-a716-446655440000

Completed Response

{
  "success": true,
  "data": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "status": "completed",
    "task_input": {
      "task_type": "agent_comment_post",
      "social_urn": "urn:li:activity:7123456789012345678",
      "comment_text": "Great insights! Thanks for sharing."
    },
    "task_output": {
      "commented": true
    }
  }
}

Code Examples

# Comment on a post
curl -X POST \
  "https://api.outx.ai/linkedin-agent/comment-post" \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
    "social_urn": "urn:li:activity:7123456789012345678",
    "comment_text": "Great insights! Thanks for sharing."
  }'

# Check the result
curl -X GET \
  "https://api.outx.ai/linkedin-agent/get-task-status?api_agent_task_id=TASK_ID" \
  -H "x-api-key: YOUR_API_KEY"

Best Practices for Comments

Well-crafted comments drive better engagement and reflect positively on your LinkedIn presence. Here are some tips for effective automated commenting.
  • Be genuine and specific. Reference something from the post content rather than posting generic responses like “Great post!”
  • Add value. Share a related insight, ask a thoughtful question, or offer a complementary perspective.
  • Keep it concise. LinkedIn comments that are 1-3 sentences tend to perform best.
  • Vary your comments. If you are commenting on multiple posts, make each comment unique. Repeating the same text can look spammy.
  • Space out your comments. Avoid commenting on dozens of posts in rapid succession. Natural timing patterns are less likely to trigger LinkedIn’s activity monitoring.

Error Responses

StatusErrorDescription
400Missing or invalid 'social_urn'The social_urn field is missing or not a string
400Missing or invalid 'comment_text'The comment_text field is missing or not a string
401Missing API Key / Invalid API KeyAPI key is missing or invalid
403Plugin installation required...No team member has an active Chrome extension. See Authentication
404No admin user found in the teamYour team has no admin members

FAQ

The comment is posted using your team’s oldest admin member’s LinkedIn account (sorted by when they joined the team). This is the team member whose Chrome extension session executes the action.
LinkedIn’s own comment character limit applies (approximately 1,250 characters). The API does not enforce an additional limit, but your comment will be truncated by LinkedIn if it exceeds their limit.
You can include hashtags (e.g., #AI #MachineLearning) directly in the comment_text. LinkedIn will render them as clickable hashtags. @mentions of specific users are not currently supported through the API.
The API currently supports posting comments only. Editing and deleting comments is on our roadmap. You can manually edit or delete comments from the LinkedIn interface.
Since comments are posted through real browser sessions, LinkedIn’s standard activity policies apply. We recommend spacing comments at least 30-60 seconds apart and limiting total daily comment volume to patterns that resemble natural human behavior.