> ## 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 alerts

> Returns alerts of your organization, newest event first, paginated. An alert is a record of a monitored event about a driver, such as entering or leaving a geofence, stopping for too long, a task predicted to be late, leaving the planned route, or pressing the panic button. Known codes: `geofence.enter`, `geofence.leave` (driver entered or left a geofence), `idle.detected`, `idle.repeated` (driver stopped moving), `task.lateness.predicted` (a task is predicted to be late), `route.deviation.detected` (driver left the planned route), `user.panic` (panic button).

Without `status`, only unresolved alerts are returned. Days in `date`, `from` and `to` are local days in Asia/Jakarta time.

Requires permission `view/alert`.



## OpenAPI

````yaml /openapi/public/openapi-monitoring.json get /alerts
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:
  /alerts:
    servers:
      - url: https://apiweb.mile.app/api/v4
    get:
      tags:
        - Alert
      summary: Read alerts
      description: >-
        Returns alerts of your organization, newest event first, paginated. An
        alert is a record of a monitored event about a driver, such as entering
        or leaving a geofence, stopping for too long, a task predicted to be
        late, leaving the planned route, or pressing the panic button. Known
        codes: `geofence.enter`, `geofence.leave` (driver entered or left a
        geofence), `idle.detected`, `idle.repeated` (driver stopped moving),
        `task.lateness.predicted` (a task is predicted to be late),
        `route.deviation.detected` (driver left the planned route), `user.panic`
        (panic button).


        Without `status`, only unresolved alerts are returned. Days in `date`,
        `from` and `to` are local days in Asia/Jakarta time.


        Requires permission `view/alert`.
      operationId: getAlerts
      parameters:
        - name: status
          in: query
          required: false
          description: |-
            Resolution filter. `unresolved` (default), `resolved`, or `all`.
            **Example:** `all`
          schema:
            type: string
            enum:
              - unresolved
              - resolved
              - all
        - name: date
          in: query
          required: false
          description: |-
            A single local day (Y-m-d). Cannot be combined with `from` / `to`.
            **Example:** `2026-10-15`
          schema:
            type: string
            format: date
        - name: from
          in: query
          required: false
          description: >-
            Start day of a range (Y-m-d). Requires `to`; cannot be combined with
            `date`.

            **Example:** `2026-10-01`
          schema:
            type: string
            format: date
        - name: to
          in: query
          required: false
          description: >-
            End day of a range (Y-m-d). Requires `from`; must be on or after
            `from` and at most 93 days after it.

            **Example:** `2026-10-15`
          schema:
            type: string
            format: date
        - name: alertCode[]
          in: query
          required: false
          description: >-
            Only alerts with these codes. Repeat the parameter for several
            codes.

            **Example:** `alertCode[]=geofence.enter&alertCode[]=idle.detected`
          explode: true
          schema:
            type: array
            items:
              type: string
        - name: email
          in: query
          required: false
          description: |-
            Only alerts about this driver (exact email, case-insensitive).
            **Example:** `driver@example.com`
          schema:
            type: string
        - $ref: '#/components/parameters/pageInQuery'
        - name: limit
          in: query
          required: false
          description: >-
            Number of alerts per page. Values above 100 are capped to 100.
            Default 20.

            **Example:** `20`
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 20
      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 alerts.
                    type: object
                    additionalProperties: true
                example:
                  status: true
                  message: Success
                  data:
                    current_page: 1
                    data:
                      - _id: 66fb0c1d2e3f4a5b6c7d8e9f
                        alertCode: geofence.enter
                        alertName: Geofence enter
                        title: Entered Warehouse A
                        message: Driver entered Warehouse A.
                        assignee: driver@example.com
                        eventTime: '2026-10-15T02:10:00+00:00'
                        lat: -6.2001
                        lon: 106.8166
                        geofenceId: 66e0a1b2c3d4e5f6a7b8c9d0
                        geofenceName: Warehouse A
                        geofenceGroup: 66e0a0b1c2d3e4f5a6b7c8d9
                        dwelledMinutes: null
                        isResolved: false
                        resolvedTime: null
                        resolvedBy: null
                        resolvedByName: null
                        resolvedNotes: null
                      - _id: 66fb0c1d2e3f4a5b6c7d8ea0
                        alertCode: idle.detected
                        alertName: Idle detected
                        title: Driver idle
                        message: Driver has not moved for 15 minutes.
                        assignee: driver2@example.com
                        eventTime: '2026-10-15T01:45:00+00:00'
                        lat: -6.1754
                        lon: 106.8272
                        geofenceId: null
                        geofenceName: null
                        geofenceGroup: null
                        dwelledMinutes: null
                        isResolved: true
                        resolvedTime: '2026-10-15T02:00:00+00:00'
                        resolvedBy: dispatcher@example.com
                        resolvedByName: Dispatcher One
                        resolvedNotes: Driver was unloading.
                    first_page_url: https://apiweb.mile.app/api/v4/alerts?page=1
                    from: 1
                    last_page: 1
                    last_page_url: https://apiweb.mile.app/api/v4/alerts?page=1
                    links:
                      - url: null
                        label: '&laquo; Previous'
                        active: false
                      - url: https://apiweb.mile.app/api/v4/alerts?page=1
                        label: '1'
                        active: true
                      - url: null
                        label: Next &raquo;
                        active: false
                    next_page_url: null
                    path: https://apiweb.mile.app/api/v4/alerts
                    per_page: 20
                    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.