Skip to main content
Run the blocks below in order in the same Bash shell with curl and jq installed. Set TELNYX_API_KEY to your API key locally before starting; do not put it in shared logs. All resource IDs and element refs below come from your actual responses.

Set Up Requests and Polling

wait_seconds limits the submission wait, not execution time. A 202 means the action is still queued or running; the helper polls until succeeded, failed, or unknown. It stops on failures and HTTP errors, including 503. See recovery guidance before repeating a request with an uncertain outcome.

Create a Session

Allow the example page and the IANA domains its link may navigate to, including subdomains:
Creation returns HTTP 201. Only a ready session accepts new actions. If it is closing, closed, failed, or expired, stop instead of retrying actions on it.

Observe and Select a Current Ref

The page currently has a link to IANA. Select the link from the returned refs rather than assuming an ID such as e13. Full observation refs are available only in the original successful POST response. GET polling returns metadata with empty refs. If the observe action needed polling, the bounded loop below requests a fresh observation after that action finishes. It never retries a click or other mutation.
If the page changes or no link ref is available, the script stops. Inspect a fresh observation instead of substituting a sample ref. For other pages, choose the intended element by its role and name.
Navigation invalidates the prior observation. Obtain a new observation before any further interaction by ref.

Screenshot and Download

download_url is a signed relative path. Prepend the API host and include Bearer authentication on the download request too. The screenshot remains downloadable until its artifact expiry; an expired download signature requires a fresh metadata request.

Close the Session

Closing a ready session normally returns closed and releases its resources. An already terminal session is returned unchanged. If an earlier step stopped, inspect the printed session ID and close the session when appropriate; otherwise it expires according to its lifetime or idle timeout.