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.MCP Server (Recommended for AI Assistants)
If you’re running inside an MCP-compatible host (Codex, Claude Code, Claude Desktop, Cursor, Windsurf, ChatGPT), connect via MCP instead of the REST API — no API key management needed, OAuth handles auth automatically.- Codex
- Claude Code
- ChatGPT
Install the SDK
Fetch: backend timeout is 110s per URL; requests are also subject to a 120s CDN ceiling. Set client timeout to 150s to receive timeout errors cleanly.
Authentication
Set your API key (get one from agent.tinyfish.ai/api-keys):TINYFISH_API_KEY from the environment automatically. See Authentication for more details.
Choose the Right TinyFish API
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)
- Need logged-in state across recurring runs? — Create a Browser Context Profile, then run with
use_profile: true
Authenticated or Recurring Runs
When a task should reuse a login session, use Browser Context Profiles first. Do not make the agent log in from scratch every run unless the task explicitly needs a fresh browser. Browser Context Profiles are saved browser state for a site or account. They are different frombrowser_profile: "lite" | "stealth", which only chooses the browser runtime mode.
1
Create and set up a profile
Use the Browser Context Profiles API to create a profile, start a setup session, connect to
cdp_url with Playwright/Puppeteer/CDP, sign in, and save with session_id. The dashboard setup UI is a manual helper.2
Run with saved state
Pass
use_profile: true to use the default profile, or add profile_id for a specific profile.3
Repair stale sessions with Vault
For long-lived workflows, pair profiles with
use_vault: true so TinyFish can sign in again when cookies expire.use_profile: true uses the default Browser Context Profile. Use profile_id when the user names a specific Browser Context Profile; profile_id requires use_profile: true:
SDK Examples
Agent — Streaming (Recommended)
Agent — Synchronous
Search
recency_minutes for a freshness window, after_date / before_date for calendar date filters, and domain_type for content category:
recency_minutes: integer1..5256000after_date/before_date:YYYY-MM-DDdomain_type:"web"(default) |"news"|"research_paper"pub_year_min/pub_year_max: integer0..9999, inclusive; only supported fordomain_type=research_paper- do not combine
recency_minuteswith date filters - if both dates are present,
after_date <= before_date - if both pub_year bounds are present,
pub_year_min <= pub_year_max after_date,before_date, andrecency_minutesare not supported fordomain_type=research_paper— usepub_year_min/pub_year_maxinstead
Fetch
ttl for the default cache behavior. Add ttl only when freshness matters: set it to 0 when you want a live fetch, or to a positive number of seconds to accept cached entries younger than that window.
Anti-Detection Mode
For sites with bot protection, add stealth mode and a proxy:Expected Latency
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.Common Gotchas
- Browser API session creation takes 10-30s — set
timeout=60on your HTTP client. - TypeScript needs
"type": "module"inpackage.jsonfor top-levelawait, or wrap code inasync function main() { ... }; main(). COMPLETEDstatus does not mean the goal succeeded — always checkresult_jsonfor failure signals like “captcha”, “blocked”, or “access denied”.- Fetch API has a 110s per-URL backend timeout — requests are also subject to a 120s CDN ceiling for the full batch. Set your client timeout to at least 150s.
Raw API Endpoints (cURL)
Raw API Endpoints (cURL)
What to Read Next
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)