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

# Search subreddit posts

> Searches public Reddit posts within a subreddit. Supports relevance, hot, top, new, and comments sorting with optional time windows.



## OpenAPI

````yaml /openapi.json get /v1/reddit/subreddits/{subreddit}/search
openapi: 3.1.0
info:
  title: KonbiniAPI
  version: 1.0.0
  description: >-
    Social media API that normalizes Instagram, TikTok, X, and Reddit data into
    a consistent ActivityStreams 2.0 format.


    Every authenticated response includes `X-Credits-Remaining` and
    `X-Credits-Used` headers. Each successful request costs 1 credit. Requests
    that fail with 400, 5xx, or upstream errors are refunded (X-Credits-Used:
    0).
  contact:
    name: KonbiniAPI
    email: hello@konbiniapi.com
    url: https://konbiniapi.com
servers:
  - url: https://api.konbiniapi.com
    description: Production
security:
  - apiKey: []
tags:
  - name: Instagram
    description: Instagram data endpoints
  - name: TikTok
    description: TikTok data endpoints
  - name: X
    description: X data endpoints
  - name: Reddit
    description: Reddit data endpoints
paths:
  /v1/reddit/subreddits/{subreddit}/search:
    get:
      tags:
        - Reddit
      summary: Search subreddit posts
      description: >-
        Searches public Reddit posts within a subreddit. Supports relevance,
        hot, top, new, and comments sorting with optional time windows.
      operationId: redditSearchSubredditPosts
      parameters:
        - schema:
            type: string
            description: Subreddit name (with or without `r/` prefix)
            example: programming
          required: true
          description: Subreddit name (with or without `r/` prefix)
          name: subreddit
          in: path
        - schema:
            type: string
            minLength: 1
            description: Search query
            example: askreddit
          required: true
          description: Search query
          name: q
          in: query
        - schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 25
            description: 'Number of posts to fetch (maximum: 100)'
            example: 25
          required: false
          description: 'Number of posts to fetch (maximum: 100)'
          name: count
          in: query
        - schema:
            type: string
            description: Pagination cursor
            example: '0'
          required: false
          description: Pagination cursor
          name: cursor
          in: query
        - schema:
            type: string
            enum:
              - relevance
              - hot
              - top
              - new
              - comments
            default: relevance
            description: 'Sort order: relevance (default), hot, top, new, or comments'
            example: relevance
          required: false
          description: 'Sort order: relevance (default), hot, top, new, or comments'
          name: order
          in: query
        - schema:
            type: string
            enum:
              - hour
              - day
              - week
              - month
              - year
              - all
            description: >-
              Optional time window for search results: hour, day, week, month,
              year, or all
            example: week
          required: false
          description: >-
            Optional time window for search results: hour, day, week, month,
            year, or all
          name: time
          in: query
      responses:
        '200':
          description: Returns subreddit search results
          headers:
            X-Credits-Remaining:
              schema:
                type: integer
              description: Credits remaining after this request
            X-Credits-Used:
              schema:
                type: integer
              description: Credits consumed (1 if charged, 0 if refunded on error)
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      '@context':
                        type: array
                        prefixItems:
                          - type: string
                            enum:
                              - https://www.w3.org/ns/activitystreams#
                          - type: string
                            enum:
                              - https://konbiniapi.com/ns/social#
                        description: ActivityStreams JSON-LD context
                        example:
                          - https://www.w3.org/ns/activitystreams#
                          - https://konbiniapi.com/ns/social#
                      type:
                        type: string
                        description: ActivityStreams collection type
                        example: OrderedCollectionPage
                      partOf:
                        type: string
                        format: uri
                        description: URL of the full collection
                        example: >-
                          https://api.konbiniapi.com/v1/reddit/subreddits/programming/search?q=openai
                      totalItems:
                        type:
                          - integer
                          - 'null'
                        description: Total number of items, null if unknown
                        example: 1309
                      cursor:
                        type:
                          - string
                          - 'null'
                        description: Current page cursor, null on first page
                        example: '0'
                      nextCursor:
                        type:
                          - string
                          - 'null'
                        description: Cursor for the next page, null on last page
                        example: '1772217402000'
                      next:
                        type:
                          - string
                          - 'null'
                        format: uri
                        description: URL for the next page, null on last page
                        example: >-
                          https://api.konbiniapi.com/v1/reddit/subreddits/programming/search?q=openai&cursor=t3_post_2&count=25&order=top&time=week
                      itemCount:
                        type: integer
                        description: Number of items returned in this page
                        example: 30
                      orderedItems:
                        type: array
                        items:
                          $ref: '#/components/schemas/RedditPost'
                        description: Items in this page
                    required:
                      - '@context'
                      - type
                      - partOf
                      - totalItems
                      - cursor
                      - nextCursor
                      - next
                      - itemCount
                      - orderedItems
                required:
                  - data
        '400':
          description: Bad Request — Invalid parameters
          headers:
            X-Credits-Remaining:
              schema:
                type: integer
              description: Credits remaining after this request
            X-Credits-Used:
              schema:
                type: integer
              description: Credits consumed (1 if charged, 0 if refunded on error)
          content:
            application/json:
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        code:
                          type: string
                          enum:
                            - validation_error
                          description: Machine-readable error code
                        message:
                          type: string
                          example: Validation error
                          description: Human-readable error message
                      required:
                        - code
                        - message
                    description: List of errors
                  data:
                    type: 'null'
                    description: Always null for error responses
                required:
                  - errors
                  - data
        '401':
          description: Unauthorized — Missing or invalid API key
          content:
            application/json:
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        code:
                          type: string
                          enum:
                            - missing_api_key
                            - invalid_api_key
                          description: Machine-readable error code
                        message:
                          type: string
                          example: Invalid API key
                          description: Human-readable error message
                      required:
                        - code
                        - message
                    description: List of errors
                  data:
                    type: 'null'
                    description: Always null for error responses
                required:
                  - errors
                  - data
        '402':
          description: Payment Required — Credits exhausted
          content:
            application/json:
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        code:
                          type: string
                          enum:
                            - credits_exhausted
                          description: Machine-readable error code
                        message:
                          type: string
                          example: >-
                            Credits exhausted. Upgrade your plan at
                            konbiniapi.com
                          description: Human-readable error message
                      required:
                        - code
                        - message
                    description: List of errors
                  data:
                    type: 'null'
                    description: Always null for error responses
                required:
                  - errors
                  - data
        '403':
          description: Forbidden — API key disabled or expired
          content:
            application/json:
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        code:
                          type: string
                          enum:
                            - api_key_disabled
                            - api_key_expired
                          description: Machine-readable error code
                        message:
                          type: string
                          example: API key is disabled
                          description: Human-readable error message
                      required:
                        - code
                        - message
                    description: List of errors
                  data:
                    type: 'null'
                    description: Always null for error responses
                required:
                  - errors
                  - data
        '404':
          description: Not Found
          headers:
            X-Credits-Remaining:
              schema:
                type: integer
              description: Credits remaining after this request
            X-Credits-Used:
              schema:
                type: integer
              description: Credits consumed (1 if charged, 0 if refunded on error)
          content:
            application/json:
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        code:
                          type: string
                          enum:
                            - not_found
                            - route_not_found
                            - not_publicly_available
                          description: Machine-readable error code
                        message:
                          type: string
                          example: Not found
                          description: Human-readable error message
                      required:
                        - code
                        - message
                    description: List of errors
                  data:
                    type: 'null'
                    description: Always null for error responses
                required:
                  - errors
                  - data
        '413':
          description: Content Too Large — Request body exceeds 1 MB
          content:
            application/json:
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        code:
                          type: string
                          enum:
                            - validation_error
                          description: Machine-readable error code
                        message:
                          type: string
                          example: Request body too large
                          description: Human-readable error message
                      required:
                        - code
                        - message
                    description: List of errors
                  data:
                    type: 'null'
                    description: Always null for error responses
                required:
                  - errors
                  - data
        '500':
          description: Internal Server Error
          headers:
            X-Credits-Remaining:
              schema:
                type: integer
              description: Credits remaining after this request
            X-Credits-Used:
              schema:
                type: integer
              description: Credits consumed (1 if charged, 0 if refunded on error)
          content:
            application/json:
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        code:
                          type: string
                          enum:
                            - internal_error
                          description: Machine-readable error code
                        message:
                          type: string
                          example: Internal error
                          description: Human-readable error message
                      required:
                        - code
                        - message
                    description: List of errors
                  data:
                    type: 'null'
                    description: Always null for error responses
                required:
                  - errors
                  - data
        '502':
          description: Bad Gateway — Upstream platform error
          headers:
            X-Credits-Remaining:
              schema:
                type: integer
              description: Credits remaining after this request
            X-Credits-Used:
              schema:
                type: integer
              description: Credits consumed (1 if charged, 0 if refunded on error)
          content:
            application/json:
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        code:
                          type: string
                          enum:
                            - platform_error
                          description: Machine-readable error code
                        message:
                          type: string
                          example: Platform error
                          description: Human-readable error message
                      required:
                        - code
                        - message
                    description: List of errors
                  data:
                    type: 'null'
                    description: Always null for error responses
                required:
                  - errors
                  - data
        '503':
          description: Service Unavailable
          headers:
            X-Credits-Remaining:
              schema:
                type: integer
              description: Credits remaining after this request
            X-Credits-Used:
              schema:
                type: integer
              description: Credits consumed (1 if charged, 0 if refunded on error)
          content:
            application/json:
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        code:
                          type: string
                          enum:
                            - service_unavailable
                          description: Machine-readable error code
                        message:
                          type: string
                          example: Service unavailable
                          description: Human-readable error message
                      required:
                        - code
                        - message
                    description: List of errors
                  data:
                    type: 'null'
                    description: Always null for error responses
                required:
                  - errors
                  - data
        '504':
          description: Gateway Timeout — Upstream platform timed out
          headers:
            X-Credits-Remaining:
              schema:
                type: integer
              description: Credits remaining after this request
            X-Credits-Used:
              schema:
                type: integer
              description: Credits consumed (1 if charged, 0 if refunded on error)
          content:
            application/json:
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        code:
                          type: string
                          enum:
                            - platform_error
                          description: Machine-readable error code
                        message:
                          type: string
                          example: Platform error
                          description: Human-readable error message
                      required:
                        - code
                        - message
                    description: List of errors
                  data:
                    type: 'null'
                    description: Always null for error responses
                required:
                  - errors
                  - data
components:
  schemas:
    RedditPost:
      type: object
      properties:
        type:
          type: string
          enum:
            - Note
        id:
          type: string
          format: uri
          description: Post permalink
          example: https://www.reddit.com/r/programming/comments/post_1/launch_day/
        url:
          type: string
          format: uri
          description: Post permalink
          example: https://www.reddit.com/r/programming/comments/post_1/launch_day/
        entityId:
          type: string
          description: Reddit post ID
          example: post_1
        name:
          type: string
          description: Post title
          example: Launch day
        content:
          type:
            - string
            - 'null'
          description: Post body text
          example: We shipped Reddit support.
        published:
          type: string
          format: date-time
          description: Publication date in ISO 8601 format
          example: '2026-02-27T20:37:38.000Z'
        isEdited:
          type: boolean
          description: Whether the post has been edited
          example: false
        isLocked:
          type: boolean
          description: Whether the post is locked
          example: false
        isOriginal:
          type: boolean
          description: Whether the post is marked as original content
          example: false
        isPinned:
          type: boolean
          description: Whether the post is stickied
          example: false
        isSponsored:
          type: boolean
          description: Whether the post is promoted
          example: false
        isAdult:
          type: boolean
          description: Whether the post is marked as adult content
          example: false
        isSpoiler:
          type: boolean
          description: Whether the post is marked as a spoiler
          example: false
        isSearchable:
          type: boolean
          description: Whether the post is visible to search engines
          example: true
        likeCount:
          type: integer
          description: Number of likes
          example: 93210
        voteCount:
          type: integer
          description: Net score
          example: 118
        commentCount:
          type: integer
          description: Comment count
          example: 15
        shareCount:
          type: integer
          description: Number of crossposts
          example: 8
        attributedTo:
          $ref: '#/components/schemas/RedditEmbeddedUser'
        icon:
          allOf:
            - $ref: '#/components/schemas/RedditImage'
            - description: Thumbnail image
        image:
          type: array
          items:
            allOf:
              - $ref: '#/components/schemas/RedditImage'
              - description: Reddit image resource
          description: Preview image variants
        attachment:
          type: array
          items:
            anyOf:
              - allOf:
                  - $ref: '#/components/schemas/RedditImage'
                  - description: Reddit image resource
              - $ref: '#/components/schemas/RedditVideoAttachment'
              - $ref: '#/components/schemas/RedditLinkAttachment'
          description: Post attachments
        tag:
          type: array
          items:
            $ref: '#/components/schemas/RedditTag'
          description: Subreddit and flair tags
        quote:
          $ref: '#/components/schemas/RedditQuotedPost'
      required:
        - type
        - id
        - url
        - content
        - likeCount
      description: Reddit post
    RedditEmbeddedUser:
      type: object
      properties:
        type:
          type: string
          enum:
            - Person
        id:
          type: string
          format: uri
          description: Profile URL
          example: https://www.reddit.com/user/spez/
        url:
          type: string
          format: uri
          description: Profile URL
          example: https://www.reddit.com/user/spez/
        entityId:
          type: string
          description: Platform-specific entity ID
          example: t2_4x25quk
        preferredUsername:
          type: string
          description: Username or handle
          example: spez
        name:
          type: string
          description: Display name
          example: Steve Huffman
        icon:
          $ref: '#/components/schemas/RedditImage'
        role:
          type: string
          description: Role label for distinguished accounts
          example: admin
        summary:
          type: string
          description: User bio
          example: Reddit CEO
        published:
          type: string
          format: date-time
          description: Account creation date
          example: '2005-12-08T07:46:43.000Z'
        isVerified:
          type: boolean
          description: Whether the account is verified
          example: true
        isEmployee:
          type: boolean
          description: Whether the account belongs to a Reddit employee
          example: true
        isMod:
          type: boolean
          description: Whether the account is a moderator
          example: false
        isPremium:
          type: boolean
          description: Whether the account has a paid premium subscription
          example: false
        isSearchable:
          type: boolean
          description: Whether the profile is visible to search engines
          example: true
        isFollowable:
          type: boolean
          description: Whether the account can be followed
          example: true
        isAdult:
          type: boolean
          description: Whether the profile is marked as adult content
          example: false
        score:
          type: integer
          description: Total Reddit account score
          example: 999999
        postScore:
          type: integer
          description: Score earned from Reddit posts
          example: 555555
        commentScore:
          type: integer
          description: Score earned from Reddit comments
          example: 444444
        awarderScore:
          type: integer
          description: Score earned from giving awards
          example: 123
        awardeeScore:
          type: integer
          description: Score earned from receiving awards
          example: 321
        status:
          type: string
          description: Account status
          example: active
        image:
          allOf:
            - $ref: '#/components/schemas/RedditImage'
            - description: Banner image
      required:
        - type
        - id
        - url
      description: Post author
    RedditImage:
      type: object
      properties:
        type:
          type: string
          description: ActivityStreams object type
          example: Image
        url:
          type: string
          format: uri
          description: Image URL
          example: https://i.redd.it/post1.png
        width:
          type: integer
          description: Width in pixels
          example: 1200
        height:
          type: integer
          description: Height in pixels
          example: 675
      required:
        - type
        - url
      description: Profile picture
    RedditVideoAttachment:
      type: object
      properties:
        type:
          type: string
          enum:
            - Video
        url:
          type: array
          items:
            type: string
            format: uri
          description: Media download URLs
          example:
            - https://v.redd.it/abc123/DASH_720.mp4
        mediaType:
          type: string
          description: MIME type
          example: video/mp4
        width:
          type: integer
          description: Width in pixels
          example: 576
        height:
          type: integer
          description: Height in pixels
          example: 1024
        duration:
          type: number
          description: Duration in seconds
          example: 15
      required:
        - type
        - url
      description: Reddit video attachment
    RedditLinkAttachment:
      type: object
      properties:
        type:
          type: string
          enum:
            - Link
        href:
          type: string
          format: uri
          description: Linked URL
          example: https://example.com/article
        name:
          type: string
          description: Link title
          example: External article
        summary:
          type: string
          description: Link preview summary
          example: A quick summary from the linked article.
      required:
        - type
        - href
      description: Outbound link attachment
    RedditTag:
      type: object
      properties:
        type:
          type: string
          description: ActivityStreams object type
          example: Tag
        name:
          type: string
          description: Tag name
          example: programming
        href:
          type: string
          format: uri
          description: Subreddit or flair URL
          example: https://www.reddit.com/r/programming/
      required:
        - type
        - name
      description: Reddit tag or flair
    RedditQuotedPost:
      type: object
      properties:
        type:
          type: string
          enum:
            - Note
        id:
          type: string
          format: uri
          description: Quoted post permalink
          example: https://www.reddit.com/r/programming/comments/post_1/launch_day/
        url:
          type: string
          format: uri
          description: Quoted post permalink
          example: https://www.reddit.com/r/programming/comments/post_1/launch_day/
        entityId:
          type: string
          description: Quoted Reddit post ID
          example: post_1
        name:
          type: string
          description: Quoted post title
          example: Launch day
        content:
          type:
            - string
            - 'null'
          description: Post body text
          example: We shipped Reddit support.
        published:
          type: string
          format: date-time
          description: Publication date in ISO 8601 format
          example: '2026-02-27T20:37:38.000Z'
        isEdited:
          type: boolean
          description: Whether the post has been edited
          example: false
        isLocked:
          type: boolean
          description: Whether the post is locked
          example: false
        isOriginal:
          type: boolean
          description: Whether the post is marked as original content
          example: false
        isPinned:
          type: boolean
          description: Whether the post is stickied
          example: false
        isSponsored:
          type: boolean
          description: Whether the post is promoted
          example: false
        isAdult:
          type: boolean
          description: Whether the post is marked as adult content
          example: false
        isSpoiler:
          type: boolean
          description: Whether the post is marked as a spoiler
          example: false
        isSearchable:
          type: boolean
          description: Whether the post is visible to search engines
          example: true
        likeCount:
          type: integer
          description: Number of likes
          example: 93210
        voteCount:
          type: integer
          description: Net score
          example: 118
        commentCount:
          type: integer
          description: Comment count
          example: 15
        shareCount:
          type: integer
          description: Number of crossposts
          example: 8
        attributedTo:
          allOf:
            - $ref: '#/components/schemas/RedditEmbeddedUser'
            - description: Quoted post author
        icon:
          allOf:
            - $ref: '#/components/schemas/RedditImage'
            - description: Thumbnail image
        image:
          type: array
          items:
            allOf:
              - $ref: '#/components/schemas/RedditImage'
              - description: Reddit image resource
          description: Preview image variants
        attachment:
          type: array
          items:
            anyOf:
              - allOf:
                  - $ref: '#/components/schemas/RedditImage'
                  - description: Reddit image resource
              - $ref: '#/components/schemas/RedditVideoAttachment'
              - $ref: '#/components/schemas/RedditLinkAttachment'
          description: Post attachments
        tag:
          type: array
          items:
            $ref: '#/components/schemas/RedditTag'
          description: Subreddit and flair tags
      required:
        - type
        - id
        - url
        - content
        - likeCount
      description: Quoted or crossposted post
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: |-
        Send your API key in the Authorization header as a Bearer token.
        Example: `Authorization: Bearer <your-api-key>`

````