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

# Search Posts

> Search Reddit posts globally or within a subreddit. Supports Reddit's full query syntax (title:, author:, subreddit:, flair:, AND/OR/NOT).



## OpenAPI

````yaml GET /v1/reddit/search/posts
openapi: 3.1.0
info:
  title: ScrapeBadger Reddit API
  version: 1.0.0
  description: >-
    Reddit scraping API for posts, comments, subreddits, users, search, and wiki
    content.
servers:
  - url: https://scrapebadger.com
    description: Production
security:
  - apiKeyAuth: []
paths:
  /v1/reddit/search/posts:
    get:
      summary: Search Reddit posts
      description: Search Reddit posts globally or within a subreddit.
      operationId: search_posts_v1_reddit_search_posts_get
      parameters:
        - name: q
          in: query
          required: true
          schema:
            type: string
            description: Search query
            title: Q
          description: Search query
        - name: subreddit
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Restrict to subreddit
            title: Subreddit
          description: Restrict to subreddit
        - name: sort
          in: query
          required: false
          schema:
            type: string
            description: 'Sort: relevance, hot, top, new, comments'
            default: relevance
            title: Sort
          description: 'Sort: relevance, hot, top, new, comments'
        - name: t
          in: query
          required: false
          schema:
            type: string
            description: 'Time: hour, day, week, month, year, all'
            default: all
            title: T
          description: 'Time: hour, day, week, month, year, all'
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            maximum: 100
            minimum: 1
            default: 25
            title: Limit
        - name: after
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: After
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                title: Response Search Posts V1 Reddit Search Posts Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: ScrapeBadger API key

````