Skip to main content

Post Activities API

Written by Kadri - RichAPI Support Team

POST /post_activities • Credits: 3 credits per call

Post Activities returns the people who engaged with one LinkedIn post. One call returns one page of comments, or one page of reactions, with the profile of each person. One POST call costs 3 credits, which is $0.06.

What does Post Activities do?

A LinkedIn post carries a public list of the people who commented on it and the people who reacted to it. Post Activities reads that list and returns it as JSON, one page per call. The data source is LinkedIn. The type parameter selects the comment stream or the reaction stream. Each entry holds a person: a first name, a last name and a LinkedIn profile identifier. The response also holds totalElements, so you know how many people engaged before you page through the rest.

Which endpoint does Post Activities use?

  • Method: POST

  • URL: https://api.richapi.ai/api/v1/post_activities

  • Authentication: x-api-key header

  • Request format: JSON request body

  • Response: synchronous JSON

  • Credits: 3 credits per call

Post Activities accepts the POST method only. Every parameter goes in the JSON request body. If you send GET, the API returns 405 with the message post_activities only supports POST.

How to send a Post Activities request

  1. Copy your API key from the RichAPI dashboard.

  2. Find the activity URN of the post.

  3. Set urn in the JSON request body.

  4. Set type to COMMENT for the comment stream, or to REACTION for the reaction stream.

  5. Set page to 0 for the first page.

  6. Set limit to the number of entries that you want per page.

  7. Send a POST request to https://api.richapi.ai/api/v1/post_activities.

  8. Send the API key in the x-api-key header.

  9. Read the people from the content array in the response.

  10. Read totalElements for the size of the full stream.

CAUTION: Each page costs 3 credits. A post with 400 reactions costs 120 credits at limit: 10, and 48 credits at limit: 25. Raise limit before you page through a large post.

cURL

curl -X POST https://api.richapi.ai/api/v1/post_activities   
-H "x-api-key: YOUR_API_KEY"
-H "Content-Type: application/json"
-d '{
"urn": "urn:li:activity:7458532524865232896",
"type": "COMMENT",
"page": 0,
"limit": 10
}'

Python

import requests

response = requests.post(
"https://api.richapi.ai/api/v1/post_activities",
headers={"x-api-key": "YOUR_API_KEY"},
json={
"urn": "urn:li:activity:7458532524865232896",
"type": "COMMENT",
"page": 0,
"limit": 10,
},
timeout=60,
)
response.raise_for_status()
print(response.json())

Node.js

const response = await fetch("https://api.richapi.ai/api/v1/post_activities", {
method: "POST",
headers: {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
urn: "urn:li:activity:7458532524865232896",
type: "COMMENT",
page: 0,
limit: 10,
}),
});

const data = await response.json();
console.log(data);

What parameters does Post Activities accept?

Post Activities accepts four parameters. The urn parameter is required. The other three parameters are optional.

Parameter

Type

Required

Default

Description

urn

string

Yes

""

LinkedIn activity URN of the post, for example urn:li:activity:7458532524865232896. A post URL is not a valid value.

type

string

No

COMMENT

The stream to return. The accepted values are COMMENT and REACTION.

page

integer

No

0

The page number. The count starts at 0.

limit

integer

No

10

The number of entries per page.

The request body accepts the four parameter names above and no others. If the body holds any other key, the API returns 400 with the message Unknown input field(s): <name>.

CAUTION: The parameter for the page size is limit, and not size. A request body with size returns 400 with the message Unknown input field(s): size.

The request body has no useCache parameter.

Which values does the type parameter of Post Activities accept?

The type parameter of Post Activities accepts two values. The default is COMMENT. The value changes the shape of each entry in the content array.

Value

Returns

Shape of each content entry

COMMENT

The comment stream of the post. This is the default value.

id, url, comment, commenter, reactionType, totalComments, totalReactions

REACTION

The reaction stream of the post.

reaction, reactor

POST is not a valid value for the type parameter of Post Activities. POST belongs to the type parameter of the Profile Activities endpoint, which reads a person and not a post.

How does Post Activities pagination work?

Post Activities returns one page per call. The page parameter selects the page, and the count starts at 0. The limit parameter sets the number of entries per page.

The response carries four fields that drive the loop:

Field

Use

totalElements

The total number of comments or reactions on the post.

totalPages

The number of pages at the requested limit.

numberOfElements

The number of entries in content on the current page.

last

true means that the current page is the final page.

To read the whole stream, send page: 0 first. Then raise page by 1 for each further call. If last is true, stop.

import requests

people = []
page = 0

while True:
response = requests.post(
"https://api.richapi.ai/api/v1/post_activities",
headers={"x-api-key": "YOUR_API_KEY"},
json={
"urn": "urn:li:activity:7458532524865232896",
"type": "COMMENT",
"page": page,
"limit": 25,
},
timeout=60,
)
response.raise_for_status()
body = response.json()
people.extend(body["content"])
if body["last"]:
break
page = page + 1

print(len(people), "people")

CAUTION: Every page in the loop above costs 3 credits. Read totalElements from the first page. Divide that number by limit for the cost of the full pass.

What does Post Activities return?

The example below shows one Post Activities response for type: "COMMENT". The values are illustrative. The field names are the real field names.

{
"content": [
{
"id": "urn:li:comment:(urn:li:activity:7458532524865232896,7458701223948013568)",
"url": "https://www.linkedin.com/feed/update/urn:li:activity:7458532524865232896?commentUrn=urn%3Ali%3Acomment%3A7458701223948013568",
"comment": "The slide on vendor overlap matched our own audit almost exactly. We cut three tools and kept the same coverage.",
"commenter": {
"profileId": "priya-raghunathan",
"firstName": "Priya",
"lastName": "Raghunathan"
},
"reactionType": {
"like": 9,
"praise": 2
},
"totalComments": 2,
"totalReactions": 11
},
{
"id": "urn:li:comment:(urn:li:activity:7458532524865232896,7458744019283726336)",
"url": "https://www.linkedin.com/feed/update/urn:li:activity:7458532524865232896?commentUrn=urn%3Ali%3Acomment%3A7458744019283726336",
"comment": "Which two vendors did you keep? We are in the middle of the same review and the coverage numbers are hard to compare.",
"commenter": {
"profileId": "daniel-okonkwo",
"firstName": "Daniel",
"lastName": "Okonkwo"
},
"reactionType": {
"like": 4
},
"totalComments": 1,
"totalReactions": 4
}
],
"totalElements": 34,
"totalPages": 4,
"numberOfElements": 10,
"first": true,
"last": false
}

Which fields does the Post Activities response hold?

The Post Activities response holds one page of entries in content. Five more fields describe the position of that page in the full stream.

Field

Type

Description

content

array

One entry per comment, or one entry per reaction, on the requested page.

totalElements

integer

The total number of comments or reactions on the post.

totalPages

integer

The number of pages in the full stream at the requested limit.

numberOfElements

integer

The number of entries in content on the current page.

first

boolean

true means that the current page is page 0.

last

boolean

true means that the current page is the final page.

Which comment fields does Post Activities return?

The table below covers a request body with type set to COMMENT.

Field

Type

Description

content[].id

string

The LinkedIn comment identifier.

content[].url

string

The LinkedIn URL of the comment.

content[].comment

string

The comment text.

content[].commenter

object

The profile of the person who wrote the comment.

content[].commenter.profileId

string

The LinkedIn profile identifier of the person who wrote the comment.

content[].commenter.firstName

string

The first name of the person who wrote the comment.

content[].commenter.lastName

string

The last name of the person who wrote the comment.

content[].reactionType

object

The reaction count for each reaction type on the comment.

content[].totalComments

integer

The number of replies to the comment.

content[].totalReactions

integer

The number of reactions on the comment.

Which reaction fields does Post Activities return?

The table below covers a request body with type set to REACTION.

Field

Type

Description

content[].reaction

string

The reaction type.

content[].reactor

object

The profile of the person who reacted.

content[].reactor.profileId

string

The LinkedIn profile identifier of the person who reacted.

content[].reactor.firstName

string

The first name of the person who reacted.

content[].reactor.lastName

string

The last name of the person who reacted.

{
"content": [
{
"reaction": "PRAISE",
"reactor": {
"profileId": "sofia-lindqvist",
"firstName": "Sofia",
"lastName": "Lindqvist"
}
}
],
"totalElements": 412,
"totalPages": 42,
"numberOfElements": 10,
"first": true,
"last": false
}

How do I turn a competitor post into a warm lead list?

Everyone who commented on a competitor post read that post and reacted to the message in public. Post Activities turns one such post into a list of named people. Three RichAPI calls carry you from a company name to an enriched profile for each person.

  1. Find a recent post of the competitor. Send a LinkedIn Company Posts request with the company URL. For a topic instead of a company, send a Post Keyword Search request with the keyword.

  2. Read the activity identifier of the post from the search response.

  3. Build the URN. Add the prefix urn:li:activity: to the digits of that identifier.

  4. Send a Post Activities request with that urn, type set to COMMENT, and page set to 0.

  5. Read totalElements and divide it by limit. The result is the number of calls for a full pass.

  6. Raise page by 1 for each further call. If last is true, stop.

  7. Collect content[].commenter.profileId from every page.

  8. Build a profile URL for each person: https://www.linkedin.com/in/<profileId>.

  9. Send each profile URL to the Enrich Profile endpoint for the title and the company. Enrich Profile returns no email. For a work email, send the name and the company domain to the Email Finder endpoint (5 credits per call, a miss is free).

  10. Quote the exact content[].comment text of each person in your outreach message.

A person who wrote a comment carries a stronger signal than a person who reacted. Start with type: "COMMENT". Run the same pass with type: "REACTION" for the wider list.

What does the full chain cost?

The arithmetic below covers one competitor post with 34 comments. One credit costs $0.02 on the 1,000 and 5,000 credit packs.

Chain A starts from a company page:

Step

Endpoint

Billing unit

Volume

Credits

Cost

1

LinkedIn Company Posts

0.2 credits per returned post

1 call, 25 posts

5

$0.10

2

Post Activities

3 credits per call

4 calls at limit: 10

12

$0.24

3

Enrich Profile

1 credit per call

34 calls

34

$0.68

Total

51

$1.02

Chain B starts from a keyword:

Step

Endpoint

Billing unit

Volume

Credits

Cost

1

Post Keyword Search

0.1 credits per returned post

1 call, 25 posts

2.5

$0.05

2

Post Activities

3 credits per call

4 calls at limit: 10

12

$0.24

3

Enrich Profile

1 credit per call

34 calls

34

$0.68

Total

48.5

$0.97

Each chain returns 34 enriched people for about one dollar. That is 3 cents per warm lead.

Step 2 is the cheapest step to tune. At limit: 25, the same 34 comments need 2 calls instead of 4. That drops step 2 from 12 credits to 6 credits, and it drops each total by 6 credits.

How much does Post Activities cost?

Post Activities costs 3 credits per call. One credit costs $0.02 on the 1,000 and 5,000 credit packs, so one Post Activities call costs $0.06 there. Larger packs cost less per credit. The price is flat. The number of entries in the response does not change the price.

CAUTION: Post Activities bills per call, and not per result. Three endpoints in the same family bill per result: Post Keyword Search, Profile Activities and LinkedIn Company Posts. Do not carry their per-result billing across to Post Activities.

Calls

Credits

Cost

1

3

$0.06

10

30

$0.60

100

300

$6.00

1,000

3,000

$60.00

10,000

30,000

$600.00

Because the price is per call, the limit value sets the cost of a full pass. The table below covers one post with 100 comments.

limit

Calls for 100 comments

Credits

Cost

10

10

30

$0.60

20

5

15

$0.30

25

4

12

$0.24

50

2

6

$0.12

RichAPI reserves 3 credits before the call. RichAPI commits 3 credits for any response in the 200 range, and refunds the full reservation for any other response. A 200 response with an empty content array still costs 3 credits.

Which LinkedIn post endpoints bill per call and which bill per result?

RichAPI has six endpoints in the LinkedIn post family. Three bill per call and three bill per result. Read the billing unit before you plan a volume.

Endpoint

Input

Billing unit

Credits

Post Activities

One post URN

Per call

3

Post Details

One post URN

Per call

1

Post Keyword Search

A keyword

Per result

0.1

Profile Activities

One person URN

Per result

2

Enrich Profile

One profile URL

Per call

1

LinkedIn Company Posts

One company URL, ID, or universal name

Per result

0.2

Which errors can Post Activities return?

Status

Meaning

What to do

400

The request body failed validation. A missing urn, an unknown body key, or a wrong value type causes this failure.

Correct the parameter that the error message names. Use the four names in the parameter table.

401

The API key is missing, wrong or revoked.

Send a valid key in the x-api-key header.

402

Insufficient credits: the organization has too few credits. Or Monthly spend limit reached: the team hit its monthly spend limit.

Buy credits in the RichAPI dashboard, or ask the organization owner to raise the spend limit.

403

Endpoint not available on your plan: this API key has no access to this endpoint.

Call GET /api/v1/my-endpoints to list the endpoints this key can use. Contact support for access.

405

The request used a method other than POST.

Send the request again with the POST method.

429

Too many requests.

Read the Retry-After header. Wait that many seconds, then send the request again.

500

The API failed.

Send the request again. If the failure repeats, contact support.

502, 503 or 504

The upstream service is temporarily unavailable.

Send the request again after a short wait.

Frequently asked questions

Is Post Activities billed per call or per result?

Post Activities is billed per call. One call costs 3 credits, which is $0.06, and the number of entries in the response does not change that price. A page of 25 comments and a page of 1 comment both cost 3 credits.

What is the difference between COMMENT and REACTION in Post Activities?

COMMENT returns the comment stream of the post, and each entry holds the comment text and the commenter profile. REACTION returns the reaction stream, and each entry holds the reaction type and the reactor profile. COMMENT is the default value, and POST is not valid for Post Activities.

Does Post Activities accept a LinkedIn post URL?

No. Post Activities accepts the urn parameter only, and the value must be a LinkedIn activity URN such as urn:li:activity:7458532524865232896. A url key in the request body returns 400 with the message Unknown input field(s): url.

How do I read every comment on a LinkedIn post?

Send the first request with page set to 0. Raise page by 1 for each further request. If the response field last is true, stop. Each page costs 3 credits, so a large limit value lowers the cost of the full pass.

What is the difference between Post Activities and Post Details?

Post Details returns one snapshot of a whole post for 1 credit per call. That snapshot holds the post text, the author, the media and the engagement counts. Post Activities returns one page of the comment stream or the reaction stream for 3 credits per call. Many Post Activities calls reach every person on a large post.

Why does my Post Activities request return 400 for the size field?

The page size parameter of Post Activities is limit, and not size. RichAPI rejects any key that is not urn, type, page or limit.

Does a Post Activities call with no comments cost credits?

Yes. RichAPI commits 3 credits for any response in the 200 range, and an empty content array is a 200 response. RichAPI refunds the full reservation for a 400, 401, 403, 405, 429 or 500 response.

Can I turn off the cache on a Post Activities call?

No. The request body has no useCache parameter, and a useCache key returns 400 with the message Unknown input field(s): useCache.

Related articles

Did this answer your question?