Skip to Content
ReferenceHTTP API

HTTP API

Fetch a URL and retrieve the rendered page. See how to use the HTTP API for practical documentation.

Fetch a URL

The POST /api/fetch endpoint returns a JSON message containing the page’s content.

Request

The request requires a bearer authorization header with your token and the Content-Type: application/json header. You can pass the token as a token query parameter instead of the header.

The endpoint accepts the following parameters:

ParameterTypeRequiredDefaultDescription
urlstringYes—The URL to fetch.
output_formathtml | markdownNohtml—
wait_msuintNo5000Maximum time to wait for wait_event, in milliseconds. On timeout, the page is returned as it is. 0 also falls back to the default; it doesn’t mean “don’t wait”.
wait_eventDOMContentLoaded | load | networkAlmostIdle | networkIdleNonetworkIdleEvent to wait for before retrieving the page.
rawboolNofalseIf true, the raw HTML or markdown is returned directly, without the JSON wrapper, with Content-Type: text/html or text/plain respectively.
proxy_namestringNofast_dcProxy to route the request through: fast_dc (the region’s default), datacenter, or the identifier of a proxy you added in the console. Up to 32 characters. See use a proxy on Lightpanda Cloud.
countrystringNo—Two-letter country code, case-insensitive. Only used with the datacenter proxy.
curl -XPOST \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ https://euwest.cloud.lightpanda.io/api/fetch \ --data '{ "url": "https://lightpanda.io", "output_format": "markdown", "wait_ms": 50000, "wait_event": "networkIdle", "raw": false }'

Response

If the request sets raw to false, a JSON response is returned.

FieldTypeDescription
datastringThe page’s content, in the format specified by the output_format parameter.
statusintThe response status code.
headersobject, optionalThe HTTP headers returned by the server.
{ "data": "\n# Example Domain\n\nThis domain is for use in documentation examples without needing permission. Avoid use in operations.\n\n[Learn more](https://iana.org/domains/example)\n", "status": 200, "headers": { "age": "10026", "allow": "GET, HEAD", "cf-cache-status": "HIT", "cf-ray": "9f0dd9374a2320ab-IAD", "content-encoding": "br", "content-type": "text/html", "date": "Thu, 23 Apr 2026 15:19:47 GMT", "last-modified": "Sat, 18 Apr 2026 00:51:00 GMT", "server": "cloudflare" } }

Errors

Errors return a plain-text body instead of the JSON response.

StatusCause
400The body has an unknown field or an invalid value. For an invalid value, the body starts with the parameter’s name, for example wait_event: bad wait event, format: bad format, proxy_name: bad proxy or country: bad country.
401The token is missing or invalid.
415The Content-Type header isn’t application/json.
429A plan limit is reached, or no browser is free in the region right now.
500The fetch failed or the service hit an error. A failed fetch returns a body that starts with fetch:.