Skip to main content
GET
Get comments from a post

Endpoint

Authentication

Include your API key in the request header:

Parameters

string
required
Professional post URL or URN.Examples:
  • https://www.linkedin.com/posts/username_some-post-slug-1234567890-abcd
  • urn:li:activity:7287782484287606784
  • urn:li:ugcPost:7287782484287606784
  • urn:li:groupPost:4521873-7287782484287606784 — a post published in a group, as urn:li:groupPost:<groupId>-<postId> or any URL containing it. A post in a private group is visible to the group’s members only and answers 404 POST_NOT_FOUND, like a deleted post.
A repost without commentary answers with the original post’s comments, in either sortBy order.
string
default:"relevance"
The order comments come back in:
  • relevance (default) — the source’s own ranking. It returns a ranked subset of the thread, not all of it: measured, 224 of 299 top-level comments on one post.
  • recent — newest first. It returns the complete thread in date order, and is the way to walk every comment or to pick up new ones since your last read.
Any other value is rejected with a 400 that costs nothing ('sortBy' must be one of: relevance, recent (received '…').).
integer
default:"100"
Number of comments to fetch per page.
  • Minimum: 1
  • Maximum: 100
  • Default: 100
integer
default:"0"
Offset of the first comment to return. This is how you page this endpoint: advance start by the number of comments you received.
  • Default: 0
string
Returned for continuity with the other endpoints. It does not advance this thread — page with start.

Response

array
Top-level comments, in the source’s order for the requested sortBy, each with its replies nested.
integer
Number of top-level comments the source reports for the post — replies are not included. Omitted when the source does not report one.
string
Token for fetching the next page of comments. Only present when more comments are available.
boolean
Indicates whether there are more comments to fetch. Always false on an empty page.

Example Request

Example Response

Errors

See Error Handling for the full list of error codes and recommended handling.
  • 400 — MISSING_PARAMETER / INVALID_PARAMETER (e.g. an unknown sortBy, free) / INVALID_URN
  • 401 — INVALID_API_KEY
  • 404 — POST_NOT_FOUND
  • 402 — QUOTA_EXHAUSTED
  • 429 — RATE_LIMITED
  • 500 — INTERNAL_ERROR
  • 503 — SERVICE_UNAVAILABLE

Pagination

This endpoint pages by offset:
  1. Make an initial request with start=0
  2. If hasMore is true, add the number of comments you received to start
  3. Continue until hasMore is false or a page comes back empty
A page can be much shorter than count and still not be the last one — the first page of a busy thread often returns a handful of comments while hundreds remain. Trust hasMore, not the number of items returned. An empty page always has hasMore: false.
To walk every comment, use sortBy=recent. Under the default relevance the source serves a ranked subset of the thread, so a full walk ends early — measured, 224 of 299 top-level comments. recent returns the complete thread, newest first, in a stable order, which also makes it the way to pick up new comments since your last read: stop as soon as you reach a comment you already have. Compare what you collected against total to check a walk.

Notes

This endpoint consumes 1 credit from your credit balance per API call, regardless of the count parameter value. Errors are free — with one exception: a 404 not found costs 1 credit. See Quotas.
Comments are returned in the source’s order for the requested sortBy — relevance by default, newest first with sortBy=recent. Each comment includes its replies (subcomments) nested within, and total counts top-level comments only.
Page with start, not paginationToken. To keep a thread up to date, poll it with sortBy=recent and stop at the first comment you already have.

Authorizations

X-API-Key
string
header
required

Query Parameters

postUrlOrUrn
string
required

Professional post URL or URN: urn:li:activity:<id>, urn:li:ugcPost:<id>, a group post as urn:li:groupPost:<groupId>-<postId>, or any post URL containing one. A repost without commentary answers with the original post's comments.

Example:

"https://www.linkedin.com/posts/username_post-slug-1234567890-abcd"

sortBy
enum<string>
default:relevance

Order of the comments. relevance (default) is the source's own ranking and returns a ranked SUBSET of the thread (measured: 224 of 299 top-level comments). recent returns the COMPLETE thread, newest first: use it to walk every comment or to pick up new ones. Any other value is a 400 that costs nothing.

Available options:
relevance,
recent
count
integer
default:100

Number of comments to fetch (default: 100)

Required range: 1 <= x <= 100
start
integer
default:0

Offset of the first item to return. This endpoint pages by offset: advance start by the number of items you received. Keep requesting while hasMore is true; an empty page ends the list.

Required range: x >= 0
paginationToken
string

Returned for continuity with the other endpoints. It does not advance this thread - page with start.

Response

Successfully fetched comments

comments
object[]

Top-level comments in the source's order for sortBy, each with its replies nested.

total
integer

Number of top-level comments the source reports for the post (replies not included). Omitted when the source does not report one.

Example:

42

paginationToken
string

Token for fetching the next page

hasMore
boolean

Whether more comments are available. Always false on an empty page.