> ## Documentation Index
> Fetch the complete documentation index at: https://docsv4.mile.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Read geofences

> Returns geofences of your organization, newest first, paginated. A geofence is an area on the map; monitored drivers entering or leaving an active geofence raise alerts. The shape (`geometry`, `center`) is left out unless `withGeometry` is true.

Requires permission `view/geofence`.



## OpenAPI

````yaml /openapi/public/openapi-monitoring.json get /geofence
openapi: 3.0.0
info:
  title: API - Monitoring
  version: 3.0.0
  description: API Documentation - RESTful API for field operations management.
servers:
  - url: https://apiweb.mile.app/api/v3
security:
  - bearerAuth: []
tags:
  - name: Alert
    description: >-
      An alert is an event raised while monitoring field users and vehicles, for
      example entering or leaving a geofence, idling too long, a predicted late
      task, a route deviation or a panic button press. You can list alerts, read
      a daily summary, and mark them resolved. These endpoints are served under
      `/api/v4`.
  - name: Alert Setting
    description: >-
      Alert settings switch each alert type on or off for your organization.
      These endpoints are served under `/api/v4`.
  - name: Geofence
    description: >-
      A geofence is an area drawn on the map, as a polygon or a circle. Alerts
      and automations can react when a field user enters or leaves it, or stays
      inside longer than its dwell time.
  - name: Geofence Group
    description: >-
      Geofence groups organize geofences so you can filter and manage them
      together.
paths:
  /geofence:
    get:
      tags:
        - Geofence
      summary: Read geofences
      description: >-
        Returns geofences of your organization, newest first, paginated. A
        geofence is an area on the map; monitored drivers entering or leaving an
        active geofence raise alerts. The shape (`geometry`, `center`) is left
        out unless `withGeometry` is true.


        Requires permission `view/geofence`.
      operationId: getGeofences
      parameters:
        - name: search
          in: query
          required: false
          description: |-
            Filters by name (case-insensitive contains).
            **Example:** `warehouse`
          schema:
            type: string
        - name: groupId
          in: query
          required: false
          description: >-
            Only geofences of this group. Use `none` for geofences without a
            group.

            **Example:** `66e0a0b1c2d3e4f5a6b7c8d9`
          schema:
            type: string
        - name: type
          in: query
          required: false
          description: |-
            Only this shape.
            **Example:** `polygon`
          schema:
            type: string
            enum:
              - polygon
              - circle
        - name: isActive
          in: query
          required: false
          description: |-
            Only active (`true`) or inactive (`false`) geofences.
            **Example:** `true`
          schema:
            type: boolean
        - name: withGeometry
          in: query
          required: false
          description: >-
            Include `geometry` and `center` in each row. One of `1`, `0`,
            `true`, `false`.

            **Example:** `true`
          schema:
            type: string
            enum:
              - '1'
              - '0'
              - 'true'
              - 'false'
        - $ref: '#/components/parameters/pageInQuery'
        - name: limit
          in: query
          required: false
          description: |-
            Number of geofences per page. Minimum 1, maximum 100. Default 10.
            **Example:** `10`
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 10
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                    description: Status of response.
                  message:
                    description: Message of API response.
                    type: string
                  data:
                    description: Paginated list of geofences.
                    type: object
                    additionalProperties: true
                example:
                  status: true
                  message: Success
                  data:
                    current_page: 1
                    data:
                      - _id: 66e0a1b2c3d4e5f6a7b8c9d0
                        name: Warehouse A
                        groupId: 66e0a0b1c2d3e4f5a6b7c8d9
                        type: string
                        dwellMinutes: 5
                        isActive: true
                        color: '#1E88E5'
                        radius: null
                        createdTime: '2026-10-01T03:00:00.000000Z'
                        updatedTime: '2026-10-01T03:00:00.000000Z'
                      - _id: 66e0a1b2c3d4e5f6a7b8c9d1
                        name: Customer Hub Bekasi
                        groupId: null
                        type: string
                        dwellMinutes: 0
                        isActive: false
                        color: '#E53935'
                        radius: 250
                        createdTime: '2026-09-20T07:00:00.000000Z'
                        updatedTime: '2026-09-22T07:00:00.000000Z'
                    first_page_url: https://apiweb.mile.app/api/v3/geofence?page=1
                    from: 1
                    last_page: 1
                    last_page_url: https://apiweb.mile.app/api/v3/geofence?page=1
                    links:
                      - url: null
                        label: '&laquo; Previous'
                        active: false
                      - url: https://apiweb.mile.app/api/v3/geofence?page=1
                        label: '1'
                        active: true
                      - url: null
                        label: Next &raquo;
                        active: false
                    next_page_url: null
                    path: https://apiweb.mile.app/api/v3/geofence
                    per_page: 10
                    prev_page_url: null
                    to: 2
                    total: 2
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                    description: Shows if the request was successful.
                  message:
                    type: string
                    description: A short message explaining what went wrong.
                example:
                  status: false
                  message: Bad request - invalid parameters provided.
        '500':
          description: Server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                    description: Shows if the request was successful.
                  message:
                    type: string
                    description: A short message explaining what went wrong.
                example:
                  status: false
                  message: Internal server error, please contact support@mile.app.
      deprecated: false
      security:
        - bearerAuth: []
components:
  parameters:
    pageInQuery:
      name: page
      in: query
      schema:
        default: 1
        type: integer
      description: The page number of results to retrieve. **Example:** `2`
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Use a valid Bearer token to authenticate.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.