Endpoints
Endpoint Method Returns Cancel support https://agent.tinyfish.ai/v1/automation/runPOSTFinal run result No https://agent.tinyfish.ai/v1/automation/run-asyncPOSTrun_id immediatelyYes https://agent.tinyfish.ai/v1/automation/run-ssePOSTSSE event stream Yes
All requests require the X-API-Key header. See Authentication .
Common Request Body
All three automation endpoints accept the same JSON body.
{
"url" : "https://example.com" ,
"goal" : "Find the pricing page and extract all plan details" ,
"browser_profile" : "lite" ,
"proxy_config" : {
"enabled" : true ,
"type" : "tetra" ,
"country_code" : "US"
}
}
Field Type Required Notes urlstringYes Target website URL to automate goalstringYes Natural-language instruction for the automation browser_profilelite | stealthNo Defaults to lite proxy_config.enabledbooleanNo Enables proxying for the run proxy_config.typetetra | customNo tetra uses TinyFish proxy infrastructure; custom requires your own proxy URLproxy_config.country_codeUS | GB | CA | DE | FR | JP | AUNo Used with type: "tetra" proxy_config.urlstringNo Required when type: "custom" proxy_config.usernamestringNo Custom proxy username proxy_config.passwordstringNo Custom proxy password
See Browser Profiles and Proxies for operational guidance.
POST /v1/automation/run
Use this endpoint when you want the final result in one blocking response.
{
"run_id" : "a1b2c3d4-e5f6-7890-abcd-ef1234567890" ,
"status" : "COMPLETED" ,
"started_at" : "2024-01-01T00:00:00Z" ,
"finished_at" : "2024-01-01T00:00:30Z" ,
"num_of_steps" : 5 ,
"result" : {
"product" : "iPhone 15" ,
"price" : "$799"
},
"error" : null
}
Field Type Notes run_idstring | nullUnique identifier for the run statusCOMPLETED | FAILEDFinal run state started_atstring | nullISO 8601 timestamp finished_atstring | nullISO 8601 timestamp num_of_stepsnumber | nullNumber of steps taken resultobject | nullExtracted JSON result errorobject | nullPresent only when the run failed
Runs created via /run cannot be cancelled.
POST /v1/automation/run-async
Use this endpoint when you want a run_id immediately and will fetch the full run later.
{
"run_id" : "a1b2c3d4-e5f6-7890-abcd-ef1234567890" ,
"error" : null
}
Field Type Notes run_idstring | nullCreated run ID errorobject | nullPresent only when run creation failed
Fetch the full run state later with GET /v1/runs/{id}.
POST /v1/automation/run-sse
Use this endpoint when you want a streaming event feed while the automation runs.
Possible SSE event types:
Event type Fields STARTEDtype, run_id, timestampSTREAMING_URLtype, run_id, streaming_url, timestampPROGRESStype, run_id, purpose, timestampHEARTBEATtype, timestampCOMPLETEtype, run_id, status, result?, error?, help_url?, help_message?, timestamp
Example stream:
data: {"type":"STARTED","run_id":"run_123","timestamp":"2025-01-01T00:00:00Z"}
data: {"type":"STREAMING_URL","run_id":"run_123","streaming_url":"https://...","timestamp":"..."}
data: {"type":"PROGRESS","run_id":"run_123","purpose":"Clicking submit button","timestamp":"..."}
data: {"type":"COMPLETE","run_id":"run_123","status":"COMPLETED","result":{...},"timestamp":"..."}
Reconnection: SSE streams do not support Last-Event-ID reconnection. If your client disconnects mid-stream, recover by polling GET /v1/runs/{run_id} until the run reaches a terminal status (COMPLETED, FAILED, or CANCELLED).
Raw HTTP (no SDK)
Parse SSE events directly without the TinyFish SDK:
import httpx
import json
url = "https://agent.tinyfish.ai/v1/automation/run-sse"
headers = { "x-api-key" : "sk-tinyfish-..." }
payload = { "url" : "https://example.com" , "goal" : "Extract the page title" }
with httpx.stream( "POST" , url, headers = headers, json = payload, timeout = 120 ) as response:
for line in response.iter_lines():
if line.startswith( "data: " ):
event = json.loads(line[ 6 :])
print ( f "Event: { event[ 'type' ] } " )
if event[ "type" ] == "COMPLETE" :
print ( f "Result: { event.get( 'result' , {}) } " )
GET /v1/runs/{id}
Use this endpoint to retrieve the current or final state of an async or streaming run.
Field Type Notes run_idstringUnique run identifier statusPENDING | RUNNING | COMPLETED | FAILED | CANCELLEDCurrent run state goalstringOriginal goal text created_atstringISO 8601 timestamp started_atstring | nullISO 8601 timestamp finished_atstring | nullISO 8601 timestamp num_of_stepsinteger | nullNumber of steps taken resultobject | nullExtracted JSON result errorobject | nullError details if failed streaming_urlstring | nullLive browser stream URL while running browser_configobject | nullProxy settings used for the run video_urlstring | nullPresigned run recording URL, if available stepsarrayRecorded step events for the run
error may include:
Field Type Notes codestringMachine-readable error code messagestringHuman-readable failure description categorySYSTEM_FAILURE | AGENT_FAILURE | BILLING_FAILURE | UNKNOWNError class retry_afternumber | nullSuggested retry delay in seconds help_urlstringTroubleshooting link help_messagestringHuman-readable guidance
POST /v1/runs/{id}/cancel
Only runs created via /run-async or /run-sse can be cancelled.
{
"run_id" : "a1b2c3d4-e5f6-7890-abcd-ef1234567890" ,
"status" : "CANCELLED" ,
"cancelled_at" : "2026-01-14T10:30:55Z" ,
"message" : null
}
Field Type Notes run_idstringRun identifier statusCANCELLED | COMPLETED | FAILEDActual status after the cancel attempt cancelled_atstring | nullISO 8601 timestamp messagestring | nullIdempotency or terminal-state message
Error Codes
Common HTTP-level errors across automation endpoints:
Status Meaning 400Invalid request body or missing required fields 401Missing or invalid API key 429Rate limit exceeded 500Internal server error
The COMPLETE SSE event or GET /v1/runs/{id} may also include run-level failures such as TASK_FAILED, SITE_BLOCKED, MAX_STEPS_EXCEEDED, TIMEOUT, or INSUFFICIENT_CREDITS.
Agent overview First request, endpoint selection, and goal-writing basics
Runs Statuses, polling, and lifecycle behavior
Goal prompting guide Improve automation reliability
Authentication API key setup and troubleshooting