Reference

Insomnia REST Client for CaptchaAI API Development

Insomnia provides a clean interface for testing API endpoints without writing code. Setting up a CaptchaAI workspace in Insomnia lets you test task submission, poll for results, check balances, and debug issues — all before writing your integration code.

Setting Up the Workspace

Create a CaptchaAI Workspace

  1. Open Insomnia
  2. Click CreateDesign Document or Request Collection
  3. Name it "CaptchaAI API"

Configure Environment Variables

Use Insomnia's environment system to avoid hardcoding values:

  1. Click the environment dropdown (top-left)
  2. Select Manage Environments
  3. Add a Base Environment with shared values:
{
  "base_url": "https://ocr.captchaai.com",
  "api_key": "YOUR_API_KEY"
}
  1. Create Sub Environments for different configurations:

Development:

{
  "test_sitekey": "6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI",
  "test_pageurl": "https://www.google.com/recaptcha/api2/demo"
}

Production:

{
  "test_sitekey": "YOUR_PRODUCTION_SITEKEY",
  "test_pageurl": "https://your-target-site.com"
}

Reference variables with {{ base_url }} and {{ api_key }} in your requests.

Core API Requests

1. Check Balance

Field Value
Method GET
URL {{ base_url }}/res.php

Query Parameters:

Key Value
key {{ api_key }}
action getbalance
json 1

Expected Response:

{
  "status": 1,
  "request": "12.3456"
}

2. Submit reCAPTCHA v2 Task

Field Value
Method POST
URL {{ base_url }}/in.php
Body Form URL Encoded

Form Parameters:

Key Value
key {{ api_key }}
method userrecaptcha
googlekey {{ test_sitekey }}
pageurl {{ test_pageurl }}
json 1

Expected Response:

{
  "status": 1,
  "request": "TASK_ID_HERE"
}

3. Poll for Result

Field Value
Method GET
URL {{ base_url }}/res.php

Query Parameters:

Key Value
key {{ api_key }}
action get
id (paste task ID from step 2)
json 1

Expected Responses:

Processing:

{
  "status": 0,
  "request": "CAPCHA_NOT_READY"
}

Complete:

{
  "status": 1,
  "request": "03AGdBq24PBCb..."
}

4. Submit Cloudflare Turnstile Task

Key Value
key {{ api_key }}
method turnstile
sitekey TURNSTILE_SITEKEY
pageurl https://target-site.com
json 1

5. Submit Image CAPTCHA Task

Field Value
Method POST
URL {{ base_url }}/in.php
Body Form URL Encoded
Key Value
key {{ api_key }}
method base64
body (base64 encoded image)
json 1

Request Chaining

Insomnia supports response references, letting you chain the submit → poll workflow:

Step 1: Tag the Submit Response

After sending the submit request, note the response. You can reference it in subsequent requests.

Step 2: Use Response Reference in Poll

In the poll request's id parameter:

  1. Press Ctrl+Space in the value field
  2. Select Response → Body Attribute
  3. Configure: - Request: Select the submit request - Filter: $.request (JSONPath to extract the task ID) - Trigger Behavior: "When Expired" or "Always"

Now sending the poll request automatically uses the task ID from the most recent submit response.

Request Folders

Organize your workspace with folders:

CaptchaAI API/
├── Account/
│   └── Check Balance
├── reCAPTCHA/
│   ├── Submit v2 Task
│   ├── Submit v3 Task
│   ├── Submit Enterprise Task
│   └── Poll Result
├── Cloudflare/
│   ├── Submit Turnstile Task
│   └── Poll Result
├── Image/
│   ├── Submit Base64 Image
│   └── Poll Result
└── hCaptcha/
    ├── Submit hCaptcha Task
    └── Poll Result

Testing Different CAPTCHA Types

Request Template for Each Type

CAPTCHA Type method Value Key Parameter Extra Parameters
reCAPTCHA v2 userrecaptcha googlekey
reCAPTCHA v3 userrecaptcha googlekey version=v3, action=verify, min_score=0.3
reCAPTCHA Enterprise userrecaptcha googlekey enterprise=1
Cloudflare Turnstile turnstile sitekey
hCaptcha hcaptcha sitekey
Image/OCR base64 body

Response Validation

Insomnia doesn't have built-in test assertions, but you can validate responses visually:

Success Indicators

Response Field Success Value Error Indicator
HTTP Status 200 403, 429, 500
status 1 0
request (submit) Numeric task ID ERROR_* string
request (poll) Token string CAPCHA_NOT_READY or ERROR_*

Common Error Responses

Error Meaning Fix in Insomnia
ERROR_WRONG_USER_KEY Invalid API key Check {{ api_key }} in environment
ERROR_KEY_DOES_NOT_EXIST API key not found Verify key in environment settings
ERROR_ZERO_BALANCE No funds Top up account
ERROR_NO_SLOT_AVAILABLE Server busy Resend request after a few seconds
ERROR_CAPTCHA_UNSOLVABLE Challenge couldn't be solved Check parameters — wrong sitekey or pageurl
ERROR_WRONG_CAPTCHA_ID Invalid task ID Resubmit the task and use the new ID

Sharing with Your Team

Export the Collection

  1. Right-click the workspace
  2. Select Export Data
  3. Choose format: Insomnia v4 (JSON) or HAR
  4. Remove API keys from the exported file before sharing

Using Git Sync

Insomnia supports Git integration:

  1. Open workspace settings
  2. Configure Git repository
  3. Commit and push your request collection
  4. Team members clone and use their own environment variables (with their own API keys)

Security note: Never commit environment files containing real API keys to shared repositories. Use Insomnia's private environments or .gitignore the environment file.

Insomnia vs Postman for CaptchaAI

Feature Insomnia Postman
Interface Minimal, focused Feature-rich, more complex
Response chaining Response references Collection variables + scripts
Environment variables Sub-environments Environments + globals
Test scripts Plugin-based Built-in JavaScript test runner
Team sharing Git sync or export Cloud workspaces
Price Free (core features) Free (limited), paid for teams
Offline use Full functionality Limited without cloud sync

Troubleshooting

Issue Cause Fix
Environment variable not resolving Variable name mismatch Check spelling — variables are case-sensitive
Request chaining returns old task ID Cached response reference Set trigger behavior to "Always" instead of "When Expired"
SSL Error when connecting Corporate proxy or firewall Settings → toggle "Validate certificates" off (dev only)
POST body not sending correctly Wrong body type selected Ensure "Form URL Encoded" is selected, not "JSON"
Base64 image too large for form field Image exceeds URL-encoded body limits Use multipart form data for large images

FAQ

Can I automate Insomnia to run CaptchaAI tests on a schedule?

Not directly. Insomnia is primarily an interactive tool. For automated testing, export your requests as cURL commands and run them in a CI/CD pipeline, or use a dedicated test framework with CaptchaAI's API.

Does Insomnia support WebSocket connections for CaptchaAI?

CaptchaAI uses standard HTTP REST endpoints (not WebSockets), so Insomnia's HTTP client covers all CaptchaAI API interactions. No WebSocket support is needed.

How do I handle the polling delay in Insomnia?

Manually — send the poll request, check if it returns CAPCHA_NOT_READY, wait a few seconds, then send again. For automated polling, use code instead of Insomnia.

Next Steps

Set up your Insomnia workspace to test the CaptchaAI API before building your integration — get your API key to start.

Related guides:

Discussions (0)

No comments yet.