---
title: Geo Fencing API
slug: v2/geo-fencing-api
description: Learn about geo-fencing and how to effectively call the API for geofencing with this comprehensive document. Discover code examples, understand API responses and parameters, and find information on error codes. Contact us for expert assistance and take yo
createdAt: 2022-09-29T17:02:07.000Z
---

# Introduction

Geo-fencing (geofencing) is a feature in a software program that uses the global positioning system (GPS) or radio frequency identification (RFID) **to define geographical boundaries**.

## How to call the API

You will need to **[login](https://docs.signzy.com/sandboxapis)** before sending Geofencing request. You are required to pass the access token received from the login call, as authorization header in the request for Risk API along with other parameters.

## API Input Guidelines

Need to pass the following information &#x20;

- IP address&#x20;
- Country Name
- State

:::ApiMethodV2
```json
{
  "tab": "examples",
  "url": "https://preproduction.signzy.tech/api/v2/patrons/<Patron ID>/riskscores",
  "name": "Geo Fencing",
  "method": "POST",
  "request": {
    "pathParameters": [],
    "queryParameters": [],
    "headerParameters": [
      {
        "kind": "required",
        "name": "Authorization ",
        "type": "string",
        "children": [],
        "description": "Contains the id parameter returned from the login step"
      },
      {
        "kind": "required",
        "name": "Content-Type",
        "type": "string",
        "children": [],
        "description": "application/json"
      }
    ],
    "bodyDataParameters": [
      {
        "kind": "required",
        "name": "task",
        "type": "string",
        "description": "Type of Tasks to be performed : Geofencing"
      },
      {
        "kind": "required",
        "name": "essentials",
        "type": "Object",
        "children": [
          {
            "kind": "required",
            "name": "ip",
            "type": "String",
            "description": "IP address "
          },
          {
            "kind": "optional",
            "name": "country",
            "type": "string",
            "description": "Country name"
          },
          {
            "kind": "optional",
            "name": "state",
            "type": "string",
            "description": "State name"
          }
        ],
        "description": "Contains essential input parameters"
      }
    ],
    "formDataParameters": []
  },
  "results": {
    "languages": [
      {
        "id": "k8zrHxUVhnpswk7jMcVp6",
        "code": "{\n    \"task\": \"geoFencing\",\n    \"essentials\": {\n        \"ip\": \"<IP Address\",\n        \"country\": \"IN\",\n        \"state\": \"WB\",\n        \"patronId\": \"<Unique Patron ID >\"\n    },\n    \"id\": \"<ID>\",\n    \"patronId\": \"<PAtron ID>\",\n    \"result\": {\n        \"ip\": \"<IP Address>\",\n        \"country\": \"INDIA\",\n        \"countryCode\": \"IN\",\n        \"state\": \"<State Name>\",\n        \"stateCode\": \"<State Code>\",\n        \"city\": \"<City Name>\",\n        \"zipCode\": \"<Zip Code>\",\n        \"timezone\": \"<Time Zone>\",\n        \"latitude\": <Latitude>,\n        \"longitude\": <Longitude>,\n        \"asn\": \"<ASN\",\n        \"riskip\": <true/e>,\n        \"validUser\": <true/false>\n    }\n}",
        "language": "200",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "k8zrHxUVhnpswk7jMcVp6"
  },
  "examples": {
    "languages": [
      {
        "id": "ACHhNNLMLYLGGnUana4fX",
        "code": "curl --location --request POST 'https://preproduction.signzy.tech/api/v2/patrons/..patronId../riskscores' \\\r\n\r\n--header 'accept-language: en-US,en;q=0.8' \\\r\n--header 'Authorization: <token>' \\\r\n--header 'content-type: application/json' \\\r\n--data-raw '{\r\n    \"task\": \"geoFencing\",\r\n    \"essentials\": {\r\n        \"ip\": \"<IP address>\",\r\n        \"country\": \"<Country>\",\r\n        \"state\": \"<state name>\"\r\n    }\r\n}'",
        "language": "curl",
        "customLabel": "Preproduction"
      },
      {
        "id": "VLf3Q830ySDAQUbr-1WPS",
        "code": "curl --location --request POST 'https://signzy.tech/api/v2/patrons/..patronId../riskscores' \\\r\n--header 'accept: */*' \\\r\n--header 'accept-language: en-US,en;q=0.8' \\\r\n--header 'Authorization: <token>' \\\r\n--header 'content-type: application/json' \\\r\n--data-raw '{\r\n    \"task\": \"geoFencing\",\r\n    \"essentials\": {\r\n        \"ip\": \"<IP address>\",\r\n        \"country\": \"<Country>\",\r\n        \"state\": \"<state name>\"\r\n    }\r\n}'",
        "language": "curl",
        "customLabel": "Production"
      }
    ],
    "selectedLanguageId": "ACHhNNLMLYLGGnUana4fX"
  },
  "description": "",
  "currentNewParameter": {
    "label": "Body Parameter",
    "value": "bodyDataParameters"
  },
  "autoGeneratedAnchorSlug": "geo-fencing",
  "legacyHash": "wiNvdOL0dwDk3L08cbqWm"
}
```
:::

### Response Parameter

| **Parameter Name**  | **Data Type** | **Description**                                                                                                       |
| ------------------- | ------------- | --------------------------------------------------------------------------------------------------------------------- |
| id                  | String        | Unique Id                                                                                                             |
| patronId            | String        | Unique ID for each patron. Which will be a alphanumeric value of 24 characters in length eg: 5a12eaf09fa3e67936b43c52 |
| result.ip           | String        | IP address for which geo fencing is done                                                                              |
| result.country      | String        | Contains Country name                                                                                                 |
| result.state        | String        | Name of state                                                                                                         |
| result.statecode    | String        | State code of the state                                                                                               |
| result.city         | String        | City name of the location                                                                                             |
| result.zipcode      | String        | Zip code of the located region                                                                                        |
| result.timezone     | String        | Time zone of the located region                                                                                       |
| result.latitude     | Float         | Latitude of the location                                                                                              |
| result.longitude    | Float         | Longitude of the location                                                                                             |

***

# Error Codes

| Error Code | HTTP Status Code  | Description                                                                                                                |
| ---------- | ----------------- | -------------------------------------------------------------------------------------------------------------------------- |
| 409        | Conflict (409)    | Max retries reached while attempting to retrieve data from upstream.                                                       |
| 400        | Bad Request (400) | An error occurred while retrieving data from the upstream API, and the specific error message is included in the response. |

:::hint{type="info"}
### Getting help

Please feel free to contact us if you have any questions, require clarification, or have ideas for how to make the documents or any of our services better.


You can reach out to us at [help@signzy.com](#).
:::

