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

> ## Agent Instructions
> - Base URLs: models `https://api.aisa.one/v1` (Gemini GenerateContent: `https://api.aisa.one/v1beta`); data APIs `https://api.aisa.one/apis/v1`. The `servers` of each operation in https://aisa.one/openapi.yaml is authoritative.
> - Auth: `Authorization: Bearer $AISA_API_KEY`. Never print, log, or commit the key.
> - MCP (preferred for agents): `https://mcp.aisa.one/mcp`, signed in with OAuth, so there is no key to paste.
> - Agent Skill: `npx skills add AIsa-team/agent-skills --skill aisa`. Fallback with the AIsa CLI: `aisa skills install aisa`.
> - Spending: docs, https://aisa.one/models, https://aisa.one/api, `/v1/models`, and MCP `search`, `list_categories`, `get_details`, `batch_quote`, and the `account` operation are free. Quote the exact calls before running them (MCP `batch_quote`, CLI `aisa quote --json`). If the quote reports `auto_execute_eligible: true`, run it unless the user set a tighter limit or asked only for a quote. Otherwise, tell the user in one message the planned calls, the quoted price, and a total USD budget for the task, then wait for approval. Direct HTTP calls follow the stricter rule at https://aisa.one/docs/get-started/cli.md#direct-http-fallback. Do not make paid calls to test availability. Full rule: https://aisa.one/llms.txt

# Search

> Search a Substack publication's archive for posts matching a query, using Substack's own archive search. Returns the same post entries as archive, with the query echoed.

## Request contract

* **Method and path:** POST /apis/v1/substack-com/newsletters/search
* **Availability:** enabled
* **Request URL template:** `https://api.aisa.one/apis/v1/substack-com/newsletters/search`

[Complete OpenAPI definition](https://aisa.one/docs/openapi/substack-com.json)

Effective request declaration (including authentication and referenced schemas):

```json theme={null}
{
  "operationId": "substack-com.newsletters.search",
  "method": "POST",
  "path": "/apis/v1/substack-com/newsletters/search",
  "servers": [
    {
      "url": "https://api.aisa.one"
    }
  ],
  "parameters": [],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "requestBody": {
    "content": {
      "application/json": {
        "examples": {
          "provider": {
            "summary": "Official provider example; checked against AIsa request constraints",
            "value": {
              "limit": 1,
              "publication": "www.astralcodexten.com",
              "query": "prediction"
            }
          }
        },
        "schema": {
          "additionalProperties": true,
          "properties": {
            "cursor": {
              "description": "next_cursor from the previous page of the same publication, sort and query. Takes precedence over offset.",
              "type": "string",
              "x-alexandria-option-metadata": {
                "in": "body"
              }
            },
            "limit": {
              "default": 12,
              "description": "Posts to return. Substack serves 25 per request, so larger pages take two requests.\n\nProvider reference: minimum 1; maximum 50; default 12.",
              "type": "number",
              "x-alexandria-option-metadata": {
                "in": "body",
                "max": 50,
                "min": 1
              }
            },
            "offset": {
              "default": 0,
              "description": "Posts to skip. new listings reach at most 250 by offset; follow next_cursor for deeper pages. Ignored when cursor is set.\n\nProvider reference: minimum 0; maximum 10000; default 0.",
              "type": "number",
              "x-alexandria-option-metadata": {
                "in": "body",
                "max": 10000,
                "min": 0
              }
            },
            "publication": {
              "description": "Substack slug or a declared custom publication host (www.astralcodexten.com, www.lennysnewsletter.com, www.noahpinion.blog). Other custom domains are not supported by this program.",
              "type": "string"
            },
            "query": {
              "description": "query",
              "type": "string"
            },
            "sort": {
              "default": "new",
              "description": "new = newest first, top = most popular, pinned = the publication's pinned posts only (usually one, a single page).\n\nProvider reference: allowed values [\"new\", \"top\", \"pinned\"]; default \"new\".",
              "type": "string",
              "x-alexandria-option-metadata": {
                "in": "body",
                "oneOf": [
                  "new",
                  "top",
                  "pinned"
                ]
              }
            }
          },
          "required": [
            "publication",
            "query"
          ],
          "type": "object"
        }
      }
    },
    "required": true
  },
  "x-aisa-status": "enabled",
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "scheme": "bearer",
        "type": "http"
      }
    }
  }
}
```

## Cost and request rules

Usage-based pricing. Default request estimate: \$0.0005 USD. The final charge depends on actual usage. Your account price may differ; use a request quote where supported.


## OpenAPI

````yaml openapi/substack-com.json POST /apis/v1/substack-com/newsletters/search
openapi: 3.1.0
info:
  description: ''
  title: Substack
  version: '1'
  x-aisa-capabilities:
    idempotency: Idempotency-Key
    max_price: X-AISA-Max-Price-USD
    quote:
      header: X-AISA-Cost-Mode
      value: quote
  x-aisa-catalogs:
    substack-com:
      description: ''
      title: Substack
      x-aisa-capabilities:
        idempotency: Idempotency-Key
        max_price: X-AISA-Max-Price-USD
        quote:
          header: X-AISA-Cost-Mode
          value: quote
      x-aisa-document:
        facts_hash: 89c1207f996a9015efbff38e590a58a7adc6a2acfa9c4de3e70ac962dba23a83
        generator_version: '3'
        protocol_version: '1'
        schema_version: '1'
      x-aisa-plans:
        builder: 1
        display_plan: payg
        payg: 1
        similarweb_payg: 1
        team: 1
        version: e70a0959cd1b93b84ae16dffd7a538273ddb9c1d46277b82823c37ff1b6bc0fb
  x-aisa-configured-paths:
    - /apis/v1/substack-com/newsletters/archive
    - /apis/v1/substack-com/newsletters/post
    - /apis/v1/substack-com/newsletters/search
  x-aisa-document:
    composer_version: '31'
    document_hash: sha256:72a798fcbd448bdcd1893095b45ede1d3cbd002bf3539b36ce01c8821031a2b5
    facts_hash: 89c1207f996a9015efbff38e590a58a7adc6a2acfa9c4de3e70ac962dba23a83
    generator_version: '3'
    protocol_version: '1'
    response_pending: []
    schema_version: '1'
  x-aisa-plans:
    builder: 1
    display_plan: payg
    payg: 1
    similarweb_payg: 1
    team: 1
    version: e70a0959cd1b93b84ae16dffd7a538273ddb9c1d46277b82823c37ff1b6bc0fb
  x-aisa-provider: substack-com
servers:
  - url: https://api.aisa.one
security:
  - bearerAuth: []
paths:
  /apis/v1/substack-com/newsletters/search:
    post:
      tags:
        - Substack
      summary: Search
      description: >-
        Search a Substack publication's archive for posts matching a query,
        using Substack's own archive search. Returns the same post entries as
        archive, with the query echoed.
      operationId: substack-com.newsletters.search
      requestBody:
        content:
          application/json:
            examples:
              provider:
                summary: >-
                  Official provider example; checked against AIsa request
                  constraints
                value:
                  limit: 1
                  publication: www.astralcodexten.com
                  query: prediction
            schema:
              additionalProperties: true
              properties:
                cursor:
                  description: >-
                    next_cursor from the previous page of the same publication,
                    sort and query. Takes precedence over offset.
                  type: string
                  x-alexandria-option-metadata:
                    in: body
                limit:
                  default: 12
                  description: >-
                    Posts to return. Substack serves 25 per request, so larger
                    pages take two requests.


                    Provider reference: minimum 1; maximum 50; default 12.
                  type: number
                  x-alexandria-option-metadata:
                    in: body
                    max: 50
                    min: 1
                offset:
                  default: 0
                  description: >-
                    Posts to skip. new listings reach at most 250 by offset;
                    follow next_cursor for deeper pages. Ignored when cursor is
                    set.


                    Provider reference: minimum 0; maximum 10000; default 0.
                  type: number
                  x-alexandria-option-metadata:
                    in: body
                    max: 10000
                    min: 0
                publication:
                  description: >-
                    Substack slug or a declared custom publication host
                    (www.astralcodexten.com, www.lennysnewsletter.com,
                    www.noahpinion.blog). Other custom domains are not supported
                    by this program.
                  type: string
                query:
                  description: query
                  type: string
                sort:
                  default: new
                  description: >-
                    new = newest first, top = most popular, pinned = the
                    publication's pinned posts only (usually one, a single
                    page).


                    Provider reference: allowed values ["new", "top", "pinned"];
                    default "new".
                  type: string
                  x-alexandria-option-metadata:
                    in: body
                    oneOf:
                      - new
                      - top
                      - pinned
              required:
                - publication
                - query
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              examples:
                provider:
                  description: >-
                    Published by the provider on
                    2026-11-06T14:46:21.968964+00:00.
                  summary: Official provider example
                  value:
                    count: 1
                    has_more: true
                    limit: 1
                    next_cursor: '1'
                    next_offset: 1
                    observed_at_ms: 1789435777564
                    offset: 0
                    paywalled_count: 0
                    posts:
                      - audience: everyone
                        authors:
                          - bio: null
                            handle: astralcodexten
                            id: '12009663'
                            name: Scott Alexander
                            photo_url: >-
                              https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F7b500d22-1176-42ad-afaa-5d72bc36a809_44x44.png
                        comments: 104
                        cover_image: >-
                          https://bucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com/public/images/64c0705b-004a-4b01-861b-a00c1513fb5e_248x248.png
                        description: Two more prediction markets, plus AI
                        free_preview_sent: false
                        id: '32257019'
                        paywalled: false
                        podcast_duration_seconds: null
                        podcast_url: null
                        preview_text: null
                        publication_id: '89120'
                        published_at: '2021-02-08T20:46:22.180Z'
                        reactions: 63
                        restacks: 0
                        section: null
                        slug: metaculus-monday-2821
                        subtitle: Two more prediction markets, plus AI
                        tags: []
                        title: Metaculus Monday 2/8/21
                        type: newsletter
                        url: https://www.astralcodexten.com/p/metaculus-monday-2821
                        wordcount: 1650
                    publication:
                      host: www.astralcodexten.com
                      url: https://www.astralcodexten.com
                    query: prediction
                    sort: new
                    source: >-
                      https://www.astralcodexten.com/api/v1/archive?sort=new&search=prediction&limit=1
              schema:
                not:
                  type: 'null'
                x-aisa-schema-completeness: documented-fields-only
          description: >-
            Search a Substack publication's archive for posts matching a query,
            using Substack's own archive search. Returns the same post entries
            as archive, with the query echoed. Custom domains are limited to the
            declared publications; paid text remains the anonymous preview.


            The response contains the tool result directly.


            The provider identifies `posts` as the primary payload key.


            | Documented field | Provider type | Description |

            | --- | --- | --- |

            | `audience` | string |  |

            | `authors` | object[] |  |

            | `comments` | number |  |

            | `cover_image` | string |  |

            | `description` | string |  |

            | `free_preview_sent` | boolean |  |

            | `id` | string |  |

            | `paywalled` | boolean |  |

            | `podcast_duration_seconds` | number |  |

            | `podcast_url` | string |  |

            | `preview_text` | string |  |

            | `publication_id` | string |  |

            | `published_at` | string |  |

            | `reactions` | number |  |

            | `restacks` | number |  |

            | `section` | object |  |

            | `slug` | string |  |

            | `subtitle` | string |  |

            | `tags` | object[] |  |

            | `title` | string |  |

            | `type` | string |  |

            | `url` | string |  |

            | `wordcount` | number |  |



            These are the provider's documented fields. Field requiredness,
            nullability and nested object structures are specified only where
            the descriptions explicitly say so.
        default:
          content:
            application/json:
              schema: {}
          description: >-
            Error response; upstream passthrough responses may use provider
            formats
components:
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.