# Get an answer (2Captcha style)

> 2Captcha's res.php: fetch an answer or the balance.

`GET https://api.solvecha.com/res.php`


`action=get` returns the answer of a job from [in.php](https://solvecha.com/docs/api/twocaptcha-in.md): the text, or `click:1/4/7` for a grid (tile numbers from 1, left to right, top to bottom, or `No_matching_images`). While the job runs, the answer is `CAPCHA_NOT_READY`. Fetching a finished job again is free. `action=getbalance` returns your prepaid balance in US dollars.

## 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).

## Query parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `key` | string | Yes | Your Solvecha API key. |
| `action` | string | Yes | `get` or `getbalance`. |
| `id` | string | No | The id from in.php, for `action` `get`. |
| `json` | integer | No | `1` answers with JSON: `{"status": 1, "request": "click:1/4/7"}`. |

## Example request


**cURL**

```bash
curl "https://api.solvecha.com/res.php?action=get&id=1234567" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

**Python**

```python
import requests

response = requests.get(
    "https://api.solvecha.com/res.php?action=get&id=1234567",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
)
print(response.status_code, response.json())
```

**Node.js**

```js
const response = await fetch("https://api.solvecha.com/res.php?action=get&id=1234567", {
  headers: { Authorization: "Bearer YOUR_API_KEY" },
});
console.log(response.status, await response.json());
```

**Go**

```go
package main

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

func main() {
	req, err := http.NewRequest("GET", "https://api.solvecha.com/res.php?action=get&id=1234567", nil)
	if err != nil {
		panic(err)
	}
	req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
	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 answer, in the text form of 2Captcha (`OK|click:1/4/7`) or as JSON.

```json
{
  "status": 1,
  "request": "click:1/4/7"
}
```

## Notes

Errors have HTTP status 200: `CAPCHA_NOT_READY`, `ERROR_KEY_DOES_NOT_EXIST`, `ERROR_WRONG_CAPTCHA_ID`, `ERROR_EMPTY_ACTION`, `ERROR_NO_SUCH_METHOD`. `reportgood` and `reportbad` answer `ERROR_REPORT_NOT_RECORDED`.
