Skip to main content
This page is the shortest high-signal context dump for coding agents integrating TinyFish. Use it when you want one page that explains which API to call, which endpoint to hit, and where to go next for deeper reference.
For complete API reference in a single file, use llms-full.txt (218KB, includes all code examples). Note that llms.txt is just an index — agents should use llms-full.txt for full context.

Choose the Right TinyFish API

APIUse it whenCanonical endpointDocs
AgentYou want TinyFish to execute a goal on a real websitePOST https://agent.tinyfish.ai/v1/automation/run-sseAgent reference
SearchYou want ranked web results for a queryGET https://api.search.tinyfish.aiSearch overview
FetchYou want extracted page content from one or more URLsPOST https://api.fetch.tinyfish.aiFetch overview
BrowserYou want a remote browser session for direct Playwright/CDP controlPOST https://api.browser.tinyfish.aiBrowser overview

Quick Decision Tree

  • Need data from a URL? — Agent API (goal-based extraction) or Fetch API (raw page content)
  • Need search results? — Search API
  • Need browser control? — Browser API (direct Playwright/CDP access)

Expected Latency

APITypical LatencySuggested Timeout
Agent (sync)15-60s120s
Agent (SSE)15-60s (streaming)N/A (SSE)
Search1-3s10s
Fetchup to 30s per URL120s
Browser (create)10-30s60s

Authentication

All public REST APIs use the same X-API-Key header.
export TINYFISH_API_KEY="your_api_key_here"
Get a key from agent.tinyfish.ai/api-keys. See Authentication for the full setup and error handling details.

Minimum Viable Example (Python SDK)

from tinyfish import TinyFish, CompleteEvent

client = TinyFish()

with client.agent.stream(
    url="https://example.com",
    goal="Extract the page title. Return as JSON.",
) as stream:
    for event in stream:
        if isinstance(event, CompleteEvent):
            print(event.result_json)

Minimal Request Examples (cURL)

Agent

curl -N -X POST https://agent.tinyfish.ai/v1/automation/run-sse \
  -H "X-API-Key: $TINYFISH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://scrapeme.live/shop",
    "goal": "Extract the first 2 product names and prices. Return JSON."
  }'
curl "https://api.search.tinyfish.ai?query=web+automation+tools&location=US&language=en" \
  -H "X-API-Key: $TINYFISH_API_KEY"

Fetch

curl -X POST https://api.fetch.tinyfish.ai \
  -H "X-API-Key: $TINYFISH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"urls": ["https://www.tinyfish.ai/"]}'

Browser

curl -X POST https://api.browser.tinyfish.ai \
  -H "X-API-Key: $TINYFISH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://www.tinyfish.ai"}'

Prompting

Goal quality determines success rate. Vague goals like “get the data” fail; crafted goals with explicit fields, output format, and edge-case handling succeed consistently.
See the full Prompting Guide for tested patterns, templates, and examples.

Common Gotchas

  1. Browser API session creation takes 10-30s — set timeout=60 on your HTTP client.
  2. TypeScript needs "type": "module" in package.json for top-level await, or wrap code in async function main() { ... }; main().
  3. COMPLETED status does not mean the goal succeeded — always check result_json for failure signals like “captcha”, “blocked”, or “access denied”.
  4. Fetch API has a 30s per-URL backend timeout — set your client timeout to 120s for batch requests with multiple URLs.

Agent reference

Goal-based automation, endpoint choice, runs, profiles, and proxies

Authentication

API key setup and troubleshooting

Search overview

Search query parameters and result shape

Fetch overview

Fetch multiple URLs and choose output formats

Browser overview

Create a remote browser session and connect via CDP

Examples

Copy-paste examples for common workflows

llms-full.txt

Complete API reference in a single file (218KB)