---
title: "Create a rectangular geofence."
url: "https://developers.vzconnect.com/apis/geofence-api-1/versions/97ac0c29-6cea-4076-8841-35f03eedbd6c/operations/createRectangleGeofence"
---

> Full API specification: https://developers.vzconnect.com/apis/geofence-api-1/versions/97ac0c29-6cea-4076-8841-35f03eedbd6c.md

# Create a rectangular geofence.

`POST` `/geo/v1/geofences/rectangles`

Operation ID: `createRectangleGeofence`

Create a rectangular Geofence within REVEAL. If only an Address is provided, the Geofence is created referencing that address. If only coordinates are provided, it is created referencing the latitude and longitude (an error is returned if either latitude or longitude is missing). If both address and coordinates are provided, the coordinate values are used. All Geofences created with POST are assigned to the ENTIRE FLEET group; use the Customer Meta Data Group API to change group assignment. A Category Name may be supplied but must already exist within REVEAL and match exactly, otherwise an error is returned.

## Request body (required)

Content types: `application/json`

## Responses

- `201` - Rectangular geofence successfully created.
- `400` - Bad request. The request body is invalid.
- `401` - Unauthorized. Authentication credentials are missing or invalid.
- `500` - Internal server error.

## OpenAPI definition

```yaml
openapi: 3.0.0
info:
  title: Geofence API
  version: "1.0"
servers:
  - url: https://api.us.vzconnect.com
paths:
  /geo/v1/geofences/rectangles:
    post:
      summary: Create a rectangular geofence.
      description: Create a rectangular Geofence within REVEAL. If only an Address is
        provided, the Geofence is created referencing that address. If only
        coordinates are provided, it is created referencing the latitude and
        longitude (an error is returned if either latitude or longitude is
        missing). If both address and coordinates are provided, the coordinate
        values are used. All Geofences created with POST are assigned to the
        ENTIRE FLEET group; use the Customer Meta Data Group API to change group
        assignment. A Category Name may be supplied but must already exist
        within REVEAL and match exactly, otherwise an error is returned.
      operationId: createRectangleGeofence
      tags:
        - Geofence API
      x-kong-route-defaults:
        strip_path: false
        paths:
          - ~/geo/v1/geofences/rectangles/?$
      requestBody:
        description: Rectangle geofence details including corner coordinates.
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/RectangleGeofenceRequest"
            example:
              LengthInKm: 1
              WidthInKm: 1
              PlaceId: "996788"
              GeoFenceName: Revtangle
              CategoryName: UnCategorized
              Address:
                AddressLine1: 4556 South Drive
                Locality: Seven Hills
                AdministrativeArea: Oh
                PostalCode: "44131"
                Country: USA
              IsShownOnMap: true
              IsShownOnReport: true
        required: true
      responses:
        "201":
          description: Rectangular geofence successfully created.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RectangleGeofenceRequest"
              example:
                LengthInKm: 1
                WidthInKm: 1
                PlaceId: "996788"
                GeoFenceName: Revtangle
                CategoryName: UnCategorized
                Address:
                  AddressLine1: 4556 South Drive
                  Locality: Seven Hills
                  AdministrativeArea: Oh
                  PostalCode: "44131"
                  Country: USA
                IsShownOnMap: true
                IsShownOnReport: true
        "400":
          description: Bad request. The request body is invalid.
          content:
            application/json: {}
        "401":
          description: Unauthorized. Authentication credentials are missing or invalid.
          content:
            application/json: {}
        "500":
          description: Internal server error.
          content:
            application/json: {}
components:
  schemas:
    RectangleGeofenceRequest:
      type: object
      description: Content data provided when creating or editing a rectangular Geofence.
      properties:
        LengthInKm:
          type: number
          format: double
          description: The length of the rectangular Geofence in kilometers.
          example: 1
        WidthInKm:
          type: number
          format: double
          description: The width of the rectangular Geofence in kilometers.
          example: 1
        PlaceId:
          type: string
          description: A unique value within a REVEAL account used to identify a Geofence.
            The Place ID is a mandatory field to use the Geospatial API.
          example: "996788"
        GeoFenceName:
          type: string
          description: The name of the Geofence.
          example: Revtangle
        CategoryName:
          type: string
          description: The name of the Category. Must already exist within REVEAL and
            match exactly, otherwise an error is returned.
          example: UnCategorized
        Address:
          $ref: "#/components/schemas/Address"
        Latitude:
          type: number
          format: double
          description: The latitude of the center point of the Geofence. Provide it
            together with Longitude. If both coordinates and an Address are
            provided, the coordinates are used.
          example: 41.391756
        Longitude:
          type: number
          format: double
          description: The longitude of the center point of the Geofence. Provide it
            together with Latitude. If both coordinates and an Address are
            provided, the coordinates are used.
          example: -81.670929
        EmailAddress:
          type: string
          description: An email address that can be associated with the saved Geofence.
          example: depot@example.com
        Note:
          type: string
          description: A free form text space for users to provide additional details
            about the Geofence location.
          example: Main depot
        PhoneNumber:
          type: string
          description: A Phone Number that can be associated with the saved Geofence.
          example: 216-522-2855
        IsShownOnMap:
          type: boolean
          description: Denotes if the Geofence can be displayed on the Map.
          default: true
          example: true
        IsShownOnReport:
          type: boolean
          description: Denotes if the Geofence can be displayed on Reports.
          default: true
          example: true
    Address:
      type: object
      description: Address contains the global standards for address components.
      properties:
        AddressLine1:
          type: string
          description: Location specific identification such as a house number.
          example: 2510 E Ridgewood Dr
        AddressLine2:
          type: string
          description: Additional information to identify location such as an apartment
            number.
          example: ""
        Locality:
          type: string
          description: City, town, etc.
          example: Seven Hills
        AdministrativeArea:
          type: string
          description: State, province, etc.
          example: OH
        PostalCode:
          type: string
          description: Postal code.
          example: "44131"
        Country:
          type: string
          description: Country.
          example: USA
```
