# getQueueStats

Returns the current queue: tasks waiting, tasks being solved and the average solving time over the last hour. The numbers come from real tasks, not estimates.

`POST https://unlock-api.com/getQueueStats`

## Request parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `clientKey` | String | Yes | Your API key, 32 characters, from the account page. |

## Request

```json
{
  "clientKey": "YOUR_API_KEY"
}
```

## Response

### Success

```json
{
  "errorId": 0,
  "waiting": 3,
  "solving": 12,
  "speed": 6.4,
  "total": 15
}
```

## Response fields

| Name | Type | Description |
|---|---|---|
| `errorId` | Integer | 0 when the request worked, 1 when it did not. |
| `waiting` | Integer | Tasks waiting to be sent to a solver. |
| `solving` | Integer | Tasks being solved now. |
| `speed` | Number | Average solving time in seconds over the last hour, or null if nothing was solved. |
| `total` | Integer | waiting plus solving. |

## Code samples

### cURL

```bash
curl -s https://unlock-api.com/getQueueStats \
  -H "Content-Type: application/json" \
  -d '{"clientKey":"YOUR_API_KEY"}'
```

### Python

```python
import requests

r = requests.post("https://unlock-api.com/getQueueStats", json={
    "clientKey": "YOUR_API_KEY"
}).json()
print(r)
```

### Node.js

```javascript
const r = await fetch("https://unlock-api.com/getQueueStats", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({
    "clientKey": "YOUR_API_KEY"
  }),
}).then((res) => res.json());
console.log(r);
```

## Errors this method can return

- `ERROR_KEY_DOES_NOT_EXIST`: The key is wrong. Copy it again from the account page. (in.php and res.php: ERROR_WRONG_USER_KEY)
