Skip to main content
The TinyFish Fetch API renders web pages using a real browser (including JavaScript-heavy sites) and returns clean extracted text in your preferred format. Submit a URL, get back structured content.
POST https://api.fetch.tinyfish.ai
api.fetch.tinyfish.ai is the public Fetch API endpoint.

Before You Start

1

Get your API key

Visit agent.tinyfish.ai/api-keys and create a key. Store it in your environment:
export TINYFISH_API_KEY="your_api_key_here"
All requests require the X-API-Key header. See Authentication for the full setup and troubleshooting guide.

Your First Request

import httpx

response = httpx.post(
    "https://api.fetch.tinyfish.ai",
    headers={"X-API-Key": "your_api_key_here"},
    json={"urls": ["https://www.tinyfish.ai/"]},
)

data = response.json()
print(data["results"][0]["title"])
print(data["results"][0]["text"])

What Success Looks Like

{
  "results": [
    {
      "url": "https://www.tinyfish.ai/",
      "final_url": "https://www.tinyfish.ai/",
      "title": "TinyFish | Enterprise Web Agent Infrastructure",
      "description": "TinyFish provides enterprise infrastructure for AI web agents.",
      "language": "en",
      "text": "# TinyFish | Enterprise Web Agent Infrastructure\n\nTinyFish provides enterprise infrastructure for AI web agents...\n"
    }
  ],
  "errors": []
}

When to Use Fetch vs the Other APIs

  • Use Fetch when you already know the URL and need clean extracted page content.
  • Use Search when you need help finding the right URLs first.
  • Use Agent when TinyFish should perform a multi-step workflow on the site.
  • Use Browser when you need direct browser control from your own code.

Fetching Multiple URLs

Submit up to 10 URLs in a single request. Each URL is processed independently — one failure doesn’t affect the others.
response = httpx.post(
    "https://api.fetch.tinyfish.ai",
    headers={"X-API-Key": "your_api_key_here"},
    json={
        "urls": [
            "https://www.tinyfish.ai/",
            "https://en.wikipedia.org/wiki/Web_scraping",
            "https://docs.python.org/3/tutorial/index.html",
        ]
    },
)

data = response.json()
for result in data["results"]:
    print(result["url"], "→", result["title"])

for error in data["errors"]:
    print("Failed:", error["url"], "–", error["error"])
Per-URL failures (timeouts, DNS errors, anti-bot blocks) appear in errors[] alongside a 200 response — they do not cause the entire request to fail.

Output Formats

Control the format of the text field with the format parameter. When omitted, the default is markdown.
Semantic HTML.
{
  "format": "html",
  "text": "<h1>Async Fn in Traits Are Now Available</h1>
<p>Starting with Rust 1.75, you can use <code>async fn</code> directly inside traits.</p>
<h2>What Changed</h2>
<ul>
<li>Works in all stable traits</li>
<li>No heap allocation for simple cases</li>
</ul>"
}

Proxies

To route fetch requests through a specific country, pass a proxy_config object with a country_code.
{
  "urls": ["https://example.com"],
  "proxy_config": {
    "country_code": "US"
  }
}
This is useful for accessing geo-restricted content or testing region-specific page variations. See Proxies for supported country codes and details.

API Reference

Full request and response schema

Authentication

API key setup

Proxies

Route requests through specific countries

For coding agents

One page that routes an agent to the right TinyFish API