---
title: "Fetch a page with a browser"
description: "Loads a public URL in a headless browser and returns it rendered: HTML for content, Markdown for markdown, a JSON array of its link URLs for links, PNG for screenshot, PDF for pdf."
canonical: "https://www.cool.computer/docs/api-reference/computers/fetch-a-page-with-a-browser"
---
# Fetch a page with a browser

> Loads a public URL in a headless browser and returns it rendered: HTML for content, Markdown for markdown, a JSON array of its link URLs for links, PNG for screenshot, PDF for pdf.

```http
POST https://api.cool.computer/api/computers/{id}/browser/{action}
```

Loads a public URL in a headless browser and returns it rendered: HTML for content, Markdown for markdown, a JSON array of its link URLs for links, PNG for screenshot, PDF for pdf. For content, markdown and links, when the browser reports the page's response with a status and headers, X-Page-Status carries that status (such as 404), and a response whose headers name a type that is not HTML, or none (an empty 404), is fetched again and returned as served, with that answer's own status and Content-Type. If that answer names no type and sniffs as HTML, the rendering stays. Without the report, the rendering is returned with no X-Page-Status. The body is an attachment and never runs on this origin. Callers: an account bearer, or the computer's own runtime token (which `cool` uses inside the VM) for this computer.

## Authorization

- A Cool Computers API key, user access token, or claimed agent access token in the Authorization header. Follow https://www.cool.computer/auth.md for agent registration and https://www.cool.computer/authentication.md for direct user credentials.

## Parameters

- `id` (path, string, at least 1 characters, required): The computer's name, such as agent-atlas, or its id (cmp_…). Every caller may use either, the computer's own runtime token included.
- `action` (path, "content" or "markdown" or "links" or "screenshot" or "pdf", required): What to return.

## Request body

Required.

- `application/json` (object)
  - `url` (string, uri, required)

## Responses

- `200`: The rendering in the requested form, or a response that is not HTML exactly as served, with its own Content-Type, as the operation describes.
  - `text/html` (string)
  - `text/markdown` (string)
  - `application/json` (any)
  - `image/png` (string, binary)
  - `application/pdf` (string, binary)
  - `*/*` (string, binary)
- `400`: Bad Request: invalid_request when the URL is not an absolute public http(s) URL, browser_request_rejected when the browser could not load the page.
- `401`: Unauthorized.
- `403`: Forbidden.
- `404`: Not Found. `computer_not_found`: the computer does not exist or is not yours.
- `409`: Conflict.
- `429`: Too Many Requests: browser_rate_limited when the browser service is busy (wait a minute, then retry); api_request_rate_exceeded when the API rate limit is reached (wait for Retry-After seconds).
- `500`: Internal Server Error.
- `502`: Bad Gateway: browser_response_too_large when the page is larger than the browser returns; fetch an HTML page as markdown or links instead, and download a large file with curl on a computer's VM.
- `503`: Service Unavailable: browser_unavailable when the browser service refused or could not be reached. Try again later; to read a site on this account, read its files instead.
- `default`: A machine-readable API error with a stable code and recovery instruction.

An error is an `application/problem+json` document with a stable `code`; [API errors](/docs/api-reference/errors) says how to handle one.

## Example

```sh
curl -X POST "https://api.cool.computer/api/computers/$PARAM_ID/browser/$PARAM_ACTION" \
  -H "authorization: Bearer $TOKEN" \
  -H "content-type: application/json" \
  --data '{"url":"https://example.com"}'
```
