API Description

Reddit Comments API — Collect Reddit comments using the pagination, ordering and filters listed for this operation.

Authenticate with your Pangolinfo API Key to receive structured JSON data.

Request URL

POST https://scrapeapi.pangolinfo.com/api/v1/social/reddit-comments

Request Headers

ParametersParameter valueTypeDescription
Content-Typeapplication/jsonstringData format
AuthorizationBearer xxxstringAuthorization Token

Collection takes up to approximately 75 seconds. Set your client timeout to 90 seconds.

Request Parameters

ParameterRequiredTypeDescription
targetYesstringTarget URL, supported ID or search keyword for this operation.
optionsNoobjectOptional collection settings, described below.

options Parameters

ParameterRequiredTypeDescription
maxPagesNointegerPages to collect. Default: 1; values above 5 are capped at 5. Must be a positive integer.
Default: 1
Minimum: 1
Maximum: 5
cursorNostring | nullContinuation cursor from the previous response. Pass the value unchanged.
sortNostringResult ordering. Supported values are listed below.
commentIdNostringParent comment identifier. Set this to collect replies instead of root comments.

Only the request parameters listed on this page are used; other fields are ignored. Pass pagination cursors back unchanged, without encoding, decoding or conversion.

One page by default, capped at five per request. Page counts must be positive integers; higher values are capped at five.

A non-empty commentId selects explicit reply mode. Direct replies are billed; Facebook also bills returned nested replies. Continue with the cursor described above.

Normal mode includes at most one reply level without expanding additional collapsed threads. Explicit reply mode uses the reply endpoint defaults.

Response Fields

FieldTypeDescription
codeintegerStatus code; 0 indicates success.
messagestringResponse message; ok on success.
pointCostnumberPoints charged for this request.
dataobjectCollected data, with fields described below.
metaobjectRequest identifier and duration in milliseconds.
billingobjectCharged units, unit price and billing rule version.

data Fields

FieldTypeDescription
typestringResult type.
commentsCountnumber | nullPlatform-reported comment total; not the number billed.
commentsobject[]Root comments in comment mode.
commentIdstringParent comment identifier. Set this to collect replies instead of root comments.
repliesobject[]Replies in reply mode.
paginationobjectContinuation cursor and whether more results are available.

data.comments[] Fields

FieldTypeDescription
timeobject | nullPublication time.
contentstring | nullContent text; may be null for records without text.
scorenumber | nullComment or post score.
avatarnullAvatar URL.
nicknamestring | nullAuthor display name.
profileUrlstring | nullAuthor profile URL.
idstringRecord identifier.
parentIdstring | nullParent post or comment identifier.
depthnumberComment nesting depth; 0 is a root comment.
replyCountnumberPlatform-reported reply count.
urlstring | nullContent URL.
replysobject[]Nested replies.

data.comments[].time Fields

FieldTypeDescription
textstring | nullText value.
valuenumber | nullParsed value.

data.comments[].replys[] Fields

FieldTypeDescription
timeobject | nullPublication time.
contentstring | nullContent text; may be null for records without text.
scorenumber | nullComment or post score.
avatarnullAvatar URL.
nicknamestring | nullAuthor display name.
profileUrlstring | nullAuthor profile URL.
idstringRecord identifier.
parentIdstring | nullParent post or comment identifier.
depthnumberComment nesting depth; 0 is a root comment.
replyCountnumberPlatform-reported reply count.
urlstring | nullContent URL.
replysobject[]Nested replies.

data.replies[] Fields

FieldTypeDescription
timeobject | nullPublication time.
contentstring | nullContent text; may be null for records without text.
scorenumber | nullComment or post score.
avatarnullAvatar URL.
nicknamestring | nullAuthor display name.
profileUrlstring | nullAuthor profile URL.
idstringRecord identifier.
parentIdstring | nullParent post or comment identifier.
depthnumberComment nesting depth; 0 is a root comment.
replyCountnumberPlatform-reported reply count.
urlstring | nullContent URL.
replysobject[]Nested replies.

Request Example

curl --request POST \
  --url https://scrapeapi.pangolinfo.com/api/v1/social/reddit-comments \
  --header 'Authorization: Bearer YOUR_PANGOLINFO_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "target": "https://www.reddit.com/r/IAmA/comments/z1c9z/i_am_barack_obama_president_of_the_united_states/"
}'

Response Example

This excerpt shows the first item of each list. Long text and URLs are shortened; pointCost is the charge for the complete response. The playground contains the full schema.

{
  "code": 0,
  "message": "ok",
  "pointCost": 3.2,
  "data": {
    "type": "comments",
    "commentsCount": 22716,
    "comments": [
      {
        "time": {
          "text": "2012-08-29T20:05:19.000Z",
          "value": 1346270719000
        },
        "content": "How do you balance family life and hobbies with, well, being the POTUS?",
        "score": 1556,
        "avatar": null,
        "nickname": "gobearss",
        "profileUrl": "https://www.reddit.com/user/gobearss/",
        "replys": [
          {
            "time": {
              "text": "2012-08-29T21:04:58.000Z",
              "value": 1346274298000
            },
            "content": "It's hard - truthfully the main thing other than work is just making sure that I'm spending enough time with michelle and the girls. The big advantage I have...",
            "score": 2951,
            "avatar": null,
            "nickname": "PresidentObama",
            "profileUrl": "https://www.reddit.com/user/PresidentObama/",
            "replys": [],
            "id": "t1_c60nmtc",
            "parentId": "t1_c60mmaf",
            "depth": 1,
            "replyCount": 319,
            "url": "https://www.reddit.com/r/IAmA/comments/z1c9z/comment/c60nmtc/"
          }
        ],
        "id": "t1_c60mmaf",
        "parentId": "t3_z1c9z",
        "depth": 0,
        "replyCount": 328,
        "url": "https://www.reddit.com/r/IAmA/comments/z1c9z/comment/c60mmaf/"
      }
    ],
    "pagination": {
      "comments": {
        "cursor": null,
        "hasMore": true
      }
    }
  },
  "meta": {
    "requestId": "pg-audit-r1-reddit-comments-1793954295660519500",
    "durationMs": 4059
  },
  "billing": {
    "unitPrice": 0.8,
    "ruleVersion": "social-primary-v2",
    "billedCount": 4,
    "pointCost": 3.2
  }
}

Points Usage

0.8 points per root comment; included replies are free. Supported explicit reply modes charge 0.8 points per direct reply; nested replies included with those results are free.

Empty results and failed requests are not charged. Duplicate IDs are counted once within a response. Separate calls and pages are billed separately. See Social Media Reviews API billing.

Try it