curl --request POST \
--url https://api.aisa.one/apis/v1/substack-com/newsletters/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"publication": "www.astralcodexten.com",
"query": "prediction"
}
'import requests
url = "https://api.aisa.one/apis/v1/substack-com/newsletters/search"
payload = {
"publication": "www.astralcodexten.com",
"query": "prediction"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({publication: 'www.astralcodexten.com', query: 'prediction'})
};
fetch('https://api.aisa.one/apis/v1/substack-com/newsletters/search', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.aisa.one/apis/v1/substack-com/newsletters/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'publication' => 'www.astralcodexten.com',
'query' => 'prediction'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.aisa.one/apis/v1/substack-com/newsletters/search"
payload := strings.NewReader("{\n \"publication\": \"www.astralcodexten.com\",\n \"query\": \"prediction\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.aisa.one/apis/v1/substack-com/newsletters/search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"publication\": \"www.astralcodexten.com\",\n \"query\": \"prediction\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/substack-com/newsletters/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"publication\": \"www.astralcodexten.com\",\n \"query\": \"prediction\"\n}"
response = http.request(request)
puts response.read_body{
"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"
}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.
curl --request POST \
--url https://api.aisa.one/apis/v1/substack-com/newsletters/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"publication": "www.astralcodexten.com",
"query": "prediction"
}
'import requests
url = "https://api.aisa.one/apis/v1/substack-com/newsletters/search"
payload = {
"publication": "www.astralcodexten.com",
"query": "prediction"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({publication: 'www.astralcodexten.com', query: 'prediction'})
};
fetch('https://api.aisa.one/apis/v1/substack-com/newsletters/search', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.aisa.one/apis/v1/substack-com/newsletters/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'publication' => 'www.astralcodexten.com',
'query' => 'prediction'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.aisa.one/apis/v1/substack-com/newsletters/search"
payload := strings.NewReader("{\n \"publication\": \"www.astralcodexten.com\",\n \"query\": \"prediction\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.aisa.one/apis/v1/substack-com/newsletters/search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"publication\": \"www.astralcodexten.com\",\n \"query\": \"prediction\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/substack-com/newsletters/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"publication\": \"www.astralcodexten.com\",\n \"query\": \"prediction\"\n}"
response = http.request(request)
puts response.read_body{
"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"
}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
{
"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.Authorizations
Body
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.
Response
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.