# Create a job (legacy path)

> NopeCHA's original create path. Put the captcha type in the body. Errors come with HTTP 200.

`POST https://api.solvecha.com/`


The root path from the first NopeCHA API. It exists so that older clients keep working. New code should use the `/v1/recognition/...` paths. On this path the captcha type is a field of the body, and **errors are answered with HTTP status 200**: look at the `error` field.


> **Warning:**
> This is a legacy path for older NopeCHA clients. Use the [`/v1` paths](https://solvecha.com/docs/api/overview.md) in new code.


## Authorization

Send your API key as `Authorization: Bearer YOUR_API_KEY`. Other ways are the `key` field of the body and the `key` query parameter. See [Authentication](https://solvecha.com/docs/authentication.md).

## Request body

JSON, or url-encoded form data. The body is limited to 4.5 MB.

| Name | Type | Required | Description |
|---|---|---|---|
| `key` | string | No | Your API key, if you do not send it in the `Authorization` header or the query string. |
| `type` | string | Yes | The captcha type. One of `recaptcha`, `textcaptcha`, `geetest`, `funcaptcha`, `funcaptcha_match`. |
| `task` | string | No | The instruction text. See the page of the captcha type. |
| `grid` | string | No | reCAPTCHA only. One of `3x3`, `4x4`, `1x1`. |
| `image_data` | array of strings | Yes | Base64 pictures. See the page of the captcha type. |

## Example request


**cURL**

```bash
curl -X POST "https://api.solvecha.com/" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "type": "recaptcha",
  "task": "Select all images with buses",
  "grid": "3x3",
  "image_data": ["BASE64_IMAGE"]
}'
```

**Python**

```python
import requests

response = requests.post(
    "https://api.solvecha.com/",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    json={
        "type": "recaptcha",
        "task": "Select all images with buses",
        "grid": "3x3",
        "image_data": ["BASE64_IMAGE"]
    },
)
print(response.status_code, response.json())
```

**Node.js**

```js
const response = await fetch("https://api.solvecha.com/", {
  method: "POST",
  headers: {
    Authorization: "Bearer YOUR_API_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "type": "recaptcha",
    "task": "Select all images with buses",
    "grid": "3x3",
    "image_data": ["BASE64_IMAGE"]
  }),
});
console.log(response.status, await response.json());
```

**Go**

```go
package main

import (
	"fmt"
	"io"
	"net/http"
	"strings"
)

func main() {
	body := strings.NewReader(`{
  "type": "recaptcha",
  "task": "Select all images with buses",
  "grid": "3x3",
  "image_data": ["BASE64_IMAGE"]
}`)
	req, err := http.NewRequest("POST", "https://api.solvecha.com/", body)
	if err != nil {
		panic(err)
	}
	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()
	out, _ := io.ReadAll(resp.Body)
	fmt.Println(resp.StatusCode, string(out))
}
```


## Response

### 200 OK

The job was created. `data` is the job id.

```json
{"data": "1234567"}
```

### Errors

HTTP status 200 with an error body:

```json
{"error": 14, "message": "Incomplete job"}
```

| Code | HTTP status | When |
|---|---|---|
| `10` Invalid request | 200 | The body is not JSON or url-encoded form data (multipart is not supported), it is larger than 4.5 MB, or a field or the number of images is wrong. |
| `11` Rate limit reached | 200 | Your key is above the create requests per minute of its plan. |
| `15` Invalid key | 200 | The key is missing, malformed or unknown. |
| `16` Out of credit | 200 | No active plan, expired plan, or the daily quota is used up. |
| `9` Unknown error | 200 | Server error. Retry after a few seconds. |

All codes are on the [Errors](https://solvecha.com/docs/errors.md) page.

## Notes

Errors look like `{"error": 16, "message": "Out of credit"}` with HTTP status 200.
