Skip to main content

Post Keyword Search API

Written by Kadri - RichAPI Support Team

POST /post_keyword_search • Credits: 0.1 credits per returned post

Post Keyword Search finds public LinkedIn posts that match a keyword. The response holds a content array of posts with the author, the post text, the engagement counts and the share URL. Each returned post costs 0.1 credits, so a full page of 50 posts costs 5 credits.

What does Post Keyword Search do?

A marketing team needs to know who talks about a topic on LinkedIn. Post Keyword Search runs one keyword query across public LinkedIn posts and returns the matches as JSON. Seven filters narrow the search by date, by content type, by author and by company. The data source is LinkedIn. One call returns one page of posts, plus totalElements and totalPages for the whole result set. The other post endpoints start from a known company or a known person. Post Keyword Search starts from a topic and finds the authors for you.

Which endpoint does Post Keyword Search use?

  • Method:POST

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

  • Authentication:x-api-key header

  • Request format: JSON request body

  • Response: Synchronous JSON

  • Page size: 1 to 50 posts, set by limit

  • Credits: 0.1 credits per returned post

Post Keyword Search 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_keyword_search only supports POST.

How to send a Post Keyword Search request

  1. Copy your API key from the RichAPI dashboard.

  2. Set keyword in the JSON request body. This parameter is required.

  3. Set limit to the number of posts per page. The maximum is 50.

  4. Set page to 0 for the first page. The count starts at 0.

  5. Set sort to DATE_POSTED for the newest posts first.

  6. Add any filter parameter from the filter table to narrow the search.

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

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

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

  10. Read totalPages to find how many pages the result set holds.

CAUTION: Set limit on every request. Each returned post costs 0.1 credits, so a full pass over 483 posts costs 48.3 credits.

cURL

curl -X POST https://api.richapi.ai/api/v1/post_keyword_search   
-H "x-api-key: YOUR_API_KEY"
-H "Content-Type: application/json"
-d '{
"keyword": "artificial intelligence",
"sort": "DATE_POSTED",
"datePosted": "PAST_WEEK",
"page": 0,
"limit": 50
}'

Python

import requests

response = requests.post(
"https://api.richapi.ai/api/v1/post_keyword_search",
headers={"x-api-key": "YOUR_API_KEY"},
json={
"keyword": "artificial intelligence",
"sort": "DATE_POSTED",
"datePosted": "PAST_WEEK",
"page": 0,
"limit": 50,
},
timeout=60,
)
response.raise_for_status()
print(response.json())

Node.js

const response = await fetch("https://api.richapi.ai/api/v1/post_keyword_search", {
method: "POST",
headers: {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
keyword: "artificial intelligence",
sort: "DATE_POSTED",
datePosted: "PAST_WEEK",
page: 0,
limit: 50,
}),
});

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

What parameters does Post Keyword Search accept?

Post Keyword Search accepts ten parameters. Only keyword is required. The names below are the real request body names.

Parameter

Type

Required

Default

Description

keyword

string

Yes

none

The search keyword, for example artificial intelligence.

page

integer

No

0

The page number. The count starts at 0.

limit

integer

No

10

The number of posts per page. The accepted range is 1 to 50.

sort

string

No

RELEVANCE

The sort order. Accepted values: RELEVANCE, DATE_POSTED.

datePosted

string

No

none

The date filter. Accepted values: PAST_24_HOURS, PAST_WEEK, PAST_MONTH.

contentType

string

No

none

The content type filter. Accepted values: VIDEO, IMAGE, JOB, LIVE_VIDEO, DOCUMENT, COLLABORATIVE_ARTICLE.

fromPerson

array

No

[]

Person entity URNs. The API returns only the posts of those people.

fromCompany

array

No

[]

Company entity URNs. The API returns only the posts of those company pages.

authorKeyword

array

No

[]

Author job titles, for example ["Head of Growth"].

authorIndustry

array

No

[]

Author industry values.

If you omit sort, the API sorts by RELEVANCE. If you omit datePosted or contentType, the search applies no date filter or content filter.

Which parameter name does the Post Keyword Search body reject?

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

One name often causes this failure. The page size parameter is limit. The request body rejects size.

Do not send this name

Send this parameter instead

size

limit

How do I filter LinkedIn posts by date, content type and author?

Post Keyword Search has seven filter parameters. Combine them in one request body to narrow the result set.

Parameter

Type

Accepted values

Effect

sort

string

RELEVANCE, DATE_POSTED

DATE_POSTED returns the newest posts first.

datePosted

string

PAST_24_HOURS, PAST_WEEK, PAST_MONTH

The API returns only the posts inside that window.

contentType

string

VIDEO, IMAGE, JOB, LIVE_VIDEO, DOCUMENT, COLLABORATIVE_ARTICLE

The API returns only the posts with that attachment type.

fromPerson

array

Person entity URNs

The API returns only the posts of those people.

fromCompany

array

Company entity URNs

The API returns only the posts of those company pages.

authorKeyword

array

Author job titles

The API returns only the posts of authors with a matched job title.

authorIndustry

array

Author industry values

The API returns only the posts of authors in those industries.

The example below finds video posts about developer tools from the past week. The author job title must match Head of Growth.

curl -X POST https://api.richapi.ai/api/v1/post_keyword_search   
-H "x-api-key: YOUR_API_KEY"
-H "Content-Type: application/json"
-d '{
"keyword": "developer tools",
"datePosted": "PAST_WEEK",
"contentType": "VIDEO",
"authorKeyword": ["Head of Growth"],
"sort": "DATE_POSTED",
"page": 0,
"limit": 50
}'

How does Post Keyword Search pagination work?

Post Keyword Search returns one page per call. Set limit to the page size and page to the page number. The page count starts at 0, so page: 0 returns the first page.

To read the next page, send the same request body again with page set to 1. Keep every other parameter the same, so that the result set and the order stay stable. Read totalPages to find how many pages the result set holds. Read totalElements to find the total number of matched posts. The first and last booleans mark the first page and the last page of the result set.

Each returned post costs 0.1 credits. The page size changes the number of calls, not the total cost.

How do I use Post Keyword Search for social listening?

Post Keyword Search turns a topic into a list of named authors and ranked posts. Follow these steps for a weekly social listening run.

  1. Build one keyword per topic that you track, for example a product name or a category.

  2. Send one request per keyword with datePosted set to PAST_WEEK.

  3. Set sort to DATE_POSTED and limit to 50.

  4. Read content[].commentary for each post and match it against your trigger words.

  5. Rank the posts by content[].numReactions and content[].numComments.

  6. Read content[].actor.followerCount to find the authors with the largest audience.

  7. Store content[].urn so that a later run can skip a post that you saw before.

  8. Send content[].shareUrl to your team as the reply target.

To find the people who reacted to a post, send the post URN to the RichAPI Post Activities endpoint. To enrich an author, send the profile URL to the RichAPI Profile Enrichment endpoint.

What does Post Keyword Search return?

The example below shows one post from a page of 10. A full page holds up to limit posts.

{
"content": [
{
"urn": "urn:li:activity:7429959579599532032",
"time": "2 hours ago",
"actor": {
"url": "https://www.linkedin.com/in/priyanathan",
"name": "Priya Nathan",
"profileType": "PERSON",
"followerCount": 15420
},
"content": {
"image": null
},
"shareUrl": "https://www.linkedin.com/posts/priyanathan_artificial-intelligence-activity-7429959579599532032-K4pQ",
"commentary": "We moved our retrieval pipeline to a smaller model this quarter. Latency dropped 40 percent and quality held. Full write-up in the comments.",
"numComments": 16,
"numReactions": 108,
"reactionType": {
"like": 101,
"interest": 2,
"appreciation": 5
}
}
],
"first": true,
"last": false,
"totalPages": 49,
"totalElements": 483,
"numberOfElements": 10
}

Which fields does the Post Keyword Search response hold?

Field

Type

Description

content

array

The matched posts on this page.

first

boolean

true means that this page is the first page of the result set.

last

boolean

true means that this page is the last page of the result set.

totalPages

integer

The total number of pages in the result set.

totalElements

integer

The total number of matched posts across every page.

numberOfElements

integer

The number of posts on this page.

Which fields does each matched post hold?

Each object in the content array holds the fields below.

Field

Type

Description

content[].urn

string

The LinkedIn activity URN of the post, for example urn:li:activity:7429959579599532032.

content[].commentary

string

The post text.

content[].shareUrl

string

The public LinkedIn URL of the post.

content[].time

string

The relative publication time, for example 2 hours ago.

content[].numReactions

integer

The total number of reactions on the post.

content[].numComments

integer

The number of comments on the post.

content[].reactionType

object

The count for each reaction type.

content[].reactionType.like

integer

The number of like reactions.

content[].reactionType.interest

integer

The number of interest reactions.

content[].reactionType.appreciation

integer

The number of appreciation reactions.

content[].actor

object

The author of the post.

content[].actor.name

string

The author name, for example Priya Nathan.

content[].actor.url

string

The LinkedIn URL of the author.

content[].actor.profileType

string

The author type, for example PERSON.

content[].actor.followerCount

integer

The number of followers of the author.

content[].content

object

The media attached to the post.

content[].content.image

string

The attached image URL. The value is null for a post with no image.

How much does Post Keyword Search cost?

Post Keyword Search costs 0.1 credits for each post in the response. One credit costs $0.02 on the 1,000 and 5,000 credit packs, so one post costs $0.002 there. Larger packs cost less per credit.

RichAPI charges 0.1 credits for each post in a 2xx response. A response outside the 200 range costs nothing.

Cost of one call, by page size:

limit

Posts returned

Credits

Cost

10

10

1

$0.02

50

50

5

$0.10

50

0

0

$0.00

Cost of many calls, at 50 posts per call:

Calls

Credits

Cost

1

5

$0.10

10

50

$1.00

100

500

$10.00

1,000

5,000

$100.00

Because the price is per post, the page size does not change the cost of a full pass. A result set of 483 posts costs 48.3 credits at every limit value.

limit

Pages for 483 posts

Credits

Cost

10

49

48.3

$0.97

25

20

48.3

$0.97

50

10

48.3

$0.97

Is Post Keyword Search billed per call or per result?

Post Keyword Search is billed per result: 0.1 credits for each post on the page that you receive. totalElements does not change the price.

A search that returns one page of 50 posts costs 5 credits. A search that returns one page of 10 posts costs 1 credit. The keyword can match 40 posts or 4 million: only the posts that you receive count.

The totalElements value in the response tells you how many posts match your keyword across all pages. It is a count, not a charge. To read more of that set, send more pages. Each post on them costs 0.1 credits.

Which errors can Post Keyword Search return?

Status

Meaning

What to do

400

The request body failed validation. An unknown body key or a wrong value type causes this failure.

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

401

The API key is missing or wrong.

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

402

The organization has no credits left, or the team reached its monthly spend limit.

Buy credits in the RichAPI dashboard.

403

The API key has no access, or Post Keyword Search is not on the plan.

Check the plan and the endpoint access in the RichAPI dashboard.

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, write to [email protected].

502

The LinkedIn data source failed.

Send the request again. If the failure repeats, write to [email protected].

RichAPI charges no credit for any response outside the 200 range.

Frequently asked questions

How much does one Post Keyword Search call cost?

Post Keyword Search costs 0.1 credits per returned post, so a full page of 50 posts costs 5 credits. That is $0.10 on the 1,000 and 5,000 credit packs. Larger packs cost less per credit. The totalElements count in the response does not change the price.

Does Post Keyword Search charge per result or per call?

Post Keyword Search charges 0.1 credits per returned post. It does not bill from totalElements. A call that returns 50 posts costs 5 credits, and a call that returns 1 post costs 0.1 credits.

Is Post Keyword Search a GET or a POST endpoint?

Post Keyword Search is a POST endpoint at https://api.richapi.ai/api/v1/post_keyword_search. Every parameter goes in the JSON request body. A GET request returns 405.

Why does Post Keyword Search return Unknown input field(s): size?

The request body parameter for the page size is limit, not size. The request body rejects size with a 400 error.

How many LinkedIn posts does one Post Keyword Search page return?

One Post Keyword Search page returns up to 50 posts in the content array. Set limit to the page size. Read numberOfElements for the count on the page that you received.

How do I get the second page of Post Keyword Search results?

Send the same request body again with page set to 1. The page count starts at 0, so page: 0 is the first page and page: 1 is the second page.

What does Post Keyword Search cost for zero results?

A Post Keyword Search call that returns zero posts costs 0 credits, because the price is per returned post.

How do I find posts written by one company only?

Set fromCompany to an array of company entity URNs. To read the whole feed of one company page, use the RichAPI LinkedIn Company Posts endpoint. That endpoint costs 0.2 credits per returned post.

What engagement data does Post Keyword Search return?

Each post holds numReactions, numComments and a reactionType object. The reactionType object holds one count per reaction type, for example like, interest and appreciation.

Related articles

Did this answer your question?