ThinkRun

llms.txt

Examples

Complete workflows using the ThinkRun API.

Session Lifecycle

Create a session, navigate, take a screenshot, and clean up.

# 1. Create session
SESSION=$(curl -s -X POST https://api.thinkrun.ai/api/sessions \
  -H "x-api-key: $API_KEY" \
  -H "Content-Type: application/json" | jq -r '.sessionId')

# 2. Navigate
curl -X POST "https://api.thinkrun.ai/api/sessions/$SESSION/navigate" \
  -H "x-api-key: $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com"}'

# 3. Screenshot
curl -X POST "https://api.thinkrun.ai/api/sessions/$SESSION/screenshot" \
  -H "x-api-key: $API_KEY"

# 4. Terminate
curl -X DELETE "https://api.thinkrun.ai/api/sessions/$SESSION" \
  -H "x-api-key: $API_KEY"

Data Extraction

Navigate to a page and extract structured data with JavaScript.

# Navigate
curl -X POST "https://api.thinkrun.ai/api/sessions/$SESSION/navigate" \
  -H "x-api-key: $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://news.ycombinator.com"}'

# Extract titles using evaluate
curl -X POST "https://api.thinkrun.ai/api/sessions/$SESSION/evaluate" \
  -H "x-api-key: $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"script": "Array.from(document.querySelectorAll(".titleline a")).map(a => a.textContent)"}'

Form Automation

Fill out a form using individual browser control endpoints.

# Navigate to form
curl -X POST "https://api.thinkrun.ai/api/sessions/$SESSION/navigate" \
  -H "x-api-key: $API_KEY" -H "Content-Type: application/json" \
  -d '{"url": "https://example.com/contact"}'

# Fill fields
curl -X POST "https://api.thinkrun.ai/api/sessions/$SESSION/fill" \
  -H "x-api-key: $API_KEY" -H "Content-Type: application/json" \
  -d '{"selector": "input[name=name]", "value": "Jane Doe"}'

curl -X POST "https://api.thinkrun.ai/api/sessions/$SESSION/fill" \
  -H "x-api-key: $API_KEY" -H "Content-Type: application/json" \
  -d '{"selector": "input[name=email]", "value": "[email protected]"}'

# Submit
curl -X POST "https://api.thinkrun.ai/api/sessions/$SESSION/click" \
  -H "x-api-key: $API_KEY" -H "Content-Type: application/json" \
  -d '{"selector": "button[type=submit]"}'

AI Task Planning

Describe your goal in natural language and let the AI figure out the steps.

# Create task plan from text
curl -X POST https://api.thinkrun.ai/api/tasks/from-text \
  -H "x-api-key: $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Go to hacker news, find the top story, and take a screenshot",
    "sessionId": "'$SESSION'"
  }'

# Execute the plan (use planId from above)
curl -X POST "https://api.thinkrun.ai/api/tasks/PLAN_ID/execute" \
  -H "x-api-key: $API_KEY"

# Check status
curl "https://api.thinkrun.ai/api/tasks/PLAN_ID" \
  -H "x-api-key: $API_KEY"