Extract
Extract quickstart
One page as Markdown, then what a failure looks like, then the labels.
Copy as MarkdownOpen in ChatGPT (opens in a new tab)Open in Claude (opens in a new tab)
1. Read one page
curl https://api.millionshort.com/v1/extract \
-H "Authorization: Bearer $MILLIONSHORT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"urls": ["https://example.org/guides/tide-tables"],
"mode": "live"
}'import os
import requests
r = requests.post(
"https://api.millionshort.com/v1/extract",
headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]},
json={
"urls": [
"https://example.org/guides/tide-tables"
],
"mode": "live"
},
timeout=30,
)
r.raise_for_status()
print(r.json()["data"])const res = await fetch('https://api.millionshort.com/v1/extract', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"urls": [
"https://example.org/guides/tide-tables"
],
"mode": "live"
}),
});
if (!res.ok) throw new Error(`POST /v1/extract failed: ${res.status}`);
const { data } = (await res.json()) as { data: unknown };
console.log(data);live fetches the page now. The answer has one entry per URL in data.results, in the order sent. A page that worked has status: "ok", its title, and its main content in markdown.
2. Check each URL
The HTTP status is 200 whenever the request itself was valid, even when every URL failed. Look at each entry. One that failed looks like this:
"url": "https://example.org/private",
"status": "error",
"error": {
"code": "ROBOTS_DISALLOWED",
"message": "This site's robots.txt does not allow our bot to fetch this page."
}A URL that fails costs nothing, except a page that does not exist in a browser mode (pricing). Errors lists the codes and what to try next.
3. Choose what comes back
curl https://api.millionshort.com/v1/extract \
-H "Authorization: Bearer $MILLIONSHORT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"urls": ["https://example.org/guides/tide-tables"],
"mode": "live",
"formats": ["markdown", "metadata", "links"],
"max_chars": 20000
}'import os
import requests
r = requests.post(
"https://api.millionshort.com/v1/extract",
headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]},
json={
"urls": [
"https://example.org/guides/tide-tables"
],
"mode": "live",
"formats": [
"markdown",
"metadata",
"links"
],
"max_chars": 20000
},
timeout=30,
)
r.raise_for_status()
print(r.json()["data"])const res = await fetch('https://api.millionshort.com/v1/extract', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"urls": [
"https://example.org/guides/tide-tables"
],
"mode": "live",
"formats": [
"markdown",
"metadata",
"links"
],
"max_chars": 20000
}),
});
if (!res.ok) throw new Error(`POST /v1/extract failed: ${res.status}`);
const { data } = (await res.json()) as { data: unknown };
console.log(data);formats takes markdown, text, links and metadata. max_chars cuts long content, and truncated says when it did.
4. Read the labels
Every page that comes back says what it is, at no charge: topic, page_type and source_hint, each with a confidence. A program can route a page by them without reading it. See Labels.
Next
- Parameters: every field, the modes and the response.
- Batch: up to 1,000 URLs as one job.
- Pricing and limits: what each mode costs.
The SDKs do not cover this endpoint yet. Call the endpoint over HTTP as above.