# Rest API

## Endpoints and Parameters

Below is a list of REST API endpoints. If you are a python or node.js programmer, we have ready made pip and npm solution respectively that you can plug and play without needing to set anything up. For programmers in other langugages such a GO Lang, Java, C++, etc. you can simply use our REST API endpoints below.

Please use GET requests for all the endpoints

invisiFox is built to process large numbers of requests, however, there is no need to keep refreshing solution requests at high speeds. Please make sure to follow the guidelines and rate limits. If you spam us you will be banned and your account credit forfeitted.

### Get Account Balance

<mark style="color:blue;">`GET`</mark> `https://api.invisifox.com/balance`

This endpoint allows you to get your account balance

#### Query Parameters

| Name                                    | Type   | Description              |
| --------------------------------------- | ------ | ------------------------ |
| token<mark style="color:red;">\*</mark> | String | your invisifox api token |

{% tabs %}
{% tab title="200: OK {captchaBalance: 123, proxyBalance: 456}" %}

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

### Solve Captcha

When solving a HCaptcha you must first submit a request to the /hcaptcha endpoint containing the information about the HCaptcha you wish to solve such as the sitekey and website on which you get the captcha. You can then check at time intervals if the solution has been found using the /solution endpoint.

<mark style="color:blue;">`GET`</mark> `https://api.invisifox.com/hcaptcha`

This endpoint creates a request for a HCaptcha to be solved. It will return a taskId from which you can retrieve the solution.

#### Query Parameters

| Name                                      | Type   | Description                                                                                                                           |
| ----------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------- |
| token<mark style="color:red;">\*</mark>   | String | your invisifox api token                                                                                                              |
| siteKey<mark style="color:red;">\*</mark> | String | the HCaptcha sitekey from the website you are using. This is usually found in HTTP requests or in the HCaptcha iFrame                 |
| pageurl<mark style="color:red;">\*</mark> | String | the url on which you find the HCaptcha. Usually the full url is not required, for example all the url parameters may not be necassary |
| proxy<mark style="color:red;">\*</mark>   | String | the proxy address you want to use to solve the HCaptcha in format username:password\@host:port or host:port                           |
| rqdata                                    | String | for enterprise HCaptcha websites, this value is usually found in HTTP requests                                                        |
| useragent                                 | String | the useragent of the device you are using or emulating                                                                                |
| cookies                                   | String | the browser cookies                                                                                                                   |
| invisible                                 | String | default set to false, set to true for invisible HCaptchas                                                                             |

{% tabs %}
{% tab title="200: OK { 'status': 'OK', 'taskId': '80d19be9-c50b-4fa7-9fe2-06769d906644' }" %}

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

Please make sure to wait 25 seconds after submitting this request before requesting the solution as this is the minimum amount of time it will take to produce a solution.

<mark style="color:blue;">`GET`</mark> `https://api.invisifox.com/solution`

While you are waiting for a HCaptcha to be solved you will get a response with status 'WAITING'. Once the captcha is solved is the status parameter will read 'OK'.

#### Query Parameters

| Name                                     | Type   | Description                                                                    |
| ---------------------------------------- | ------ | ------------------------------------------------------------------------------ |
| token<mark style="color:red;">\*</mark>  | String | your invisifox api token                                                       |
| taskId<mark style="color:red;">\*</mark> | String | the corresponding taskId value returned from the /hcaptcha response made prior |

{% tabs %}
{% tab title="200: OK {'status': 'WAITING', 'taskId': 'a5270167-2c4c-450e-9627-4b81fa1af5bd'}" %}

```javascript
{
    // Response
}
```

{% endtab %}

{% tab title="200: OK {'solution': 'P0\_eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...', 'status': 'OK', 'taskId': 'e2b0ad9f-b755-40c2-8812-add1bea8185f'}" %}

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

### Generating Proxies

In order to use invisiFox proxies you will need your proxy authentication username and password. You can get these two values by creating an account and adding credit on invisifox.com proxies.

invisiFox proxies are designed to be dynamically generated and customizable on the go directly from the client side without the need for an API. The documentation below describes how to generate a proxies.

#### Random Rotation

Random rotation proxies are proxies that are randomized on each request. This is usefull for use cases where you are requesting a resource that is rate limited but does not maintain a session based on your IP address. For example this is useful for anonymous data scraping, but no ideal for a case where an account is logged in and must make successive requests from the same IP address. In the later case, Stick IPs are more suitable

#### Basic Usage

The request below will choose a random IP in a random country upon each request

```
http://${username}:${password}@proxy.invisifox.com:31112
```

#### Country Specific

If you wish to use a random IP in a specific country, you may specific the country string in the proxy link as below. Please refer to our country list table for details

```
http://${username}:${password}_country-${country_string}@proxy.invisifox.com:31112
```

For example for the United States you can use the following

```
http://${username}:${password}_country-UnitedStates@proxy.invisifox.com:31112
```

#### SSL Secured

You can also use HTTPS instead of HTTP to benefit from SSL security using the 31111 port. For example:

```
https://${username}:${password}@proxy.invisifox.com:31111
```

### Sticky IP

Sticky IP proxies are designed to be easy to dynamically generate, as well as to maintain a fixed IP session based on a string. In addition we use high level request databasing to reduce instances of IP reuse / collision. Simple put unlike other providers on the market we try to make sure the proxy we provide has not recently been used by you or someone else on the host / website you are accessing. Effectively we substantially increase success rates and reduce the change of being detected on highly sensitive application.

#### Basic Usage

To generate a session you simple need to create a link with a random 8 digit alphanumeric string in the format below. A session will be opened and maintained for you on the basis of this 8 digit ID.

```
http://${username}:${password}_session-${random_8_characters}@proxy.invisifox.com:31112
```

For example a session might look like the following

```
http://${username}:${password}_session-9GT3Mx0k@proxy.invisifox.com:31112
```

#### Country Specific

If you wish to use a Sticky IP in a specific country, you may specific the country string in the proxy link as below. Please refer to our country list table for details

```
http://${username}:${password}_country-${country_string}_session-${random_8_characters}@proxy.invisifox.com:31112
```

For example a country specific session might look like the following

```
http://${username}:${password}_country-UnitedStates_session-9GT3Mx0k@proxy.invisifox.com:31112
```

#### SSL Secured

You can also use HTTPS instead of HTTP to benefit from SSL security using the 31111 port. For example:

```
https://${username}:${password}_session-${random_8_characters}@proxy.invisifox.com:31111
```
