# Blocker V2

## REQUEST

### Endpoint

```url
https://stopbot.net/api/v2/blockerv2?apikey={APIKEY}&ip={IP}&ua={url-encode-useragent}&url={url-encode-url}&confname={config-name}&params={url-encode-params}&headers={url-encode-params}
```

### Method

```
GET
```

### Parameters

* `apikey` (string, required): The API key provided to the user.
* `ip` (string, required): The IP address of the visitor.
* `ua` (string, required): The useragent used by the visitor.
* `url` (string, required): The URL opened by the visitor, REQUEST\_URI from your Website/Apps).
* `confname` (string, required): The configuration name obtained from STOPBOT.NET Blocker V2.
* `params` (string, required): The parameters are received from your Website/Apps and converted the parameter array into JSON.
* `headers` (string, required): The headers are received from your Website/Apps and converted the headers array into JSON.

### Example Request

```bash
curl "https://stopbot.net/api/v2/blockerv2?apikey=6ba6cb9406efaag4966d2e858c8ba4e4&ip=1.1.1.1&ua=Mozilla%2F5.0%20%28Windows%20NT%2010.0%3B%20Win64%3B%20x64%29%20AppleWebKit%2F537.36%20%28KHTML%2C%20like%20Gecko%29%20Chrome%2F118.0.0.0%20Safari%2F537.36&url=https%3A%2F%2Fstopbot.net%2Fasdasdasd%2Fasdasdasdasdav2&confname=adakami&params=%7B%22paramskey1%22%3A%20%22value1%22%2C%22paramskey2%22%3A%20%22value2%22%7D&headers=%7B%22headerskey1%22%3A%20%22value1%22%2C%22headerskey2%22%3A%20%22value2%22%7D"
```

## **Example Response**

### Success Response

If the HTTP response is 200 (success response), it will generate the following response:

```json
{
  "IP": "1.1.1.1",
  "UserAgent": "Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/118.0.0.0 Safari\/537.36",
  "IPInfo": {
    "hostname": "one.one.one.one",
    "asn": "AS13335",
    "company": "Cloudflare, Inc.",
    "isp": "Cloudflare, Inc.",
    "city": "Marble Bar",
    "district": "East Pilbara",
    "region": "Western Australia",
    "postcode": "",
    "country": "AU",
    "latitude": -20.5,
    "longitude": 120.15,
    "timezone": "Australia/Perth"
  },
  "Status": {
    "Bot": 1,
    "Block": 1,
    "ThreatURL": 0,
    "Desc": "[Disallow] - IP Non-ISP"
  },
  "PageResponse": {
    "Type": "RedirectURL",
    "Contents": "https://stopbot.net/bot"
  },
  "status": "success",
  "timeResponse": "2023-10-31 19:28:50"
}

```

### Description on successful response

* `IP`: The visitor's IP address.
* `UA`: The useragent used by the visitor.
* `IPInfo`: Information about the visitor's IP.
  * `hostname`: The visitor's hostname.
  * `asn`: The Autonomous System Number (ASN) that identifies the internet service provider.
  * `company`: The company associated with the visitor's IP.
  * `isp`: The Internet Service Provider (ISP) name.
  * `city`: The city where the visitor is located.
  * `district`: The district or area associated with the IP address.
  * `region`: The region where the visitor is located.
  * `postcode`: The postal code associated with the IP address.
  * `country`: The country where the visitor is located.
  * `latitude`: The latitude coordinate of the IP address location.
  * `longitude`: The longitude coordinate of the IP address location.
  * `timezone`: The timezone of the IP address location.
* `Status`: Information about the visitor's IP status.
  * `Bot`: Indicates whether the visitor is a bot (1) or not (0).
  * `Block`: Indicates whether access is blocked (1) or not (0).
  * `ThreatURL`: Indicating whether the visitor is performing suspicious actions on your URL, result true (1) or false (0).
  * `Desc`: Description status.
* `PageResponse`: Information about the response page.
  * `Type`: indicates that the response type is :&#x20;
    * None  : \ <mark style="color:purple;">Stay on Page.</mark>
    * RedirectURL :\
      &#x20;<mark style="color:purple;">It's a signal that you should redirect the request to a specific URL provided in the</mark> `Contents` <mark style="color:purple;">field as a way to mitigate or handle bot-related activity.</mark>
    * HTTPStatusCode :\ <mark style="color:purple;">HTTP status codes are standardized codes used by web servers to indicate the outcome of an HTTP request. The</mark> `Contents` <mark style="color:purple;">field specifies the specific HTTP status code returned in response to your visitor request. (ex:</mark> `Contents` <mark style="color:purple;">404 and and the HTTP response status code 404 Not Found was returned to indicate this,</mark> [click here](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes) <mark style="color:purple;">for HTTPS Response status code details.)</mark>
  * `Contents`: Response contents.
* `status`: Indicates the success or failure of the request.
* `timeResponse`: Date and time when the response was sent.

### Failed Response

If the HTTP response is 400 or 401 (failed response), it will generate the following response:

```json
{
  "status": "errors",
  "message": "Your Configuration Name is not registered in our database.",
  "timeResponse": "2023-10-31 19:28:50"
}
```

### Description on failed response:

* `status`: Response Status: The value is "errors" if the request fails.
* `message`: Error message.
* `timeResponse`: Date and time when the response was sent.
