Quickstart

Get started

Get an API key and send your first request in about two minutes, with examples in cURL, Python, Node.js and Go.

On this page

This guide creates a text captcha job and fetches the answer. You need a Solvecha account, an API key and a picture of a text captcha saved as captcha.png.

  1. Create an account and copy your key. Register, then open the dashboard. Your key starts with slv_.
  2. Confirm your e-mail address. The free tier starts as soon as it is confirmed: 100 successful solves per UTC day, no card. Need more? Top up a balance ($0.20 per 1,000 solves) or pick a monthly plan in the dashboard. See Plans and billing.
  3. Send a request. The base URL is https://api.solvecha.com. Send your key in the Authorization header.
  4. Fetch the answer. The first response only holds a job id. Ask for the answer about once per second.

#Your first request

This request creates a job:

cURL

cURL
KEY=YOUR_API_KEY
IMG=$(base64 -w0 captcha.png)

curl -X POST "https://api.solvecha.com/v1/recognition/textcaptcha" \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d "{\"image_data\": [\"$IMG\"]}"

# {"data": "1234567"}

Python

Python
import base64
import requests

headers = {"Authorization": "Bearer YOUR_API_KEY"}
with open("captcha.png", "rb") as f:
    image = base64.b64encode(f.read()).decode()

job = requests.post(
    "https://api.solvecha.com/v1/recognition/textcaptcha",
    headers=headers,
    json={"image_data": [image]},
).json()
print(job)  # {"data": "1234567"}

Node.js

Node.js
import { readFile } from "node:fs/promises";

const headers = { Authorization: "Bearer YOUR_API_KEY", "Content-Type": "application/json" };
const image = (await readFile("captcha.png")).toString("base64");

const job = await fetch("https://api.solvecha.com/v1/recognition/textcaptcha", {
  method: "POST",
  headers,
  body: JSON.stringify({ image_data: [image] }),
}).then((r) => r.json());
console.log(job); // { data: "1234567" }

Go

Go
package main

import (
	"encoding/base64"
	"encoding/json"
	"fmt"
	"net/http"
	"os"
	"strings"
)

func main() {
	raw, err := os.ReadFile("captcha.png")
	if err != nil {
		panic(err)
	}
	payload, _ := json.Marshal(map[string]any{"image_data": []string{base64.StdEncoding.EncodeToString(raw)}})

	req, _ := http.NewRequest("POST", "https://api.solvecha.com/v1/recognition/textcaptcha", strings.NewReader(string(payload)))
	req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
	req.Header.Set("Content-Type", "application/json")
	resp, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()

	var job struct {
		Data string `json:"data"`
	}
	_ = json.NewDecoder(resp.Body).Decode(&job)
	fmt.Println(job.Data) // 1234567
}

#Fetch the answer

Send a GET request to the same type path with the job id. While the job runs, you get HTTP status 409 and error 14. Try again after one second.

cURL

cURL
curl "https://api.solvecha.com/v1/recognition/textcaptcha?id=1234567" \
  -H "Authorization: Bearer YOUR_API_KEY"

# {"data": ["K7m2Q"]}

Python

Python
import time

for _ in range(30):
    time.sleep(1)
    r = requests.get(
        "https://api.solvecha.com/v1/recognition/textcaptcha",
        headers=headers,
        params={"id": job["data"]},
    )
    if r.status_code == 409:  # error 14: not ready yet
        continue
    r.raise_for_status()
    print(r.json()["data"])  # ["K7m2Q"]
    break

Node.js

Node.js
for (let i = 0; i < 30; i++) {
  await new Promise((resolve) => setTimeout(resolve, 1000));
  const res = await fetch(`https://api.solvecha.com/v1/recognition/textcaptcha?id=${job.data}`, { headers });
  if (res.status === 409) continue; // error 14: not ready yet
  console.log((await res.json()).data); // ["K7m2Q"]
  break;
}

Go

Go
for i := 0; i < 30; i++ {
	time.Sleep(time.Second)
	req, _ := http.NewRequest("GET", "https://api.solvecha.com/v1/recognition/textcaptcha?id="+job.Data, nil)
	req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
	resp, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	body, _ := io.ReadAll(resp.Body)
	resp.Body.Close()
	if resp.StatusCode == 409 { // error 14: not ready yet
		continue
	}
	fmt.Println(string(body)) // {"data":["K7m2Q"]}
	break
}

For the Go loop, add io and time to the imports.

#Next steps

Solvecha is an independent service. It is not affiliated with NopeCHA, 2Captcha, CapSolver, Google or CloakHQ. Their names describe compatibility or recommendations only. Figures come from our own tests, see the compare page.

    ↑↓ to moveEnter to open