---
agentTools:
  projectIndex: https://developer-docs.gomotive.com/llms.txt
---

# Create a new Geofence (Polygon)

**Purpose**: Use this API to create a new Geofence.

> 📘 NOTE
>
> You must provide information such as name, location co-ordinates (latitude and longitude), as well status information in the request body. Refer to the Body Parameters section for more info.

## Sample Request Body

```json
{
  "name":"alpha",
  "category":"Fuel Station",
  "status":"active",
	"address": "1303 N Collins St, Arlington, TX 76011, USA",
  "description": "notes of geofence",
  "location_points":[
    {
      "lat":33.667893,
      "lon":73.062074
    },
    {
      "lat":33.665052,
      "lon":73.067689
    },
    {
      "lat":33.662428,
      "lon":73.061814
    },
    {
      "lat":33.666374,
      "lon":73.058196
    },
    {
      "lat":33.667893,
      "lon":73.062074
    }
  ]
}
```

<br />

## Response Parameters

### id

* **Type**: Integer
* **Description**: The unique identifier for the geofence.

### name

* **Type**: String
* **Description**: The name of the geofence.

### category

* **Type**: String
* **Description**: The category of the geofence, e.g., "Fuel Station".

### status

* **Type**: String
* **Description**: The status of the geofence, e.g., "active".

### address

* **Type**: String
* **Description**: The physical address associated with the geofence.

### description

* **Type**: String
* **Description**: Denotes a brief note or a description with respect to the Geofence.

### location\_points

* **Type**: Array of Objects
* **Description**: A list of geographical points that define the boundaries of the geofence.

### lat

* **Type**: Float
* **Description**: The latitude of a location point in the geofence.

### lon

* **Type**: Float
* **Description**: The longitude of a location point in the geofence.

***

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Motive",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://api.gomotive.com"
    }
  ],
  "components": {
    "securitySchemes": {
      "sec0": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key"
      }
    }
  },
  "security": [
    {
      "sec0": []
    }
  ],
  "paths": {
    "/v1/geofences": {
      "post": {
        "summary": "Create a new Geofence (Polygon)",
        "description": "",
        "operationId": "create-a-new-geofence",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "category"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Specify the name of the geofence that you are creating."
                  },
                  "status": {
                    "type": "string",
                    "description": "Specify the status of the Geofence that you are creating. Allowed values are active or deactivated.",
                    "default": "active"
                  },
                  "address": {
                    "type": "string",
                    "description": "Specify the address of the location for which you are creating this Geofence."
                  },
                  "category": {
                    "type": "string",
                    "description": "Specify the category for which you are creating the Geofence. Allowed values are: 'Uncategorized', 'Fuel Station', 'Job Site', 'Maintenance Facility', 'Receiver / Consignee', 'Restricted Location', 'Shipper', 'Terminal / Yard', 'Truck Stop / Rest Area', 'Weigh Station / Scale', 'Shipper / Receiver'"
                  },
                  "location_points": {
                    "type": "array",
                    "description": "Specify the latitude and the longitude of the Geofence. You must provide multiple latitudes and longitudes to form a polygon.",
                    "items": {
                      "type": "string"
                    }
                  },
                  "description": {
                    "type": "string",
                    "description": "Provide a short description for the Geofence."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "201",
            "content": {
              "application/json": {
                "examples": {
                  "Created a new Geofence": {
                    "value": "  {\n  \"geofence\": {\n    \"id\": 1004,\n    \"name\": \"alpha\",\n    \"category\": \"Fuel Station\",\n    \"status\": \"active\",\n    \"address\": \"1303 N Collins St, Arlington, TX 76011, USA\",\n    \"description\": \"notes of geofence\",\n    \"location_points\": [\n      {\n        \"lat\": 33.667893,\n        \"lon\": 73.062074\n      },\n      {\n        \"lat\": 33.665052,\n        \"lon\": 73.067689\n      },\n      {\n        \"lat\": 33.662428,\n        \"lon\": 73.061814\n      },\n      {\n        \"lat\": 33.666374,\n        \"lon\": 73.058196\n      },\n      {\n        \"lat\": 33.667893,\n        \"lon\": 73.062074\n      }\n    ]\n  }\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "geofence": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer",
                          "example": 1004,
                          "default": 0
                        },
                        "name": {
                          "type": "string",
                          "example": "alpha"
                        },
                        "category": {
                          "type": "string",
                          "example": "Fuel Station"
                        },
                        "status": {
                          "type": "string",
                          "example": "active"
                        },
                        "address": {
                          "type": "string",
                          "example": "1303 N Collins St, Arlington, TX 76011, USA"
                        },
                        "description": {
                          "type": "string",
                          "example": "notes of geofence"
                        },
                        "location_points": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "lat": {
                                "type": "number",
                                "example": 33.667893,
                                "default": 0
                              },
                              "lon": {
                                "type": "number",
                                "example": 73.062074,
                                "default": 0
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "examples": {
                  "Unable to create": {
                    "value": "{\n  \"error_message\": \"geofence could not be created\"\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "error_message": {
                      "type": "string",
                      "example": "geofence could not be created"
                    }
                  }
                }
              }
            }
          }
        },
        "deprecated": false
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true,
  "_id": "66acf64a829e88001980fbf2:66d6178f55a74b005dff54a1"
}
```