Test the CAPTCHA API with HTTPie

By solvethree3 min read

Use HTTPie to create one task, save its ID, then retrieve that same task. Record a requestId before the POST so a connection timeout doesn't force you to create another logical task.

On this page

Prepare the request

  • Install HTTPie and jq, and run the example in Bash. These commands use HTTPie's http executable, not curl or a shell alias for curl.
  • Set the environment variable SOLVETHREE_API_KEY to your workspace API key. Run this on a trusted machine; keep the key out of browser code.
  • Configure an active profile for your target hostname in the console. Sending a hostname and action doesn't create a profile. See site profile setup.
  • Replace the example hostname, action, and proxy URL. Use an HTTP or HTTPS proxy URL without a path, query, or fragment.
  • Replace the requestId placeholder with a unique ID for this logical task: 1–64 ASCII letters, numbers, underscores, or hyphens. Save it before sending the request.

The request is for reCAPTCHA Enterprise: recaptchaType defaults to enterprise-v3. It needs site, action, and exactly one of proxy or proxyCandidates; this example uses one proxy. Don't add type or url fields.

Create the task and save its ID

HTTPie · create one task and retrieve it
set -eu
umask 077
# Install HTTPie and jq. Keep the same request.json for recovery.
cat > request.json <<'JSON'
{
  "site": "accounts.example.com",
  "action": "login",
  "proxy": "http://USER:PASSWORD@PROXY:PORT",
  "requestId": "replace-with-one-unique-logical-task-id"
}
JSON
# This file contains proxy credentials; keep it private.
http --check-status --timeout=30 POST https://api.solvethree.com/v1/tasks \
  Authorization:"Bearer $SOLVETHREE_API_KEY" waitMs==0 < request.json > task.json
TASK_ID=$(jq -r '.id' task.json)
http --check-status --timeout=30 GET "https://api.solvethree.com/v1/tasks/$TASK_ID" \
  Authorization:"Bearer $SOLVETHREE_API_KEY" waitMs==15000
# pending/solving: retrieve the same ID again, within a finite deadline.
# ready: use solution. failed: stop and inspect errorCode/error.
# A timed-out POST is recovered with the unchanged file and requestId.

The quoted JSON strings go into request.json, which HTTPie reads from stdin. The Authorization header sends your key using Bearer authentication. Keep request.json private because it contains proxy credentials.

waitMs==0 and waitMs==15000 are HTTPie query parameters, not JSON body fields. The POST requests no wait; the GET uses a 15,000 ms wait. HTTPie's separate --timeout=30 sets a 30-second client timeout.

The POST response is saved to task.json, and jq extracts its id for the GET. Run the commands in order. set -eu stops the script if HTTPie reports a failure, before an incomplete response can be used for retrieval.

HTTP success isn't task readiness

--check-status catches unsuccessful HTTP responses. Handle those before treating the body as a successful task response. A successful HTTP request can still return an unfinished or failed task; read the JSON status next.

What to do with the task status
What to do with the task status
StatusNext action
pending or solvingRetrieve the same task ID again, within a finite deadline you choose. Don't create another task just because this one isn't ready.
readyUse the returned solution. This is the only status with a usable solution.
failedStop polling and inspect errorCode and error. Failed solves are refunded; don't blindly retry unchanged invalid inputs.

The example performs one retrieval, not a polling loop. When you submit a ready solution to its intended target, use the returned userAgent and secChUa with the successful proxy. Ready means solvethree generated a solution—not that your application request succeeded.

Recover a timed-out POST

A client timeout doesn't prove task creation failed. If you already have the task ID, retrieve it. If the POST timed out before you received an ID, rerun the POST with the unchanged request.json, including its original requestId. The same ID and task inputs return the existing task.

Don't extract an ID from an empty or incomplete task.json; recover the POST first. Don't change the proxy, action, or other task inputs while reusing that requestId—different inputs conflict. Use a new requestId only when you intend to create a new logical task.

Run your first task.

Start with $5 in workspace credit.

Create a workspace