> ## Documentation Index
> Fetch the complete documentation index at: https://docs.arjex.team/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Task

> Use POST /api/v1/captcha/tasks to create an hCaptcha task. Send the site URL, sitekey, proxy, and API key, then save the returned task ID for polling.

Create an hCaptcha solving task and save its `taskId` so you can retrieve its status and solution with [Get Task](https://docs.arjex.team/captcha/tasks/get-by-id.md). The task price is charged from your credits when the task is created. Failed tasks are refunded automatically.

## Headers

**x-captcha-key** `string` *required*

Your Captcha API key.

**Idempotency-Key** `string`

Use a unique value for each task. Retrying with the same key and the same body returns the existing task instead of creating and charging for another one.

## Body

**type** `string` *required*

The CAPTCHA type. Only `hcaptcha` is supported.

**siteUrl** `string` *required*

The full `http://` or `https://` URL of the page showing the CAPTCHA.

**sitekey** `string` *required*

The hCaptcha sitekey of the target page.

**proxy** `string` *required*

The proxy to solve through, such as `http://user:pass@host:port`.

**rqdata** `string`

The challenge's `rqdata` value, when the target uses it.

```bash cURL theme={null}
curl -X POST "https://arjex.team/api/v1/captcha/tasks" \
  -H "x-captcha-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: 6f1c2a52-0b0e-4a4e-9a57-3d1f6f0f9a10" \
  -d '{
    "type": "hcaptcha",
    "siteUrl": "https://discord.com/register",
    "sitekey": "a9b5fb07-92ff-493f-86fe-352a2803b3df",
    "proxy": "http://user:pass@host:port",
    "rqdata": "optional-rqdata"
  }'
```

## Response

**success** `boolean`

`true` when the task was created.

**code** `number`

HTTP status code of the response.

**message** `string`

Result message.

**data** `object`

**properties**

**taskId** `string`

The task ID. Pass it to Get Task.

**taskType** `string`

The CAPTCHA type of the task.

**status** `string`

The task status. A new task is `pending`.

**cost** `number`

The amount charged for the task.

**idempotent** `boolean`

`true` when an existing task was returned for a repeated `Idempotency-Key`. The response status is then `200`.

```json 201 theme={null}
{
  "success": true,
  "code": 201,
  "message": "Captcha task is pending solver",
  "data": {
    "taskId": "k3Jd9sLq2Xv7mTn8WbRz4YpC1HeA5GuF",
    "taskType": "hcaptcha",
    "status": "pending",
    "cost": 0.01
  },
  "idempotent": false
}
```

```json 402 theme={null}
{
  "success": false,
  "code": 402,
  "errorCode": "INSUFFICIENT_CAPTCHA_CREDITS",
  "message": "Insufficient Captcha credits"
}
```

## Errors

Every error returns `success: false` with a `code`, an `errorCode`, and a `message`.

| Status | `errorCode` | What to do |
| - | - | - |
| 400 | `INVALID_CAPTCHA_REQUEST` | A body field is missing or invalid. The `message` names the problem. |
| 401 | `INVALID_CAPTCHA_KEY` | Send a valid key in the `x-captcha-key` header. |
| 402 | `INSUFFICIENT_CAPTCHA_CREDITS` | Add credits to your account. |
| 403 | `CAPTCHA_FEATURE_REQUIRED` | Your account does not have the active Captcha feature. |
| 404 | `CAPTCHA_ACCOUNT_NOT_FOUND` | Your Captcha account does not exist. |
| 409 | `IDEMPOTENCY_KEY_REUSED` | The key was already used for a different task. Use a new key. |
| 500 | `CAPTCHA_TASK_CREATE_FAILED` | The task could not be created. Retry the request. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.