# Create a FunCAPTCHA tile job

> Send a FunCAPTCHA tile selection and get a job id.

`POST https://api.solvecha.com/v1/recognition/funcaptcha`


Creates a job for a FunCAPTCHA puzzle where you pick the tile that shows the asked object. Send the task text and one picture with the 3x2 grid of tiles.

## 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. |
| `task` | string | Yes | The instruction text, for example `Pick the sheep`. |
| `image_data` | array of strings | Yes | One base64 picture with the grid of six tiles (3x2). |

## Example request


**cURL**

```bash
curl -X POST "https://api.solvecha.com/v1/recognition/funcaptcha" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "task": "Pick the sheep",
  "image_data": ["BASE64_GRID"]
}'
```

**Python**

```python
import requests

response = requests.post(
    "https://api.solvecha.com/v1/recognition/funcaptcha",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    json={
        "task": "Pick the sheep",
        "image_data": ["BASE64_GRID"]
    },
)
print(response.status_code, response.json())
```

**Node.js**

```js
const response = await fetch("https://api.solvecha.com/v1/recognition/funcaptcha", {
  method: "POST",
  headers: {
    Authorization: "Bearer YOUR_API_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "task": "Pick the sheep",
    "image_data": ["BASE64_GRID"]
  }),
});
console.log(response.status, await response.json());
```

**Go**

```go
package main

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

func main() {
	body := strings.NewReader(`{
  "task": "Pick the sheep",
  "image_data": ["BASE64_GRID"]
}`)
	req, err := http.NewRequest("POST", "https://api.solvecha.com/v1/recognition/funcaptcha", 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

An error has the HTTP status of its code and this body:

```json
{"error": 15, "code": 15, "message": "Invalid key", "type": null}
```

| Code | HTTP status | When |
|---|---|---|
| `10` Invalid request | 400 | 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 | 429 | Your key is above the create requests per minute of its plan. |
| `15` Invalid key | 401 | The key is missing, malformed or unknown. |
| `16` Out of credit | 403 | No active plan, expired plan, or the daily quota is used up. |
| `9` Unknown error | 500 | Server error. Retry after a few seconds. |

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

## Notes

See [FunCAPTCHA](https://solvecha.com/docs/captcha-types/funcaptcha.md) for the answer format.
