Explainers

CaptchaAI JSON API vs Form API: Which Format to Use

CaptchaAI accepts requests in both form-encoded and JSON formats. Both work identically — choose based on your language and preferences.


Side-by-Side Comparison

Form-Encoded (Default)

import requests

resp = requests.post("https://ocr.captchaai.com/in.php", data={
    "key": "YOUR_API_KEY",
    "method": "userrecaptcha",
    "googlekey": "SITE_KEY",
    "pageurl": "https://example.com",
    "json": 1,
})

Content-Type: application/x-www-form-urlencoded

JSON

import requests

resp = requests.post("https://ocr.captchaai.com/in.php", json={
    "key": "YOUR_API_KEY",
    "method": "userrecaptcha",
    "googlekey": "SITE_KEY",
    "pageurl": "https://example.com",
    "json": 1,
})

Content-Type: application/json


Key Differences

Factor Form-Encoded JSON
Content-Type application/x-www-form-urlencoded application/json
Data structure Flat key-value pairs Nested objects possible
Binary data Use multipart for file upload Base64 encode in body field
Array support Limited Native
Python keyword data={} json={}
Node.js URLSearchParams JSON.stringify()
Readability Simple for flat params Better for complex data
Compatibility Works everywhere Works everywhere

Response Format

Add json=1 to get JSON responses regardless of request format:

# Without json=1 — plain text response
resp = requests.post("https://ocr.captchaai.com/in.php", data={
    "key": "YOUR_API_KEY",
    "method": "userrecaptcha",
    "googlekey": "SITE_KEY",
    "pageurl": "https://example.com",
})
# Response: "OK|12345678"

# With json=1 — JSON response
resp = requests.post("https://ocr.captchaai.com/in.php", data={
    "key": "YOUR_API_KEY",
    "method": "userrecaptcha",
    "googlekey": "SITE_KEY",
    "pageurl": "https://example.com",
    "json": 1,
})
# Response: {"status": 1, "request": "12345678"}

Always use json=1 for easier parsing.


Python Examples

Form-Encoded

import requests

# Submit
resp = requests.post("https://ocr.captchaai.com/in.php", data={
    "key": "YOUR_API_KEY",
    "method": "userrecaptcha",
    "googlekey": "SITE_KEY",
    "pageurl": "https://example.com",
    "json": 1,
})
task_id = resp.json()["request"]

# Poll (always GET with query params)
resp = requests.get("https://ocr.captchaai.com/res.php", params={
    "key": "YOUR_API_KEY",
    "action": "get",
    "id": task_id,
    "json": 1,
})

JSON Body

import requests

# Submit with JSON
resp = requests.post("https://ocr.captchaai.com/in.php", json={
    "key": "YOUR_API_KEY",
    "method": "userrecaptcha",
    "googlekey": "SITE_KEY",
    "pageurl": "https://example.com",
    "json": 1,
})
task_id = resp.json()["request"]

# Poll (same as form-encoded — GET with params)
resp = requests.get("https://ocr.captchaai.com/res.php", params={
    "key": "YOUR_API_KEY",
    "action": "get",
    "id": task_id,
    "json": 1,
})

Node.js Examples

Form-Encoded

const axios = require('axios');
const qs = require('querystring');

// Submit
const resp = await axios.post(
  'https://ocr.captchaai.com/in.php',
  qs.stringify({
    key: 'YOUR_API_KEY',
    method: 'userrecaptcha',
    googlekey: 'SITE_KEY',
    pageurl: 'https://example.com',
    json: 1,
  })
);
const taskId = resp.data.request;

JSON Body

const axios = require('axios');

// Submit with JSON
const resp = await axios.post(
  'https://ocr.captchaai.com/in.php',
  {
    key: 'YOUR_API_KEY',
    method: 'userrecaptcha',
    googlekey: 'SITE_KEY',
    pageurl: 'https://example.com',
    json: 1,
  }
);
const taskId = resp.data.request;

Image CAPTCHA: Form vs JSON

For image CAPTCHAs, the format matters more:

Form with File Upload (Multipart)

# File upload — form-encoded with multipart
resp = requests.post("https://ocr.captchaai.com/in.php",
    data={
        "key": "YOUR_API_KEY",
        "method": "post",
        "json": 1,
    },
    files={
        "file": open("captcha.png", "rb"),
    },
)

JSON with Base64

import base64

# Base64 in JSON body
with open("captcha.png", "rb") as f:
    body = base64.b64encode(f.read()).decode()

resp = requests.post("https://ocr.captchaai.com/in.php", json={
    "key": "YOUR_API_KEY",
    "method": "base64",
    "body": body,
    "json": 1,
})

Form with Base64

# Base64 in form data
resp = requests.post("https://ocr.captchaai.com/in.php", data={
    "key": "YOUR_API_KEY",
    "method": "base64",
    "body": body,
    "json": 1,
})

When to Use Which

Scenario Recommended Why
Simple scripts Form-encoded Simpler, fewer dependencies
REST API integration JSON Matches typical API patterns
File uploads Multipart form Direct binary upload
Large base64 images Form-encoded Better handling of large payloads
TypeScript/modern JS JSON Native object support
Legacy system integration Form-encoded Universal compatibility
Migrating from 2Captcha Form-encoded Same format as 2Captcha

Common Mistakes

Mistake Problem Fix
Using json={} but no json: 1 in data Response is plain text Include "json": 1 in the data
Mixing data= and json= in Python requests Request malformed Use one or the other
Forgetting Content-Type header Server can't parse body Let your HTTP library set it automatically
Sending JSON body to poll endpoint Poll uses GET params Always use GET with query params for /res.php

FAQ

Does the format affect solving speed or accuracy?

No. Both formats produce identical results. The server processes them the same way.

Can I mix formats in the same project?

Yes. You can submit with JSON and poll with query params (which is how polling always works). Each request is independent.

Which format is used by the 2Captcha-compatible API?

The original 2Captcha API uses form-encoded. CaptchaAI adds JSON support on top. If you're migrating from 2Captcha, stick with form-encoded.



Choose your preferred format — try CaptchaAI API today.

Discussions (0)

No comments yet.

Related Posts

Comparisons Migrate from Anti-Captcha to CaptchaAI Step by Step
Step-by-step guide to migrate from Anti-Captcha's custom JSON API to Captcha AI's 2 Captcha-compatible format.

Step-by-step guide to migrate from Anti-Captcha's custom JSON API to Captcha AI's 2 Captcha-compatible format....

Automation Python All CAPTCHA Types
Mar 16, 2026
Reference Migrate from EndCaptcha to CaptchaAI: API Mapping Guide
Map End Captcha API calls to Captcha AI equivalents — endpoint changes, parameter differences, code examples, and a step-by-step migration plan.

Map End Captcha API calls to Captcha AI equivalents — endpoint changes, parameter differences, code examples,...

Automation Python All CAPTCHA Types
Jan 20, 2026
Reference Migrate from AZCaptcha to CaptchaAI: Complete Guide
Step-by-step migration from AZCaptcha to Captcha AI — endpoint mapping, parameter differences, code changes, and parallel testing for a safe transition.

Step-by-step migration from AZCaptcha to Captcha AI — endpoint mapping, parameter differences, code changes, a...

Automation Python All CAPTCHA Types
Feb 09, 2026
Comparisons Token-Based vs Cookie-Based CAPTCHA Solving
Understand the difference between token-based and cookie-based CAPTCHA solving — when to use each approach, how they work, and implementation examples.

Understand the difference between token-based and cookie-based CAPTCHA solving — when to use each approach, ho...

Automation Python All CAPTCHA Types
Jan 25, 2026
Comparisons Parallel vs Sequential CAPTCHA Solving: Performance Trade-offs
Compare parallel and sequential CAPTCHA solving approaches — throughput, resource usage, cost, and complexity trade-offs with Captcha AI examples.

Compare parallel and sequential CAPTCHA solving approaches — throughput, resource usage, cost, and complexity...

Automation Python All CAPTCHA Types
Feb 01, 2026
Reference Migrate from NextCaptcha to CaptchaAI: Complete Guide
Migrate from Next Captcha to Captcha AI — endpoint mapping, parameter translation, code examples in Python and Java Script, and a parallel testing strategy.

Migrate from Next Captcha to Captcha AI — endpoint mapping, parameter translation, code examples in Python and...

Automation Python All CAPTCHA Types
Jan 30, 2026
Comparisons Migrate from CapSolver to CaptchaAI Step by Step
Step-by-step guide to migrate from Cap Solver to Captcha AI.

Step-by-step guide to migrate from Cap Solver to Captcha AI. API differences, code examples, and why Captcha A...

Automation Python All CAPTCHA Types
Feb 23, 2026
Comparisons Migrate from 2Captcha to CaptchaAI Step by Step
Complete step-by-step migration guide from 2 Captcha to Captcha AI.

Complete step-by-step migration guide from 2 Captcha to Captcha AI. Same API format — change the URL and API k...

Automation Python All CAPTCHA Types
Feb 23, 2026
DevOps & Scaling Ansible Playbooks for CaptchaAI Worker Deployment
Deploy and manage Captcha AI workers with Ansible — playbooks for provisioning, configuration, rolling updates, and health checks across your server fleet.

Deploy and manage Captcha AI workers with Ansible — playbooks for provisioning, configuration, rolling updates...

Automation Python All CAPTCHA Types
Apr 07, 2026
DevOps & Scaling Blue-Green Deployment for CAPTCHA Solving Infrastructure
Implement blue-green deployments for CAPTCHA solving infrastructure — zero-downtime upgrades, traffic switching, and rollback strategies with Captcha AI.

Implement blue-green deployments for CAPTCHA solving infrastructure — zero-downtime upgrades, traffic switchin...

Automation Python All CAPTCHA Types
Apr 07, 2026
Explainers How BLS CAPTCHA Works: Grid Logic and Image Selection
Deep dive into BLS CAPTCHA grid logic — how images are arranged, how instructions map to selections, and how Captcha AI processes BLS challenges.

Deep dive into BLS CAPTCHA grid logic — how images are arranged, how instructions map to selections, and how C...

Automation BLS CAPTCHA
Apr 09, 2026
Explainers Browser Fingerprinting and CAPTCHA: How Detection Works
How browser fingerprinting affects CAPTCHA challenges, what signals trigger CAPTCHAs, and how to reduce detection with Captcha AI.

How browser fingerprinting affects CAPTCHA challenges, what signals trigger CAPTCHAs, and how to reduce detect...

reCAPTCHA v2 Cloudflare Turnstile reCAPTCHA v3
Mar 23, 2026
Explainers GeeTest v3 Challenge-Response Workflow: Technical Deep Dive
A technical deep dive into Gee Test v 3's challenge-response workflow — the registration API, challenge token exchange, slider verification, and how Captcha AI...

A technical deep dive into Gee Test v 3's challenge-response workflow — the registration API, challenge token...

Automation Testing GeeTest v3
Mar 02, 2026