Store an application Agent key in TOOLUSE_API_KEY. Session creation is a write and may incur browser usage; choose a bounded timeout and release the session when done.
curl -X POST "https://api.tooluse.net/v1/browsers/sessions" \
-H "Authorization: Bearer $TOOLUSE_API_KEY" \
-H "Idempotency-Key: tooluse-example-001" \
-H "Content-Type: application/json" \
-d '{"timeout":300,"browserSettings":{"viewport":{"width":1280,"height":720}}}'
The response contains id, status, connection URLs and session properties. Save id as SESSION_ID. Reuse the exact idempotency key and request body to reconcile the same create; changed input under that key returns a conflict. A new intended session needs a new key. The default timeout is 3600 seconds; accepted values are 60 through 21600 seconds.
Capacity refusal returns 429; insufficient platform credit returns 402. Read the response before deciding what to do next.
curl -X POST "https://api.tooluse.net/v1/browsers/sessions/$SESSION_ID" \
-H "Authorization: Bearer $TOOLUSE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"status":"REQUEST_RELEASE"}'