> ## Documentation Index
> Fetch the complete documentation index at: https://docs.linkup.so/llms.txt
> Use this file to discover all available pages before exploring further.

# Fetch for AI agents

> Self-contained /fetch integration prompt for coding agents and tool-using LLMs that need full page content or typed JSON from a known URL.

This page is structured for direct use as integration context for a coding
agent, or as a function-calling tool definition. Operational guidance is
repeated inline so the page is self-contained.

***

# Linkup `/fetch` integration guide

You are integrating the **Linkup `/fetch` API**: a real-time page content
extractor. Given a URL, it returns clean LLM-ready markdown. Optional
JavaScript rendering is available for client-side-rendered pages, along with
optional raw HTML and image URL extraction. `"pro"` delivers significantly
higher success rates on hard-to-retrieve pages. Pass `schema` to also get
typed JSON from that same page in `data`.

Limits: HTML up to 20 MB, PDF up to 100 MB. HTML and PDF only. Markdown-only
latency is typically \~1s. Structured output adds a model pass after the
scrape and is slower.

## When to use it

Use `/fetch` when the URL is already known: typically after `/search` has
narrowed the candidates, or when a user has supplied the URL directly.

Use `schema` on `/fetch` when you already have the URL and want typed JSON
from **this page**. Do not use `/extract` for a single page's JSON object.
Do not use Search `structuredOutputSchema` when the URL is already known.

Other endpoints in the API:

* [**Search**](https://docs.linkup.so/pages/documentation/endpoints/search/overview.md) (`/search`): when no URL is available and web content must be located. Use `outputType` `"structured"` and `structuredOutputSchema` only when there is no URL yet.
* [**Research**](https://docs.linkup.so/pages/documentation/endpoints/research/overview.md) (`/research`): autonomous research agent. Async, 2–20 minutes depending on depth.
* [**Extract**](https://docs.linkup.so/pages/documentation/endpoints/extract/overview.md) (`/extract`): many structured rows from a listing page, possibly following links. Closed beta, async.
* [**Tasks**](https://docs.linkup.so/pages/documentation/endpoints/tasks/overview.md) (`/tasks`): asynchronous batch wrapper around **Search**, **Fetch**, and **Research**. Fetch tasks accept the same `schema` and `instructions` as `POST /fetch`.

## Setup

```bash theme={"system"}
pip install linkup-sdk            # Python
# or
npm install linkup-sdk            # TypeScript
```

```bash theme={"system"}
export LINKUP_API_KEY="your-api-key"
```

## Example (Python; adapt to the project's language)

```python theme={"system"}
from linkup import LinkupClient

client = LinkupClient(api_key="<YOUR_LINKUP_API_KEY>")

# renderJs: true is the safer default for unknown sites.
# Many modern marketing sites and SPAs require it.
response = client.fetch(
    url="https://docs.linkup.so",
    mode="standard",
    render_js=True,
)
print(response)
```

Structured JSON from a known URL (if the SDK release does not accept
`schema` / `instructions`, POST the same JSON to `https://api.linkup.so/v1/fetch`):

```python theme={"system"}
schema = {
    "type": "object",
    "properties": {
        "jobs": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "position": {
                        "type": "string",
                        "description": "The job title or position",
                    },
                    "city": {
                        "type": "string",
                        "description": "The city where the job is located",
                    },
                },
            },
        }
    },
}

response = client.fetch(
    url="https://www.linkup.so/careers",
    schema=schema,
    instructions="If a position is listed in multiple cities, emit one jobs item per city so jobs[].city is a single city.",
)
print(response.data)
```

## Tool definition (OpenAI function-calling format)

Remove the `"type": "function"` envelope and rename `parameters` to
`input_schema` for the Anthropic format.

```json theme={"system"}
{
  "type": "function",
  "function": {
    "name": "linkup_fetch",
    "description": "Fetches a URL and returns clean LLM-ready markdown. Optionally extracts typed JSON into data when schema is provided. Supports HTML pages up to 20 MB and PDF pages up to 100 MB. Handles JavaScript-rendered HTML pages when renderJs is true. Use mode=pro for hard-to-retrieve pages. Use whenever the URL is already known. Use schema when you need typed JSON from this page; do not follow links.",
    "parameters": {
      "type": "object",
      "properties": {
        "url": {
          "type": "string",
          "description": "The URL to fetch. Must be a valid HTTP/HTTPS URL pointing to an HTML or PDF page."
        },
        "mode": {
          "type": "string",
          "enum": ["standard", "pro"],
          "description": "Retrieval mode. Use standard for regular pages. pro delivers significantly higher success rates on hard-to-retrieve pages.",
          "default": "standard"
        },
        "renderJs": {
          "type": "boolean",
          "description": "Render the page's JavaScript before extraction. Default false. For agentic pipelines, set to true by default to ensure the full page content is extracted; many modern sites require it. Set to false only after the specific site has been confirmed to render server-side.",
          "default": false
        },
        "includeRawHtml": {
          "type": "boolean",
          "description": "Return the raw HTML alongside the markdown. Default false. Set to true for workflows that need full page HTML, or when complex structure (tables, custom elements) is erased during markdown conversion.",
          "default": false
        },
        "extractImages": {
          "type": "boolean",
          "description": "Extract image URLs alongside the markdown. Default false. Set to true for workflows that consume images (product photos, charts, recipe images).",
          "default": false
        },
        "schema": {
          "type": "object",
          "description": "Optional JSON Schema of type object describing the structured data to extract from this page. When set, the response includes data. Field descriptions tell the model what to look for. Fields with no grounded value are omitted, even if marked required. This page only — does not follow links."
        },
        "instructions": {
          "type": "string",
          "description": "Optional extra rules the schema cannot express (currency, which prices to keep, how to split rows). Requires schema. Maximum 4000 characters. Does not trim markdown. Invalid without schema."
        }
      },
      "required": ["url"]
    }
  }
}
```

## Operational guidance (inline)

### `mode` selection

Use `"standard"` for `mode` by default and `"pro"` for hard-to-retrieve
pages. `"pro"` delivers significantly higher success rates on
hard-to-retrieve pages. It costs more.

`mode` and `renderJs` solve different problems: `mode` controls how the page
is accessed, while `renderJs` controls whether JavaScript is executed.

### `renderJs` selection

For agentic pipelines, set `renderJs` to `true` by default to ensure the full
content of each page is extracted. A page that requires JavaScript rendering
and does not receive it returns near-empty markdown. Set `renderJs` to `false`
only when all the URLs to be accessed have been confirmed to render
server-side.

Cost depends on `mode` and `renderJs`. Adding a `schema` for
[structured output](https://docs.linkup.so/pages/documentation/endpoints/fetch/overview.md#structured-output)
adds a flat \$0.001 on top of any combination.

| `mode` | `renderJs` | Markdown only | With `schema` |
| - | - | - | - |
| `"standard"` | `false` | \$0.001 per call | \$0.002 per call |
| `"standard"` | `true` | \$0.005 per call | \$0.006 per call |
| `"pro"` | `false` | \$0.005 per call | \$0.006 per call |
| `"pro"` | `true` | \$0.01 per call | \$0.011 per call |

Failed calls are not billed.

### When to use Fetch

**Fetch** is purpose-built to extract the content of a webpage that has been identified. Linkup's **Fetch** can be used as a stronger alternative to typical fetch tools because it can render JavaScript. Add `schema` when the caller needs typed JSON from that page rather than parsing markdown itself.

### The `schema` parameter

* Required to turn structured output on. `instructions` is optional.
* Must be a JSON Schema object (`type` `"object"`). Arrays as the root type are rejected.
* Field `description`s do the extraction work. Keep the schema shallow.
* `data` is omitted when `schema` is omitted. `markdown` is always returned.
* Missing fields are omitted from `data`, not set to `null` and not invented.
* `instructions` without `schema` returns a `400`.
* Do not use Search's `structuredOutputSchema` on **Fetch**.

### The Search → Fetch pattern

```python theme={"system"}
search = client.search(
    query="Datadog pricing tiers",
    depth="standard",
    output_type="searchResults",
)

for r in search.results[:3]:
    page = client.fetch(url=r.url, render_js=True)
    # feed page.markdown to your LLM, or pass schema to get page.data
```

Use **Search** to find candidate URLs and **Fetch** to retrieve them in full
when the agent needs to reason over the full page content rather than the
snippets returned by **Search**. When the next step is typed fields from a
chosen URL, call **Fetch** with `schema` instead of Search
`structuredOutputSchema`.

### Constraints

* **Fetch** supports HTML and PDF. Other binary URLs (ZIPs, images, videos) return a `400` error.
* **Fetch** returns a `400` error for HTML pages over 20 MB and PDFs over 100 MB.
* **Fetch** does not authenticate. It returns the response a logged-out visitor would see.
* Setting `extractImages` to `true` adds latency; enable it for workflows that consume image URLs.
* `includeRawHtml` should be `true` only when the raw HTML is required.
* **Fetch** does not follow links. For many rows from a listing page, use `/extract`.
* If structured extraction fails after a successful scrape, the call returns a `400` and is not billed.

## TypeScript notes

* Import: `import { LinkupClient } from 'linkup-sdk'`.
* Method: `await client.fetch({ url, mode, renderJs, schema, instructions })`. Single object argument.
* Field names are camelCase: `mode`, `renderJs`, `includeRawHtml`, `extractImages`, `schema`, `instructions`.
* If the installed SDK types omit `schema` / `instructions`, POST the JSON body to `/v1/fetch` directly.

## Links

* [Fetch overview](https://docs.linkup.so/pages/documentation/endpoints/fetch/overview.md)
* [Fetch best practices](https://docs.linkup.so/pages/documentation/endpoints/fetch/best-practices.md)
* [API reference](https://docs.linkup.so/pages/documentation/endpoints/fetch/reference.md)
* [OpenAPI spec](https://api.linkup.so/v1/openapi.json)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.