Live · Live Fetch API

Fetch

Fetch reads one web page and returns its main content as markdown. Navigation, ads and boilerplate are stripped; the title, description, author and dates come back as separate fields.

Request

Send a POST request to https://api.epochal.com/v1/fetch with two required headers and a JSON body.

HeaderRequiredValue
x-api-keyYesYour API key. See Authentication.
Content-TypeYesapplication/json
Cache-ControlNoHow old a cached copy may be. See Fresh or cached.
curl https://api.epochal.com/v1/fetch \
  -H "x-api-key: $EPOCHAL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://news.example.com/energy/battery-plant-delay",
    "max_characters": 2000
  }'

Body fields

FieldTypeDefaultDescription
urlstringrequiredThe page to read: a full http or https URL on the public web.
max_charactersinteger, 1 to 1,000,000100000The most characters of content to return. Longer pages set truncated: true.

Unknown fields are rejected with a 400.

Response

A 200 returns the page's content as markdown, its metadata, and a request id.

JSON

json

{
  "request_id": "7c2e5f0a-93b4-4d1e-a6f8-2b0c9e4d7a15",
  "status": "success",
  "id": "6b81feebde1a4821a125fb307894e7ad",
  "url": "https://news.example.com/energy/battery-plant-delay",
  "final_url": "https://news.example.com/energy/battery-plant-delay/",
  "title": "Battery plant start pushed back to late 2027",
  "description": "The cell maker said commissioning would slip.",
  "author": "Jane Doe",
  "published_at": "2026-08-19T06:12:00Z",
  "language": "en",
  "content": "# Battery plant start pushed back to late 2027\n\nThe cell maker said…",
  "truncated": true,
  "entity": null
}
FieldMeaning
request_idIdentifies this request in Epochal's logs; quote it when reporting a problem.
statussuccess when the page was read; error when it could not be, with the reason in page_error.
page_errorWhy the page could not be read: the site's http_status_code and a short message. Absent on success.
idIdentifies the exact stored version served. null when unknown.
urlThe URL as requested.
final_urlThe URL the content was read from, after redirects and normalization.
titleThe page's title.
descriptionThe page's own summary, from its metadata. null when it declares none.
authorThe page's authors, comma-separated. null when it names none.
published_atWhen the page says it was first published. null when it declares no trusted date.
languageThe page's language as a BCP 47 tag. null when not detected.
contentThe page's extracted text as markdown, at most max_characters long.
truncatedWhether max_characters cut content short.
entityThe stock, crypto asset, city's weather, sports league, person, organization or place when the URL is an Epochal World page or a LinkedIn profile linked to one. null for ordinary web pages. See World Entities.

Fresh or cached

By default Fetch may serve a cached copy, which is faster. Send Cache-Control: no-cache to read the page from the site now.

To set how old a cached copy may be, send a Cache-Control header with the oldest age you accept, in seconds. This accepts a copy up to a day old:

cURL

bash

curl https://api.epochal.com/v1/fetch \
  -H "x-api-key: $EPOCHAL_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Cache-Control: max-age=86400" \
  -d '{"url": "https://news.example.com/energy/battery-plant-delay"}'

max-age=0 reads the page fresh, the same as no-cache. The SDKs send this header from max_age: live.fetch(url, max_age=86400) in Python, FetchRequest::max_age in Rust.

Cached copies are shared

A cached copy is kept for up to 7 days and served to anyone who fetches the same exact URL, until the site is read again. A URL that grants access by itself (a signed download link, a password reset link, a link carrying a session ID) therefore lets anyone else with that URL read the page from us, even after the link has expired at the site. Send such URLs only if your organization has zero data retention: Fetch then neither stores a copy nor serves one.

A URL carrying a session ID in a parameter such as jsessionid or PHPSESSID is never cached.

A page that could not be read

When the request is fine but the page cannot be read, Fetch still answers 200, with status set to error, an empty content, and the reason in page_error. The request is billed like any other.

JSON

json

{
  "request_id": "7c2e5f0a-93b4-4d1e-a6f8-2b0c9e4d7a15",
  "status": "error",
  "page_error": {
    "http_status_code": 404,
    "message": "Page not found."
  },
  "id": null,
  "url": "https://news.example.com/energy/missing",
  "final_url": "https://news.example.com/energy/missing",
  "title": "",
  "description": null,
  "author": null,
  "published_at": null,
  "language": null,
  "content": "",
  "truncated": false,
  "entity": null
}

Branch on http_status_code, not message. It is the code the site sent, the one you would get reading the page yourself:

page_error.http_status_codeWhat happened
4xxThe site refused or has no such page: 404 or 410 not found, 401 or 403 denied, 429 rate limited.
5xxThe site failed. Retrying later may help.
2xxThe site answered, but the page is empty, not a document, or has no readable content.
3xxThe site's redirects lead to no page.
nullNo site answered: the host does not resolve or could not be reached.

A page whose redirects lead to a URL that is never served reads Not served., with a 403 or 400; do not retry it.

How pages are read

Fetch reads each page once, directly, when you ask for it. Sites see it as the user agent Epochal-User/1.0 (+https://epochal-user.crawler.epochal.com). Because every read is one you requested, not a crawl, it does not consult robots.txt; a site can still block it by that user agent.

Errors

A non-200 status means the request itself failed: it was invalid, or the failure was on our side. Errors use the same JSON shape as every other endpoint. Check type, not message. No error is billed.

StatustypeWhat to do
400invalid_requesturl is missing, is not a full http/https URL, or targets a private or local host such as localhost or 10.0.0.7; or max_characters is out of range. See error.message for details.
401invalid_api_keyThe x-api-key header is missing, or the key is unknown, revoked, or expired. Fix the key.
402free_quota_exhausted, trial_onlyThe free requests for this API are used up, or it is in trial for your organization. Contact us.
402insufficient_creditsAdd credits in the console.
403organization_suspendedBilling is suspended. Contact us.
403spend_limit_reachedRaise the spend limit in the console, or wait for the next billing period.
403url_not_allowedThis URL is never served. Use another source instead of retrying.
429rate_limit_exceededRate limit exceeded. Wait for Retry-After before retrying.
500, 503, 504internal_error, service_unavailable, timeoutSomething failed on Epochal's side. Retry with backoff.

For the cause and fix of each, see Errors.

Next steps

Search API

Search ranks the live web for a query and returns results with snippets.

Fetch reference

Read one URL and get back its main content as markdown.

Rate Limits

Organization and per-IP rate limits, retry behavior, and pacing guidance.

Errors

Standard JSON error envelope, HTTP status codes, sandbox failure types, and retry rules.