API reference
Navigate
Load a URL in a session and get the final address, title and HTTP status.
Navigate loads a page and waits for it. The call returns when the page reaches wait_until, or fails when timeout_ms passes first.
Navigate
POST/v1/sessions/{id}/navigateReturns 200 when the page loaded, whatever status the site answered with. Check http_status in the response.
Path
- idstringrequired
The session to drive.
Body
- urlstring, http or httpsrequired
The address to load.
- wait_untilload or domcontentloadeddefaultload
The page event to wait for.
- timeout_msint, ≤60000default30000
How long to wait for
wait_until. - tab_idstringdefaultthe active tab
The tab to load the page in. It is brought to the front first.
Response
- urlstring
The address of the page after redirects.
- titlestring
The title of the page.
- http_statusint
The status of the main document. A 403 or 404 page is still a
200API response. - redirectedbool
Whether the navigation was redirected.
curl -s -X POST \
"$SPHYNX_URL/v1/sessions/$SESSION/navigate" \
-H "Authorization: Bearer $SPHYNX_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://news.ycombinator.com"}'const res = await fetch(`${process.env.SPHYNX_URL}/v1/sessions/${sessionId}/navigate`, {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.SPHYNX_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ url: "https://news.ycombinator.com" }),
});
const page = await res.json();import os
import requests
res = requests.post(
f"{os.environ['SPHYNX_URL']}/v1/sessions/{session_id}/navigate",
headers={"Authorization": f"Bearer {os.environ['SPHYNX_API_KEY']}"},
json={"url": "https://news.ycombinator.com"},
timeout=60,
)
page = res.json()200
{
"url": "https://news.ycombinator.com/",
"title": "Hacker News",
"http_status": 200,
"redirected": false
}Body · every field
{
"url": "https://news.ycombinator.com",
"wait_until": "domcontentloaded",
"timeout_ms": 15000,
"tab_id": "TAB_ID"
}Errors
The shape is the same as everywhere else: see Errors.
| HTTP | Code | When |
|---|---|---|
| 400 | invalid_request | Malformed JSON, unknown field, bad value |
| 401 | unauthorized | Missing or invalid API key |
| 404 | session_not_found | No such session for this key |
| 404 | tab_not_found | No such tab |
| 409 | session_in_use | Another drive call has been running on this session for more than 3 s |
| 410 | session_closed | The session has ended |
| 422 | unsafe_url | Not http/https, or a private, loopback or link-local address |
| 500 | internal | Our fault. Send us the request_id |
| 502 | navigation_failed | DNS failure, connection refused, TLS error |
| 504 | navigation_timeout | The page did not reach wait_until in timeout_ms |