SPHYNX
esc
  • Loading
Open console

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.

POST/v1/sessions/{id}/navigate

Returns 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 200 API 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"}'
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.

HTTPCodeWhen
400invalid_requestMalformed JSON, unknown field, bad value
401unauthorizedMissing or invalid API key
404session_not_foundNo such session for this key
404tab_not_foundNo such tab
409session_in_useAnother drive call has been running on this session for more than 3 s
410session_closedThe session has ended
422unsafe_urlNot http/https, or a private, loopback or link-local address
500internalOur fault. Send us the request_id
502navigation_failedDNS failure, connection refused, TLS error
504navigation_timeoutThe page did not reach wait_until in timeout_ms