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

# Reddit Post Comments

> Sell reddit.post_comments on AnyAPI: the request your endpoint receives, the response it must return, and what the live trial grades.

List the comments on a Reddit post by URL (author, body, score, timestamp, parent comment). Replies carry the parentId of the comment they answer.

This page is the seller-facing summary of one catalog API, `reddit.post_comments`. The transport rules that apply to every API a seller serves - signed requests, the response envelope, timeouts, and body limits - are on [the operator endpoint contract](https://getanyapi.com/docs/sell/operator-endpoint-contract.md).

## The price you compete with

AnyAPI publishes this API from **\$1.20 per 1,000 requests**. That is the price a buyer sees today, so it is the price your endpoint has to come in under to win traffic.

## The request your endpoint receives

| Field | Type | Required | What it means |
| - | - | - | - |
| `cursor` | string | no | Cursor from a previous response for more comments. |
| `url` | string | yes | Full Reddit post URL on reddit.com. A gallery link ([https://www.reddit.com/gallery/\&lt;id](https://www.reddit.com/gallery/\&lt;id)>) is read as the post it belongs to. |

> **Full input JSON Schema**
>
> ```json theme={"dark"}
> {
>   "$schema": "https://json-schema.org/draft/2020-12/schema",
>   "$id": "https://getanyapi.com/schemas/reddit.post_comments.input.json",
>   "example": {
>     "url": "https://www.reddit.com/r/IAmA/comments/z1c9z/i_am_barack_obama_president_of_the_united_states/"
>   },
>   "title": "Reddit post comments input",
>   "type": "object",
>   "additionalProperties": false,
>   "required": [
>     "url"
>   ],
>   "x-anyapi-input-normalizers": {
>     "url": "reddit_gallery_to_post"
>   },
>   "properties": {
>     "url": {
>       "type": "string",
>       "pattern": "^(?:https?://)?(?:[A-Za-z0-9-]+\\.)*(?:reddit\\.com|redd\\.it)(?:[/?#]|$)",
>       "description": "Full Reddit post URL on reddit.com. A gallery link (https://www.reddit.com/gallery/<id>) is read as the post it belongs to."
>     },
>     "cursor": {
>       "type": "string",
>       "description": "Cursor from a previous response for more comments."
>     }
>   }
> }
> ```

## The response your endpoint must return

| Field | Type | Always present | What it means |
| - | - | - | - |
| `data` | null or object | yes | |
| `data.comments` | array | yes | |
| `data.comments[].author` | string | yes | Commenter username, without the u/ prefix. |
| `data.comments[].body` | string | yes | Comment text, as Markdown. |
| `data.comments[].createdUtc` | number | yes | UTC epoch timestamp in seconds (Unix time). Multiply by 1000 for a JS Date in milliseconds. |
| `data.comments[].id` | string | yes | Reddit comment ID (base-36, without the t1\_ prefix). |
| `data.comments[].parentId` | string | no | ID of the comment this one replies to (base-36, without the t1\_ prefix). Empty for a top-level comment that replies to the post itself. |
| `data.comments[].score` | integer | no | Net score (upvotes minus downvotes) on the comment at fetch time. |
| `data.comments[].url` | string | yes | Permalink to the comment on reddit.com. |
| `data.media` | array or null | no | Photo, video, and GIF attachments on the post. Empty when the post has none; null when the serving source does not report attachments. |
| `data.media[].height` | integer | no | |
| `data.media[].type` | string | yes | One of photo, video, or gif. |
| `data.media[].url` | string | yes | Image URL. For a video or GIF this is the poster/thumbnail frame. |
| `data.media[].videoUrl` | string | no | Playable video file URL. Present only for video and gif items. |
| `data.media[].width` | integer | no | |
| `data.nextCursor` | string or null | yes | Opaque cursor for the next page of comments, or null when this lane has no more. Pass it back as cursor to continue. |
| `found` | boolean | yes | |

Extra fields are kept, missing declared fields fail.

> **Full output JSON Schema**
>
> ```json theme={"dark"}
> {
>   "$schema": "https://json-schema.org/draft/2020-12/schema",
>   "$id": "https://getanyapi.com/schemas/reddit.post_comments.output.json",
>   "title": "Reddit post comments output",
>   "x-anyapi-result-list": "comments",
>   "type": "object",
>   "additionalProperties": false,
>   "required": [
>     "found",
>     "data"
>   ],
>   "properties": {
>     "found": {
>       "type": "boolean"
>     },
>     "data": {
>       "oneOf": [
>         {
>           "type": "null"
>         },
>         {
>           "type": "object",
>           "additionalProperties": false,
>           "required": [
>             "comments",
>             "nextCursor"
>           ],
>           "properties": {
>             "nextCursor": {
>               "type": [
>                 "string",
>                 "null"
>               ],
>               "description": "Opaque cursor for the next page of comments, or null when this lane has no more. Pass it back as cursor to continue."
>             },
>             "media": {
>               "type": [
>                 "array",
>                 "null"
>               ],
>               "description": "Photo, video, and GIF attachments on the post. Empty when the post has none; null when the serving source does not report attachments.",
>               "items": {
>                 "type": "object",
>                 "required": [
>                   "type",
>                   "url"
>                 ],
>                 "properties": {
>                   "type": {
>                     "type": "string",
>                     "description": "One of photo, video, or gif."
>                   },
>                   "url": {
>                     "type": "string",
>                     "format": "uri",
>                     "description": "Image URL. For a video or GIF this is the poster/thumbnail frame."
>                   },
>                   "videoUrl": {
>                     "type": "string",
>                     "format": "uri",
>                     "description": "Playable video file URL. Present only for video and gif items."
>                   },
>                   "width": {
>                     "type": "integer"
>                   },
>                   "height": {
>                     "type": "integer"
>                   }
>                 }
>               }
>             },
>             "comments": {
>               "x-anyapi-must-populate": true,
>               "type": "array",
>               "items": {
>                 "type": "object",
>                 "required": [
>                   "id",
>                   "author",
>                   "body",
>                   "url",
>                   "createdUtc"
>                 ],
>                 "properties": {
>                   "id": {
>                     "x-anyapi-must-populate": true,
>                     "type": "string",
>                     "description": "Reddit comment ID (base-36, without the t1_ prefix)."
>                   },
>                   "parentId": {
>                     "type": "string",
>                     "description": "ID of the comment this one replies to (base-36, without the t1_ prefix). Empty for a top-level comment that replies to the post itself."
>                   },
>                   "author": {
>                     "x-anyapi-must-populate": true,
>                     "type": "string",
>                     "description": "Commenter username, without the u/ prefix."
>                   },
>                   "body": {
>                     "x-anyapi-must-populate": true,
>                     "type": "string",
>                     "description": "Comment text, as Markdown."
>                   },
>                   "score": {
>                     "type": "integer",
>                     "description": "Net score (upvotes minus downvotes) on the comment at fetch time."
>                   },
>                   "url": {
>                     "x-anyapi-must-populate": true,
>                     "type": "string",
>                     "description": "Permalink to the comment on reddit.com."
>                   },
>                   "createdUtc": {
>                     "type": "number",
>                     "description": "UTC epoch timestamp in seconds (Unix time). Multiply by 1000 for a JS Date in milliseconds."
>                   }
>                 }
>               }
>             }
>           }
>         }
>       ]
>     }
>   }
> }
> ```

## Fields that must never come back empty

* `author`
* `body`
* `comments`
* `id`
* `url`

The repository marks these fields as ones every source must be able to fill. An empty value is only correct when the entity itself genuinely has nothing there.

## Not found, and how it differs from empty

When the entity does not exist, answer 2xx with the not-found shape:

```json theme={"dark"}
{
  "found": false,
  "data": null
}
```

An empty list is not a not-found: when the entity exists and has nothing to return, answer 2xx with `found: true` and an empty `comments` array.

This output schema declares no `reason` field, so `found: false` is the whole not-found answer.

## Example request

```json theme={"dark"}
{
  "url": "https://www.reddit.com/r/IAmA/comments/z1c9z/i_am_barack_obama_president_of_the_united_states/"
}
```

The compatibility checks fire the schema's example at your endpoint. After that, your answers are graded against what the currently serving source returned for the same real customer inputs.

## Next

* [The operator endpoint contract](https://getanyapi.com/docs/sell/operator-endpoint-contract.md) for signing, budgets, and the live trial.
* [Every API open to sellers](https://getanyapi.com/docs/sell/apis/index.md).
* Want to sell an API that is not on that list? Email [support@getanyapi.com](mailto:support@getanyapi.com).


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