> ## 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 Reddit Post Details in Batch (Max 5)

> Batch get post details by a list of post IDs, supports up to 5 posts per batch, optionally including the context of a specific comment

Note:
Supports a maximum of 5 posts per batch
More than 5 will return an error
The ID format for the APP API differs from the Web API — a type prefix is required
Post ID prefix: t3_ (e.g., t3_1ojnh50)
Comment ID prefix: t1_ (e.g., t1_abcd123)

<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_post_details_batch.

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_post_details_batch

Description: Batch get post details by a list of post IDs, supports up to 5 posts per batch, optionally including the context of a specific comment

Note:
Supports a maximum of 5 posts per batch
More than 5 will return an error
The ID format for the APP API differs from the Web API — a type prefix is required
Post ID prefix: t3_ (e.g., t3_1ojnh50)
Comment ID prefix: t1_ (e.g., t1_abcd123)

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

Parameters:
- post_ids (Required): Comma-separated list of post IDs, format: "t3_XXXXXX,t3_YYYYYY", up to 5 posts. Example: t3_1ojnh50,t3_1ok432f,t3_1nwil8j
- include_comment_id (Optional): Whether to include a specific comment ID, default is False. Example: false
- comment_id (Optional): Comment ID (used when include_comment_id is True), format: "t1_XXXXXX"
- need_format (Optional): Whether to clean/sanitize the data. Example: false

Example Response:
{
"code": 0,
"message": "success",
"data": {
"postsInfoByIds": [
  {
    "__typename": "SubredditPost",
    "authorCommunityBadge": null,
    "subreddit": {
      "__typename": "Subreddit",
      "id": "t5_mvcq5",
      "name": "TikTokCringe",
      "prefixedName": "r/TikTokCringe",
      "isQuarantined": false,
      "title": "The Best and Worst of TikTok",
      "type": "PUBLIC",
      "subscribersCount": 5365599,
      "isNsfw": false,
      "isSubscribed": false,
      "isThumbnailsEnabled": true,
      "styles": {
        "icon": "https://styles.redditmedia.com/t5_mvcq5/styles/communityIcon_twjztnhoy2691.jpg?width=64&height=64&frame=1&auto=webp&crop=64:64,smart&s=4372e5388bf0e14e147686cbdb3edf26a872b4de",
        "legacyIcon": null,
        "primaryColor": "#B33BD8",
        "backgroundColor": "#000000",
        "bannerBackgroundImage": "https://styles.redditmedia.com/t5_mvcq5/styles/bannerBackgroundImage_gjg9dsefkz591.jpg?format=pjpg&s=ab45f817c3c7613d0b223efab13391e15ea0b402",
        "legacyPrimaryColor": "#7E53C1"
      },
      "modPermissions": null,
      "communityStatus": null,
      "isTitleSafe": true,
      "isUserBanned": false,
      "tippingStatus": null,
      "whitelistStatus": "SOME_ADS"
    },
    "crosspostRoot": null,
    "id": "t3_1ojnh50",
    "createdAt": "2025-10-30T01:58:59.142000+0000",
    "editedAt"
... (truncated)`)}
    >
      <span>✨</span>
      <span>Copy for AI</span>
    </button>
  </div>
</div>


## OpenAPI

````yaml en/reddit.openapi.json GET /v1/reddit/fetch_post_details_batch
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_post_details_batch:
    get:
      tags: []
      summary: Fetch Reddit Post Details in Batch (Max 5)
      description: >-
        Batch get post details by a list of post IDs, supports up to 5 posts per
        batch, optionally including the context of a specific comment


        Note:

        Supports a maximum of 5 posts per batch

        More than 5 will return an error

        The ID format for the APP API differs from the Web API — a type prefix
        is required

        Post ID prefix: t3_ (e.g., t3_1ojnh50)

        Comment ID prefix: t1_ (e.g., t1_abcd123)
      parameters:
        - name: post_ids
          in: query
          description: >-
            Comma-separated list of post IDs, format: "t3_XXXXXX,t3_YYYYYY", up
            to 5 posts
          required: true
          example: t3_1ojnh50,t3_1ok432f,t3_1nwil8j
          schema:
            type: string
        - name: include_comment_id
          in: query
          description: Whether to include a specific comment ID, default is False
          required: false
          example: 'false'
          schema:
            type: boolean
            default: false
        - name: comment_id
          in: query
          description: >-
            Comment ID (used when include_comment_id is True), format:
            "t1_XXXXXX"
          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:
                  postsInfoByIds:
                    - __typename: SubredditPost
                      authorCommunityBadge: null
                      subreddit:
                        __typename: Subreddit
                        id: t5_mvcq5
                        name: TikTokCringe
                        prefixedName: r/TikTokCringe
                        isQuarantined: false
                        title: The Best and Worst of TikTok
                        type: PUBLIC
                        subscribersCount: 5365599
                        isNsfw: false
                        isSubscribed: false
                        isThumbnailsEnabled: true
                        styles:
                          icon: >-
                            https://styles.redditmedia.com/t5_mvcq5/styles/communityIcon_twjztnhoy2691.jpg?width=64&height=64&frame=1&auto=webp&crop=64:64,smart&s=4372e5388bf0e14e147686cbdb3edf26a872b4de
                          legacyIcon: null
                          primaryColor: '#B33BD8'
                          backgroundColor: '#000000'
                          bannerBackgroundImage: >-
                            https://styles.redditmedia.com/t5_mvcq5/styles/bannerBackgroundImage_gjg9dsefkz591.jpg?format=pjpg&s=ab45f817c3c7613d0b223efab13391e15ea0b402
                          legacyPrimaryColor: '#7E53C1'
                        modPermissions: null
                        communityStatus: null
                        isTitleSafe: true
                        isUserBanned: false
                        tippingStatus: null
                        whitelistStatus: SOME_ADS
                      crosspostRoot: null
                      id: t3_1ojnh50
                      createdAt: 2025-10-30T01:58:59.142000+0000
                      editedAt: null
                      postTitle: '[ 已被版主删除 ]'
                      url: >-
                        https://www.reddit.com/r/TikTokCringe/comments/1ojnh50/%E5%B7%B2%E8%A2%AB%E7%89%88%E4%B8%BB%E5%88%A0%E9%99%A4/
                      content: null
                      domain: v.redd.it
                      isSpoiler: false
                      isNsfw: false
                      isCommercialCommunication: false
                      isLocked: true
                      isSaved: false
                      isReactAllowed: false
                      isHidden: false
                      isGildable: false
                      isCrosspostable: false
                      isScoreHidden: false
                      isArchived: false
                      isStickied: false
                      isPollIncluded: false
                      poll: null
                      isFollowed: false
                      awardingsInfo: null
                      awardings:
                        - __typename: AwardingTotal
                          award:
                            __typename: Award
                            id: award_wholesome_seal
                            name: 正能量
                            tags:
                              - award:legacy
                              - award:group:legacytop
                            static_icon_16:
                              __typename: MediaSource
                              url: >-
                                https://www.redditstatic.com/marketplace-assets/v1/core/awards/wholsome_v1_16.png
                              dimensions:
                                width: 16
                                height: 16
                            static_icon_24:
                              __typename: MediaSource
                              url: >-
                                https://www.redditstatic.com/marketplace-assets/v1/core/awards/wholsome_v1_24.png
                              dimensions:
                                width: 24
                                height: 24
                            static_icon_32:
                              __typename: MediaSource
                              url: >-
                                https://www.redditstatic.com/marketplace-assets/v1/core/awards/wholsome_v1_32.png
                              dimensions:
                                width: 32
                                height: 32
                            static_icon_48:
                              __typename: MediaSource
                              url: >-
                                https://www.redditstatic.com/marketplace-assets/v1/core/awards/wholsome_v1_48.png
                              dimensions:
                                width: 48
                                height: 48
                            static_icon_64:
                              __typename: MediaSource
                              url: >-
                                https://www.redditstatic.com/marketplace-assets/v1/core/awards/wholsome_v1_64.png
                              dimensions:
                                width: 64
                                height: 64
                          total: 1
                      isContestMode: false
                      distinguishedAs: null
                      voteState: NONE
                      score: 33358
                      commentCount: 11462
                      viewCount: null
                      authorFlair: null
                      flair:
                        __typename: PostFlair
                        type: text
                        text: Cringe
                        richtext: null
                        textColor: LIGHT
                        template:
                          id: d74470ce-5c6c-11e9-9455-0e158690b334
                          isEditable: false
                          backgroundColor: '#EA0027'
                      authorInfo:
                        __typename: Redditor
                        id: t2_n5zmzf3v0
                        name: ambachk
                        isBlocked: false
                        isCakeDayNow: false
                        newIcon:
                          __typename: MediaSource
                          url: >-
                            https://styles.redditmedia.com/t5_9uhspc/styles/profileIcon_snoo-nftv2_bmZ0X2VpcDE1NToxMzdfZWI5NTlhNzE1ZGZmZmU2ZjgyZjQ2MDU1MzM5ODJjNDg1OWNiMTRmZV8xNTcxMjU1MA_rare_7f655c9b-871f-4906-97c6-431b2d32153b-headshot.png?s=f96f520312f1ccc9ac807f95086bd0104e994b4a
                          dimensions:
                            width: 256
                            height: 256
                        iconSmall:
                          __typename: MediaSource
                          url: >-
                            https://styles.redditmedia.com/t5_9uhspc/styles/profileIcon_snoo-nftv2_bmZ0X2VpcDE1NToxMzdfZWI5NTlhNzE1ZGZmZmU2ZjgyZjQ2MDU1MzM5ODJjNDg1OWNiMTRmZV8xNTcxMjU1MA_rare_7f655c9b-871f-4906-97c6-431b2d32153b-headshot.png?width=50&height=50&frame=1&auto=webp&crop=50%3A50%2Csmart&s=1db50c27a77053b8cc9d3ddf09109ebc22224142
                          dimensions:
                            width: 50
                            height: 50
                        snoovatarIcon:
                          __typename: MediaSource
                          url: >-
                            https://i.redd.it/snoovatar/avatars/nftv2_bmZ0X2VpcDE1NToxMzdfZWI5NTlhNzE1ZGZmZmU2ZjgyZjQ2MDU1MzM5ODJjNDg1OWNiMTRmZV8xNTcxMjU1MA_rare_7f655c9b-871f-4906-97c6-431b2d32153b.png
                          dimensions:
                            width: 380
                            height: 600
                        profile:
                          isNsfw: false
                        accountType: USER
                      isThumbnailEnabled: true
                      thumbnail: null
                      media: null
                      moderationInfo: null
                      suggestedCommentSort: null
                      permalink: /r/TikTokCringe/comments/1ojnh50/已被版主删除/
                      isSelfPost: false
                      postHint: null
                      postEventInfo: null
                      gallery: null
                      devvit: null
                      outboundLink:
                        url: >-
                          https://www.reddit.com/r/TikTokCringe/comments/1ojnh50/%E5%B7%B2%E8%A2%AB%E7%89%88%E4%B8%BB%E5%88%A0%E9%99%A4/
                        expiresAt: 2026-03-05T14:09:47.754051+0000
                      postStats:
                        viewCountTotal: null
                        shareAllTotal: 12621
                      postStatsPrivate:
                        viewCountTotals: null
                      isAuthorBlocked: false
                      upvoteRatio: 0.8373503764285327
                      reactedFrom: null
                      attributionInfo: null
                      crowdControlLevel: 'OFF'
                      isCrowdControlFilterEnabled: false
                      languageCode: en
                      isTranslatable: false
                      isTranslated: false
                      translatedLanguage: null
                      removedByCategory: MODERATOR
                      modContentDiscussion: null
                      predictedRemovalSavedResponses: []
                    - __typename: DeletedSubredditPost
                    - __typename: DeletedSubredditPost
                requestId: ecbffbf9-2d00-4798-b112-38ac275ab3eb
          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_post_details_batch?post_ids=t3_1ojnh50%2Ct3_1ok432f%2Ct3_1nwil8j&include_comment_id=false&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_post_details_batch',
                params={"post_ids": "t3_1ojnh50,t3_1ok432f,t3_1nwil8j", "include_comment_id": "false", "need_format": "false"},
                headers={'Authorization': 'Bearer <YOUR_API_KEY>'}
            )
            print(response.json())
        - lang: javascript
          label: JavaScript
          source: >-
            const params = new URLSearchParams({"post_ids":
            "t3_1ojnh50,t3_1ok432f,t3_1nwil8j", "include_comment_id": "false",
            "need_format": "false"});


            const response = await
            fetch(`https://api.keyapi.ai/v1/reddit/fetch_post_details_batch?${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).

````