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

# Comment on a Post

> Create a task to comment on a LinkedIn post as a user or company

> [!NOTE]
>
> **Safe pace per LinkedIn account:** up to 25 a day, at least 5 minutes apart, never templated text. Tentative, not enforced by OutX. See [Recommended pace](https://www.outx.ai/docs/api-reference/rate-limits.md#recommended-pace).

Programmatically add comments to LinkedIn posts through OutX. Engage as a user or on behalf of a company, automate interactions, and keep conversations active without manual effort.

## Request Body

**post\_id** `string` *required*

The unique identifier of the post to comment on. This is the `id` field from the Posts API response.

**user\_email** `string` *required*

Email address of the user who will comment on the post.

* For **user** actor type: The user's email
* For **company** actor type: The admin user's email who manages the company page

**comment\_text** `string` *required*

The text content of the comment. Cannot be empty or whitespace-only.

**Tips for effective comments:**

* Be genuine and add value to the conversation
* Keep it concise but meaningful
* Ask questions to encourage engagement
* Avoid generic responses like "Great post!"

**actor\_type** `string` (default: user)

Who is posting the comment. Options:

* `user` - Comment as an individual user
* `company` - Comment on behalf of a company page

**company\_title** `string`

**Required when `actor_type` is `company`**

The exact company name/title as it appears on LinkedIn. This is used to identify which company page should post the comment.

```bash Comment as User theme={null}
curl -X POST \
  "https://api.outx.ai/api-comment" \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
    "post_id": "123e4567-e89b-12d3-a456-426614174000",
    "user_email": "john.doe@example.com",
    "comment_text": "Great insights! Thanks for sharing.",
    "actor_type": "user"
  }'
```

```bash Comment as Company theme={null}
curl -X POST \
  "https://api.outx.ai/api-comment" \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
    "post_id": "123e4567-e89b-12d3-a456-426614174000",
    "user_email": "admin@company.com",
    "comment_text": "Excellent points from our team perspective! We'\''ve seen similar trends in our industry.",
    "actor_type": "company",
    "company_title": "Acme Corporation"
  }'
```

```javascript JavaScript theme={null}
// Comment as a user
const commentAsUser = async (postId, userEmail, commentText) => {
  const response = await fetch(
    'https://api.outx.ai/api-comment',
    {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
        'x-api-key': 'YOUR_API_KEY'
      },
      body: JSON.stringify({
        post_id: postId,
        user_email: userEmail,
        comment_text: commentText,
        actor_type: 'user'
      })
    }
  );
  
  return await response.json();
};

// Comment as a company
const commentAsCompany = async (postId, adminEmail, commentText, companyTitle) => {
  const response = await fetch(
    'https://api.outx.ai/api-comment',
    {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
        'x-api-key': 'YOUR_API_KEY'
      },
      body: JSON.stringify({
        post_id: postId,
        user_email: adminEmail,
        comment_text: commentText,
        actor_type: 'company',
        company_title: companyTitle
      })
    }
  );
  
  return await response.json();
};

// Usage
const result = await commentAsUser(
  'post-123',
  'john@example.com',
  'This is a valuable perspective on AI trends. Have you considered the impact on smaller businesses?'
);
console.log(result.message);
```

```python Python theme={null}
import requests

def comment_as_user(post_id, user_email, comment_text, api_key):
    """Add a comment to a post as a user"""
    url = 'https://api.outx.ai/api-comment'
    headers = {
        'Content-Type': 'application/json',
        'x-api-key': api_key
    }
    payload = {
        'post_id': post_id,
        'user_email': user_email,
        'comment_text': comment_text,
        'actor_type': 'user'
    }
    
    response = requests.post(url, headers=headers, json=payload)
    return response.json()

def comment_as_company(post_id, admin_email, comment_text, company_title, api_key):
    """Add a comment to a post as a company"""
    url = 'https://api.outx.ai/api-comment'
    headers = {
        'Content-Type': 'application/json',
        'x-api-key': api_key
    }
    payload = {
        'post_id': post_id,
        'user_email': admin_email,
        'comment_text': comment_text,
        'actor_type': 'company',
        'company_title': company_title
    }
    
    response = requests.post(url, headers=headers, json=payload)
    return response.json()

# Usage
result = comment_as_user(
    'post-123',
    'john@example.com',
    'Great insights! Thanks for sharing.',
    'YOUR_API_KEY'
)
print(result['message'])
```

```json Response theme={null}
{
  "success": true,
  "message": "Comment task created successfully",
  "task_id": "789e0123-e45b-67d8-a901-234567890123"
}
```

## Response Fields

**success** `boolean`

Whether the comment task was created successfully

**message** `string`

Human-readable message about the operation

**task\_id** `string`

Identifier of the queued extension task. It is not an `api_agent_task_id` and cannot be polled through [`/linkedin-agent/get-task-status`](https://www.outx.ai/docs/linkedin-api/get-task-status); there is no public status endpoint for it. Confirm the comment landed by reading the post back from [`GET /api-posts`](https://www.outx.ai/docs/api-reference/engagement/posts/get) or [`GET /api-interactions`](https://www.outx.ai/docs/api-reference/engagement/interactions/get).

## How It Works

**1. Task Creation**

When you call the Comment API, a task is created and queued for processing

**2. Validation**

The system validates:

* Post exists and belongs to your team's watchlists
* User email is valid and associated with your team
* Comment text is not empty
* Company title matches (if commenting as company)
* You haven't exceeded plan limits

**3. Asynchronous Processing**

The comment is processed asynchronously by OutX's automation system

**4. Execution**

The comment is posted on LinkedIn on behalf of the specified user or company

## Actor Types Explained

### User Actor Type

When `actor_type` is `user`:

* The comment appears as coming from the individual user
* `user_email` should be the email of the user who will comment
* The user must be part of your OutX team
* No `company_title` is needed

**Use case:** Personal engagement, thought leadership, networking

### Company Actor Type

When `actor_type` is `company`:

* The comment appears as coming from your company page
* `user_email` should be the admin user's email who manages the company page
* `company_title` must exactly match the company name on LinkedIn
* The admin user must have permission to manage the company page

**Use case:** Brand engagement, company thought leadership, B2B marketing

## Error Responses

| Status Code | Error Message | Description |
| - | - | - |
| 400 | Missing required parameter: post\_id | `post_id` is required |
| 400 | Missing required parameter: user\_email | `user_email` is required |
| 400 | Missing required parameter: comment\_text | `comment_text` is required |
| 400 | comment\_text cannot be empty | Comment text is whitespace-only |
| 400 | Invalid actor\_type | Must be 'user' or 'company' |
| 400 | company\_title is required when actor\_type is 'company' | Missing company title |
| 400 | Post does not support comment functionality | Post is missing required data |
| 401 | Unauthorized | Invalid or missing API key |
| 403 | Access denied | Post doesn't belong to your team's watchlists |
| 404 | Post not found | Invalid post ID |
| 404 | User not found | Invalid user email |
| 404 | Company not found | Company title doesn't match any company for the admin user |
| 402 | Plan limit reached | You've exceeded your plan's comment limit |

## Best Practices

> [accordion] Write Meaningful Comments
>
> * Add value to the conversation
> * Share relevant experiences or insights
> * Ask thoughtful questions
> * Avoid generic responses
> * Be authentic and genuine
> * Keep comments concise but substantive

> [accordion] Respect Rate Limits
>
> * Don't comment on too many posts at once
> * Spread comments throughout the day
> * Monitor your plan limits
> * Implement delays between API calls
> * Quality over quantity

> [accordion] Personalize When Possible
>
> * Reference specific points from the post
> * Tailor comments to the context
> * Use the author's name when appropriate
> * Avoid copy-paste comments
> * Make each comment unique

## Frequently Asked Questions

> [accordion] Can I comment from a company page?
>
> Yes. Set `actor_type` to `"company"` and provide the `company_title` field with the exact company name as it appears on LinkedIn. The `user_email` should be the email of an admin user who has permission to manage that company page.

> [accordion] Is there a character limit for comments?
>
> The OutX API does not impose its own character limit on comments. However, LinkedIn's standard comment length limits apply. LinkedIn currently allows up to approximately 1,250 characters per comment. Keep your comments within this limit to ensure they are posted successfully.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.