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

# Search Posts

> Search for posts in your publication.



## OpenAPI

````yaml GET /posts/search
openapi: 3.0.1
info:
  title: Substack API
  description: API for fetching posts from Substack publications.
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.substackapi.dev
security:
  - apiKeyAuth: []
paths:
  /posts/search:
    get:
      description: Search for posts in your publication.
      parameters:
        - name: publication_url
          in: query
          description: >-
            The URL of the publication to retrieve posts from (e.g.
            example.substack.com)
          required: true
          schema:
            type: string
        - name: query
          in: query
          description: >-
            The query to search for (e.g. 'AI', 'machine learning', 'data
            science')
          required: true
          schema:
            type: string
        - name: limit
          in: query
          description: 'The maximum number of results to return (default: 10)'
          schema:
            type: integer
            format: int32
            default: 10
            minimum: 1
            maximum: 50
        - name: offset
          in: query
          description: 'The offset of the results to return (default: 0)'
          schema:
            type: integer
            format: int32
            default: 0
            minimum: 0
      responses:
        '200':
          description: A list of posts
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/SubstackPost'
        '400':
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    SubstackPost:
      type: object
      properties:
        slug:
          type: string
          example: my-post
        url:
          type: string
          example: https://example.substack.com/p/my-post
        title:
          type: string
          example: My Post
        description:
          type: string
          example: This is a description of my post
        excerpt:
          type: string
          nullable: true
          example: This is an excerpt of my post
        body_html:
          type: string
          nullable: true
          example: <p>This is the body of my post</p>
        reading_time_minutes:
          type: number
          nullable: true
          example: 5
        audio_url:
          type: string
          nullable: true
          example: https://example.com/my-post.mp3
        date:
          type: string
          example: '2025-03-20T15:30:00Z'
        likes:
          type: number
          example: 100
        paywall:
          type: boolean
          example: false
        cover_image:
          type: object
          additionalProperties: false
          properties:
            original:
              type: string
              nullable: true
              example: https://example.com/my-post.jpg
            og:
              type: string
              nullable: true
              description: 1200x630px
              example: https://example.com/my-post.jpg
            small:
              type: string
              nullable: true
              description: 150px
              example: https://example.com/my-post.jpg
            medium:
              type: string
              nullable: true
              description: 424px
              example: https://example.com/my-post.jpg
            large:
              type: string
              nullable: true
              description: 848px
              example: https://example.com/my-post.jpg
        cover_image_color_palette:
          type: object
          additionalProperties: false
          properties:
            vibrant:
              type: string
              nullable: true
              example: rgb(0, 0, 0)
            light_vibrant:
              type: string
              nullable: true
              example: rgb(0, 0, 0)
            dark_vibrant:
              type: string
              nullable: true
              example: rgb(0, 0, 0)
            muted:
              type: string
              nullable: true
              example: rgb(0, 0, 0)
            light_muted:
              type: string
              nullable: true
              example: rgb(0, 0, 0)
            dark_muted:
              type: string
              nullable: true
              example: rgb(0, 0, 0)
        author:
          type: string
          example: John Doe
        author_image:
          type: object
          additionalProperties: false
          properties:
            original:
              type: string
              nullable: true
              example: https://example.com/my-post.jpg
            small:
              type: string
              nullable: true
              description: 32px
              example: https://example.com/my-post.jpg
            medium:
              type: string
              nullable: true
              description: 72px
              example: https://example.com/my-post.jpg
            large:
              type: string
              nullable: true
              description: 192px
              example: https://example.com/my-post.jpg
    Error:
      required:
        - code
        - message
      type: object
      properties:
        code:
          type: integer
          format: int32
          example: 400
        message:
          type: string
          example: Bad Request
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: >-
        Test key: sk_test_9b0j6a1bdbf4f38b1

        Get production key at
        [auth.substackapi.dev](https://auth.substackapi.dev)

````