# Text captcha

> How to send a text captcha picture and how to read the answer, a case-sensitive string.

Use `textcaptcha` for a picture with distorted letters and digits. The answer is the text.


- [Create a text captcha job](https://solvecha.com/docs/api/create-text-captcha-job.md): The endpoint with all fields and error codes.


## What to send

Exactly one base64 picture in `image_data`. No task text is needed.

```json
{"image_data": ["BASE64_IMAGE"]}
```

## What you get

An array with one string: the recognised text. The text is case-sensitive.

```json
{"data": ["K7m2Q"]}
```

## Example


**cURL**

```bash
IMG=$(base64 -w0 captcha.png)
curl -X POST "https://api.solvecha.com/v1/recognition/textcaptcha" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"image_data\": [\"$IMG\"]}"
```

**Python**

```python
import base64
import requests

with open("captcha.png", "rb") as f:
    image = base64.b64encode(f.read()).decode()

job = requests.post(
    "https://api.solvecha.com/v1/recognition/textcaptcha",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    json={"image_data": [image]},
).json()
```

**Node.js**

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

const image = (await readFile("captcha.png")).toString("base64");
const job = await fetch("https://api.solvecha.com/v1/recognition/textcaptcha", {
  method: "POST",
  headers: { Authorization: "Bearer YOUR_API_KEY", "Content-Type": "application/json" },
  body: JSON.stringify({ image_data: [image] }),
}).then((r) => r.json());
```


Then [fetch the answer](https://solvecha.com/docs/api/get-job-result.md) with `job.data` as the `id`.
