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

# Fetch User Comments

> Get the list of comments posted by a specified user

<div className="inline-flex items-center gap-2 px-4 py-2 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg">
  <span className="text-base">🪙</span>
  <span className="text-sm font-medium text-yellow-900 dark:text-yellow-100"><span className="font-semibold">1 credit</span><span className="text-yellow-700 dark:text-yellow-300 ml-1">per request</span></span>
</div>

## Copy for AI

<div className="my-6 rounded-xl border border-gray-200 bg-gray-50 p-5 dark:border-gray-800 dark:bg-gray-900/40">
  <div className="min-w-0">
    <p className="text-base font-semibold text-gray-900 dark:text-gray-100">🤖 Why Code When AI Can Do It For You?</p>
    <p className="mt-1 text-sm text-gray-700 dark:text-gray-300">Stop writing code like it's 1970! Let AI do the heavy lifting - click the sparkles to copy a perfectly formatted prompt for ChatGPT, Claude, or your favorite AI assistant.</p>
  </div>

  <div className="mt-4">
    <button
      type="button"
      className="inline-flex items-center gap-2 rounded-md border border-emerald-300 bg-emerald-50 px-3 py-2 text-sm font-medium text-emerald-800 hover:bg-emerald-100 dark:border-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-100 dark:hover:bg-emerald-900/50"
      onClick={() => navigator.clipboard.writeText(`I want to make an API call to https://api.keyapi.ai/v1/reddit/fetch_user_comments.

Please help me write code to make this API call and handle the response appropriately. Include error handling and best practices.

Here are the details:

Endpoint: GET https://api.keyapi.ai/v1/reddit/fetch_user_comments

Description: Get the list of comments posted by a specified user

Required Headers:
--header 'Authorization: Bearer <YOUR_API_KEY>'

Parameters:
- username (Required): Reddit username. Example: spez
- sort (Optional): Sort order, default is NEW
Options: NEW, TOP, HOT, CONTROVERSIAL. Example: NEW
- page_size (Optional): Number of comments returned per page, default is 25. Example: 25
- after (Optional): Pagination parameter
- need_format (Optional): Whether to clean/sanitize the data. Example: false

Example Response:
{
"code": 0,
"message": "success",
"data": {
"redditorInfoByName": {
  "__typename": "Redditor",
  "comments": {
    "pageInfo": {
      "__typename": "PageInfo",
      "hasNextPage": true,
      "endCursor": "dDFfbnM0eTU3dQ=="
    },
    "edges": [
      {
        "node": {
          "__typename": "Comment",
          "id": "t1_o8gk2ud",
          "createdAt": "2026-03-03T19:04:32.808000+0000",
          "content": {
            "preview": "Hey can you add an option for 5M+ shares?",
            "html": null
          },
          "authorInfo": {
            "displayName": "spez"
          },
          "postInfo": {
            "__typename": "SubredditPost",
            "id": "t3_1ritqvd",
            "title": "RDDT shareholders: what’s your approximate position size? (Quick anonymous poll)",
            "subreddit": {
              "prefixedName": "r/redditstock"
            }
          },
          "score": 27,
          "commentStats": null
        }
      },
      {
        "node": {
          "__typename": "Comment",
          "id": "t1_o40tlwf",
          "createdAt": "2026-02-07T03:35:23.116000+0000",
          "content": {
            "preview": "There was a comment yesterday that I almost replied to with “do you want me to shitpost more or focus on our work?” I didn’t sent it bc I felt like it would be 
... (truncated)`)}
    >
      <span>✨</span>
      <span>Copy for AI</span>
    </button>
  </div>
</div>


## OpenAPI

````yaml en/reddit.openapi.json GET /v1/reddit/fetch_user_comments
openapi: 3.0.1
info:
  title: Reddit API english documentation
  description: >-
    The english reference documentation of the Reddit API includes the
    interface's purpose, parameter description, response status, and sample
    structure.
  version: 1.0.0
servers:
  - url: https://api.keyapi.ai
    description: Production
security:
  - JWT Bearer: []
tags: []
paths:
  /v1/reddit/fetch_user_comments:
    get:
      tags: []
      summary: Fetch User Comments
      description: Get the list of comments posted by a specified user
      parameters:
        - name: username
          in: query
          description: Reddit username
          required: true
          example: spez
          schema:
            type: string
        - name: sort
          in: query
          description: |-
            Sort order, default is NEW
            Options: NEW, TOP, HOT, CONTROVERSIAL
          required: false
          example: NEW
          schema:
            type: string
            default: NEW
        - name: page_size
          in: query
          description: Number of comments returned per page, default is 25
          required: false
          example: 25
          schema:
            type: integer
            default: 25
        - name: after
          in: query
          description: Pagination parameter
          required: false
          schema:
            type: string
        - name: need_format
          in: query
          description: Whether to clean/sanitize the data
          required: false
          example: 'false'
          schema:
            type: boolean
            default: false
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties: {}
              example:
                code: 0
                message: success
                data:
                  redditorInfoByName:
                    __typename: Redditor
                    comments:
                      pageInfo:
                        __typename: PageInfo
                        hasNextPage: true
                        endCursor: dDFfbnM0eTU3dQ==
                      edges:
                        - node:
                            __typename: Comment
                            id: t1_o8gk2ud
                            createdAt: 2026-03-03T19:04:32.808000+0000
                            content:
                              preview: Hey can you add an option for 5M+ shares?
                              html: null
                            authorInfo:
                              displayName: spez
                            postInfo:
                              __typename: SubredditPost
                              id: t3_1ritqvd
                              title: >-
                                RDDT shareholders: what’s your approximate
                                position size? (Quick anonymous poll)
                              subreddit:
                                prefixedName: r/redditstock
                            score: 27
                            commentStats: null
                        - node:
                            __typename: Comment
                            id: t1_o40tlwf
                            createdAt: 2026-02-07T03:35:23.116000+0000
                            content:
                              preview: >-
                                There was a comment yesterday that I almost
                                replied to with “do you want me to shitpost more
                                or focus on our work?” I didn’t sent it bc I
                                felt like it would be blowing off the feedback.
                                I love shitposting, and we try to make the most
                                of our earnings and follow-ups. There’s a lot of
                                room in the middl
                              html: null
                            authorInfo:
                              displayName: spez
                            postInfo:
                              __typename: SubredditPost
                              id: t3_1qxtyos
                              title: >-
                                Really unbelievable what spez and team must be
                                feeling rn 😭
                              subreddit:
                                prefixedName: r/redditstock
                            score: 179
                            commentStats: null
                        - node:
                            __typename: Comment
                            id: t1_o3t7qd9
                            createdAt: 2026-02-05T23:50:18.133000+0000
                            content:
                              preview: Thanks, Mom.
                              html: null
                            authorInfo:
                              displayName: spez
                            postInfo:
                              __typename: SubredditPost
                              id: t3_1qwxst2
                              title: >-
                                TL;DR: Solid end to a strong year for Reddit.
                                Ask your questions for me, Jen, and Drew in
                                r/RDDT.
                              subreddit:
                                prefixedName: r/redditstock
                            score: 74
                            commentStats: null
                        - node:
                            __typename: Comment
                            id: t1_o3t7k89
                            createdAt: 2026-02-05T23:49:21.492000+0000
                            content:
                              preview: Yep
                              html: null
                            authorInfo:
                              displayName: spez
                            postInfo:
                              __typename: SubredditPost
                              id: t3_1qwxst2
                              title: >-
                                TL;DR: Solid end to a strong year for Reddit.
                                Ask your questions for me, Jen, and Drew in
                                r/RDDT.
                              subreddit:
                                prefixedName: r/redditstock
                            score: 26
                            commentStats: null
                        - node:
                            __typename: Comment
                            id: t1_o3t774z
                            createdAt: 2026-02-05T23:47:17.780000+0000
                            content:
                              preview: >-
                                Love that! Programming was my first love. Still
                                write code every day. All the best.
                              html: null
                            authorInfo:
                              displayName: spez
                            postInfo:
                              __typename: SubredditPost
                              id: t3_1qwxst2
                              title: >-
                                TL;DR: Solid end to a strong year for Reddit.
                                Ask your questions for me, Jen, and Drew in
                                r/RDDT.
                              subreddit:
                                prefixedName: r/redditstock
                            score: 32
                            commentStats: null
                        - node:
                            __typename: Comment
                            id: t1_o3t70wv
                            createdAt: 2026-02-05T23:46:19.255000+0000
                            content:
                              preview: >-
                                I especially enjoyed the post bitching about me
                                not hyping the stock enough.
                              html: null
                            authorInfo:
                              displayName: spez
                            postInfo:
                              __typename: SubredditPost
                              id: t3_1qwxst2
                              title: >-
                                TL;DR: Solid end to a strong year for Reddit.
                                Ask your questions for me, Jen, and Drew in
                                r/RDDT.
                              subreddit:
                                prefixedName: r/redditstock
                            score: 110
                            commentStats: null
                        - node:
                            __typename: Comment
                            id: t1_o3t6nst
                            createdAt: 2026-02-05T23:44:15.373000+0000
                            content:
                              preview: 🤗
                              html: null
                            authorInfo:
                              displayName: spez
                            postInfo:
                              __typename: SubredditPost
                              id: t3_1qwxst2
                              title: >-
                                TL;DR: Solid end to a strong year for Reddit.
                                Ask your questions for me, Jen, and Drew in
                                r/RDDT.
                              subreddit:
                                prefixedName: r/redditstock
                            score: 50
                            commentStats: null
                        - node:
                            __typename: Comment
                            id: t1_o3t6gff
                            createdAt: 2026-02-05T23:43:05.443000+0000
                            content:
                              preview: >-
                                Our focus markets outside of the US have been
                                India, Australia, Brazil, Germany, and France.
                                What we learned is that the key to growth is
                                getting new, local communities off the ground.
                                Communities attract users. It turns out, getting
                                a new community off the ground is hard, both in
                                the US and outside
                              html: null
                            authorInfo:
                              displayName: spez
                            postInfo:
                              __typename: SubredditPost
                              id: t3_1qwxntg
                              title: >-
                                Reddit Announces Q4’25 and Full Year 2025
                                Earnings (plus AMA!)
                              subreddit:
                                prefixedName: r/RDDT
                            score: 18
                            commentStats: null
                        - node:
                            __typename: Comment
                            id: t1_o3t6ebz
                            createdAt: 2026-02-05T23:42:45.006000+0000
                            content:
                              preview: >-
                                The cohort of users that matters the most is
                                those opening the app for the first time. This
                                group is by definition logged out today.
                                Improving retention for this group translates
                                into growth over time. The way we do this is
                                streamlining onboarding, getting to feeds
                                faster, getting to personalization
                              html: null
                            authorInfo:
                              displayName: spez
                            postInfo:
                              __typename: SubredditPost
                              id: t3_1qwxntg
                              title: >-
                                Reddit Announces Q4’25 and Full Year 2025
                                Earnings (plus AMA!)
                              subreddit:
                                prefixedName: r/RDDT
                            score: 14
                            commentStats: null
                        - node:
                            __typename: Comment
                            id: t1_o3t6bxs
                            createdAt: 2026-02-05T23:42:22.892000+0000
                            content:
                              preview: >-
                                Our first and only Super Bowl ad was all of 5
                                seconds long. We’re pretty spendthrift, so I
                                would expect this year’s to be 0 seconds.
                              html: null
                            authorInfo:
                              displayName: spez
                            postInfo:
                              __typename: SubredditPost
                              id: t3_1qwxntg
                              title: >-
                                Reddit Announces Q4’25 and Full Year 2025
                                Earnings (plus AMA!)
                              subreddit:
                                prefixedName: r/RDDT
                            score: 26
                            commentStats: null
                        - node:
                            __typename: Comment
                            id: t1_o3t69i6
                            createdAt: 2026-02-05T23:42:00.590000+0000
                            content:
                              preview: >-
                                Well. Where do you think original content comes
                                from? We need to find a way for creators to get
                                their content on Reddit while staying in harmony
                                with our communities. This is the general idea
                                behind Reddit Pro, a safe space for creators /
                                brands / professionals to submit their content.
                                Then features
                              html: null
                            authorInfo:
                              displayName: spez
                            postInfo:
                              __typename: SubredditPost
                              id: t3_1qwxntg
                              title: >-
                                Reddit Announces Q4’25 and Full Year 2025
                                Earnings (plus AMA!)
                              subreddit:
                                prefixedName: r/RDDT
                            score: 15
                            commentStats: null
                        - node:
                            __typename: Comment
                            id: t1_o3t66uw
                            createdAt: 2026-02-05T23:41:34.885000+0000
                            content:
                              preview: >-
                                Something we’d still love to do, but not a
                                priority right now. All in on new user
                                retention.
                              html: null
                            authorInfo:
                              displayName: spez
                            postInfo:
                              __typename: SubredditPost
                              id: t3_1qwxntg
                              title: >-
                                Reddit Announces Q4’25 and Full Year 2025
                                Earnings (plus AMA!)
                              subreddit:
                                prefixedName: r/RDDT
                            score: 12
                            commentStats: null
                        - node:
                            __typename: Comment
                            id: t1_o3t64ts
                            createdAt: 2026-02-05T23:41:15.542000+0000
                            content:
                              preview: >-
                                Thank you! While there is a lot of low hanging
                                fruit in the onboarding process, I think the
                                biggest gains this year will come from better
                                home feed recommendations and getting new users
                                into those recommendations faster.
                              html: null
                            authorInfo:
                              displayName: spez
                            postInfo:
                              __typename: SubredditPost
                              id: t3_1qwxntg
                              title: >-
                                Reddit Announces Q4’25 and Full Year 2025
                                Earnings (plus AMA!)
                              subreddit:
                                prefixedName: r/RDDT
                            score: 16
                            commentStats: null
                        - node:
                            __typename: Comment
                            id: t1_o3t62bh
                            createdAt: 2026-02-05T23:40:51.792000+0000
                            content:
                              preview: >-
                                Reddit’s purpose is for people to talk to other
                                people. Our biggest value is being the most
                                human place on the internet. Here, mostly
                                anonymous users generate more authentic and thus
                                influential conversations that you can’t find
                                anywhere else. No one is famous in the real
                                world for being good at Red
                              html: null
                            authorInfo:
                              displayName: spez
                            postInfo:
                              __typename: SubredditPost
                              id: t3_1qwxntg
                              title: >-
                                Reddit Announces Q4’25 and Full Year 2025
                                Earnings (plus AMA!)
                              subreddit:
                                prefixedName: r/RDDT
                            score: 46
                            commentStats: null
                        - node:
                            __typename: Comment
                            id: t1_o3t5yi2
                            createdAt: 2026-02-05T23:40:15.681000+0000
                            content:
                              preview: >-
                                Reddit is people. If users can’t tell the
                                difference between a person and a bot, that
                                trust erodes and the quality of conversation
                                with it. We have been fighting the manipulation
                                of Reddit for a long, long time. In Q4, we
                                launched verified profiles, and we’re now moving
                                quickly on bot labeling and v
                              html: null
                            authorInfo:
                              displayName: spez
                            postInfo:
                              __typename: SubredditPost
                              id: t3_1qwxntg
                              title: >-
                                Reddit Announces Q4’25 and Full Year 2025
                                Earnings (plus AMA!)
                              subreddit:
                                prefixedName: r/RDDT
                            score: 29
                            commentStats: null
                        - node:
                            __typename: Comment
                            id: t1_o3t5w5c
                            createdAt: 2026-02-05T23:39:53.605000+0000
                            content:
                              preview: >-
                                Search trends and algorithms will always shift.
                                But people specifically want Reddit, which is
                                why one constant is that they continue to add
                                “Reddit” to their Google queries—more than 250
                                times a second. That tells us they’re not just
                                looking for answers, they’re looking for Reddit
                                answers.
                              html: null
                            authorInfo:
                              displayName: spez
                            postInfo:
                              __typename: SubredditPost
                              id: t3_1qwxntg
                              title: >-
                                Reddit Announces Q4’25 and Full Year 2025
                                Earnings (plus AMA!)
                              subreddit:
                                prefixedName: r/RDDT
                            score: 50
                            commentStats: null
                        - node:
                            __typename: Comment
                            id: t1_nw3gnpv
                            createdAt: 2025-12-26T22:28:40.211000+0000
                            content:
                              preview: >-
                                The company has provided to investors medium and
                                long term dilution targets of 1-3%. We have done
                                better than that goal so far this year. Fully
                                diluted shares are down .1%, with share counts
                                dropping from 206.4 to 206.1.
                              html: null
                            authorInfo:
                              displayName: spez
                            postInfo:
                              __typename: SubredditPost
                              id: t3_1pvo5fx
                              title: >-
                                Happy holidays to the owners of a high quality
                                business
                              subreddit:
                                prefixedName: r/redditstock
                            score: 30
                            commentStats: null
                        - node:
                            __typename: Comment
                            id: t1_ns63w7u
                            createdAt: 2025-12-04T01:13:11.199000+0000
                            content:
                              preview: >-
                                You all are the "judge" in this sentence, "And
                                when I look at the top-visited communities, it’s
                                not surprising to see that they are (mostly)
                                coming here to laugh, ask questions, judge, and
                                generally be entertained." ❤️
                              html: null
                            authorInfo:
                              displayName: spez
                            postInfo:
                              __typename: ProfilePost
                              id: t3_1pdb5dc
                              title: Beyond the Front Page of the Internet
                            score: 13
                            commentStats: null
                        - node:
                            __typename: Comment
                            id: t1_ns63f22
                            createdAt: 2025-12-04T01:10:15.667000+0000
                            content:
                              preview: >-
                                That's more or less what I've said internally.
                                We can get rid of it when it has no users, and
                                the best way for it to have no users is to
                                replicate the UI on new tech.
                              html: null
                            authorInfo:
                              displayName: spez
                            postInfo:
                              __typename: ProfilePost
                              id: t3_1pdb5dc
                              title: Beyond the Front Page of the Internet
                            score: 23
                            commentStats: null
                        - node:
                            __typename: Comment
                            id: t1_ns51gmf
                            createdAt: 2025-12-03T21:41:32.353000+0000
                            content:
                              preview: Thanks, I think?
                              html: null
                            authorInfo:
                              displayName: spez
                            postInfo:
                              __typename: ProfilePost
                              id: t3_1pdb5dc
                              title: Beyond the Front Page of the Internet
                            score: 11
                            commentStats: null
                        - node:
                            __typename: Comment
                            id: t1_ns4zndd
                            createdAt: 2025-12-03T21:32:50.044000+0000
                            content:
                              preview: >-
                                Maybe the perfect chives were the friends we
                                made along the way. But seriously.
                              html: null
                            authorInfo:
                              displayName: spez
                            postInfo:
                              __typename: ProfilePost
                              id: t3_1pdb5dc
                              title: Beyond the Front Page of the Internet
                            score: 11
                            commentStats: null
                        - node:
                            __typename: Comment
                            id: t1_ns4zhcv
                            createdAt: 2025-12-03T21:32:02.966000+0000
                            content:
                              preview: Hell yeah!
                              html: null
                            authorInfo:
                              displayName: spez
                            postInfo:
                              __typename: ProfilePost
                              id: t3_1pdb5dc
                              title: Beyond the Front Page of the Internet
                            score: 25
                            commentStats: null
                        - node:
                            __typename: Comment
                            id: t1_ns4z9z9
                            createdAt: 2025-12-03T21:31:03.321000+0000
                            content:
                              preview: It's time for bed, Grandpa.
                              html: null
                            authorInfo:
                              displayName: spez
                            postInfo:
                              __typename: ProfilePost
                              id: t3_1pdb5dc
                              title: Beyond the Front Page of the Internet
                            score: 55
                            commentStats: null
                        - node:
                            __typename: Comment
                            id: t1_ns4z6s1
                            createdAt: 2025-12-03T21:30:37.686000+0000
                            content:
                              preview: >-
                                That's because you're a product designer who can
                                appreciate how we aimlessly shift around pixels
                                for seemingly no reason 👊
                              html: null
                            authorInfo:
                              displayName: spez
                            postInfo:
                              __typename: ProfilePost
                              id: t3_1pdb5dc
                              title: Beyond the Front Page of the Internet
                            score: 26
                            commentStats: null
                        - node:
                            __typename: Comment
                            id: t1_ns4y57u
                            createdAt: 2025-12-03T21:25:37.509000+0000
                            content:
                              preview: 🤗
                              html: null
                            authorInfo:
                              displayName: spez
                            postInfo:
                              __typename: ProfilePost
                              id: t3_1pdb5dc
                              title: Beyond the Front Page of the Internet
                            score: 8
                            commentStats: null
                requestId: 55fd0417-ad9a-4cc4-ba28-b8fe90df4cf2
          headers: {}
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                example:
                  code: 400
                  data: null
                  message: 'Missing required parameter: handle'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                example:
                  code: 401
                  data: null
                  message: apiKey is null
        '402':
          description: Payment Required
          content:
            application/json:
              schema:
                type: object
                example:
                  code: 402
                  data: null
                  message: apiKey quota is not enough
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                example:
                  code: 429
                  data: null
                  message: qps limit exceeded
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
                example:
                  code: 500
                  data: null
                  message: Internal server error
      deprecated: false
      security:
        - JWT Bearer: []
      x-codeSamples:
        - lang: curl
          label: cURL
          source: |-
            curl --request GET \
              --url 'https://api.keyapi.ai/v1/reddit/fetch_user_comments?username=spez&sort=NEW&page_size=25&need_format=false' \
              --header 'Authorization: Bearer <YOUR_API_KEY>'
        - lang: python
          label: Python
          source: |-
            import requests

            response = requests.get(
                'https://api.keyapi.ai/v1/reddit/fetch_user_comments',
                params={"username": "spez", "sort": "NEW", "page_size": 25, "need_format": "false"},
                headers={'Authorization': 'Bearer <YOUR_API_KEY>'}
            )
            print(response.json())
        - lang: javascript
          label: JavaScript
          source: >-
            const params = new URLSearchParams({"username": "spez", "sort":
            "NEW", "page_size": 25, "need_format": "false"});


            const response = await
            fetch(`https://api.keyapi.ai/v1/reddit/fetch_user_comments?${params}`,
            {
              method: 'GET',
              headers: { 'Authorization': 'Bearer <YOUR_API_KEY>' }
            });

            const data = await response.json();

            console.log(data);
components:
  securitySchemes:
    JWT Bearer:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: |-
        API key for authentication. Format: `sk_live_xxxxxxxxxxxxx`
        Get your API key from the [Dashboard](http://keyapi.ai/app/dashboard).

````