Skip to content
easycaptcha.to
Documentation

Use AxiosClient for hCaptcha job requests

Choose the axios SDK backend, optionally inject an axios instance, and preserve raw responses and task-creation retry behavior.

Choose an explicit backend import

Install @easycaptcha-to/sdk and axios, then import AxiosClient from @easycaptcha-to/sdk/axios. The SDK loads the optional HTTP package only when needed, rather than making every supported HTTP backend a required dependency for all users.

The public methods remain createJob, getJob, sendFeedback, and getBalance. An existing application can therefore choose axios for its transport without changing how it distinguishes pending work from a completed result.

Inject an instance deliberately

import axios from "axios";
import { AxiosClient } from "@easycaptcha-to/sdk/axios";

const client = new AxiosClient({
  apiKey: process.env.EASYCAPTCHA_API_KEY,
  axios: axios.create(),
});
const balance = await client.getBalance();
console.log(balance.balance_microcents);

This construction example reads balance without creating paid work. When you add creation, use a typed request and retain the task ID. The fetch guide and full JavaScript example show the shared lifecycle.

A supplied instance may have interceptors or retry plugins from the rest of your application. Review them: an interceptor that rewrites response data can conflict with the SDK’s raw-byte handling, and retrying a failed creation POST can duplicate work. Network customization should not alter the meaning of the API contract.

Preserve error distinctions

The axios transport returns HTTP status and raw data to the superclass so common SDK code can interpret errors. Do not replace that flow with a rule that treats every HTTP 200 as a solved job. Pending and failed task snapshots require status handling after transport succeeds.

Timeout errors also need a separate policy. A creation timeout without an ID is an unknown server outcome, not a verified rejection. A lookup timeout can be followed by another lookup for the same known ID.

Keep account credentials out of instance-wide logs and avoid mixing browser cookies with customer-key calls. Test your actual axios instance against valid JSON, a structured API problem, a malformed response, and a rejected network request. These fixtures establish transport correctness before a live solver evaluation establishes useful outcomes.

Get started with easycaptcha

Build your next integration with easycaptcha.

Create an account, get your API key, and start submitting hCaptcha jobs. Use typed Python and JavaScript SDKs or integrate directly over HTTP.

Create an accountExplore the API

Prepaid credit. Check pricing before submitting paid tasks.