Zenduty Analytics API

These endpoints provide incident analytics for your account. All analytics endpoints accept POST requests with optional filter parameters and return metrics such as incident counts, MTTA, and MTTR.

OpenAPI Specification

zenduty-analytics-api-openapi.yml Raw ↑
openapi: 3.0.0
info:
  version: 1.1.0
  title: Zenduty Account Custom Role Analytics API
  termsOfService: https://zenduty.com
  contact:
    email: vishwa@zenduty.com
  license:
    name: Apache 2.0
  x-logo:
    url: data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxOS4wLjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiDQoJIHZpZXdCb3g9Ii05OC4zIDE3My43IDIwNi4zIDUzLjIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgLTk4LjMgMTczLjcgMjA2LjMgNTMuMjsiIHhtbDpzcGFjZT0icHJlc2VydmUiPg0KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4NCgkuc3Qwe2ZpbGw6IzBGMTcyQTt9DQoJLnN0MXtmaWxsOiNGRDlBMDA7fQ0KPC9zdHlsZT4NCjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik0tMjksMjEwLjJoNi4zYzIuNywwLDQuOSwyLjIsNC45LDQuOWgtMTguMWMwLTUuMyw0LjEtOS40LDcuOS0xMy4xbDMuOC0zLjdoLTcuMWMtMi41LDAtNC42LTIuMS00LjYtNC42aDE4DQoJYzAsNS4zLTQuMSw5LjQtNy44LDEzLjJMLTI5LDIxMC4yeiIv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TEuNWMwLjktMS4yLDEuOC0yLjMsMi43LTMuMw0KCWMyLjEtMi4yLDQuNC00LjEsNi45LTUuOGwwLjEtMC4xYzAuOC0wLjYsMS42LTEuMSwyLjQtMS42bDExLjQtNy40bDE1LjktMTAuNGg3LjdDLTQ4LjgsMTkyLjktNDguNCwxOTMuNi00OC42LDE5NC4zeiIvPg0KPC9zdmc+DQo=
  description: "# Introduction\n\nZenduty is a cutting edge platform for incident management. With high level automation, Zenduty enables faster and better incident resolution keeping developers first.\n\n\n  Javascript Libraries: https://github.com/Zenduty/zenduty-js\n\n  Ruby Libraries: https://github.com/Zenduty/zenduty-ruby\n\n  Python Libraries: https://github.com/Zenduty/zenduty-python-sdk\n\n  Postman Collection for Zenduty API: https://github.com/Zenduty/zenduty-api-postman.git\n\n  Account-level roles and permissions: https://docs.zenduty.com/docs/users#account-level-roles-and-permissions\n\n  Team-level roles and permissions: https://docs.zenduty.com/docs/users#team-level-roles-and-permissions\n"
servers:
- url: https://www.zenduty.com
security:
- bearerAuth: []
tags:
- name: Analytics
  description: These endpoints provide incident analytics for your account. All analytics endpoints accept POST requests with optional filter parameters and return metrics such as incident counts, MTTA, and MTTR.
paths:
  /api/v2/account/analytics/incident_stats/:
    post:
      tags:
      - Analytics
      summary: Get Incident Stats
      description: Returns incident counts for the account and the requesting user.
      requestBody:
        description: Optional filter parameters
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AnalyticsRequestBody'
            example:
              from_date: '2025-09-24'
              to_date: '2025-12-23'
              team_ids: []
              service_ids: []
              user_ids: []
              priority_ids: []
              sla_ids: []
              escalation_policy_ids: []
              tag_ids: []
              urgency: ''
              child_incident: include
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IncidentStatsResponse'
              example:
                total_incidents: 150
                total_triggered_incidents: 20
                total_acknowledged_incidents: 30
                total_resolved_incidents: 100
                user_total_incidents: 40
                user_triggered_incidents: 5
                user_acknowledged_incidents: 10
                user_resolved_incidents: 25
        '403':
          description: Forbidden
          content:
            application/json:
              example:
                detail: You do not have permission to perform this action.
  /api/v2/account/analytics/team_analytics/:
    post:
      tags:
      - Analytics
      summary: Get Team Analytics
      description: Returns incident metrics for each team.
      requestBody:
        description: Optional filter parameters
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AnalyticsRequestBody'
            example:
              from_date: '2025-09-24'
              to_date: '2025-12-23'
              team_ids: []
              service_ids: []
              user_ids: []
              priority_ids: []
              sla_ids: []
              escalation_policy_ids: []
              tag_ids: []
              urgency: ''
              child_incident: include
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TeamAnalyticsResponse'
              example:
                all_teams:
                  total_incidents: 500
                  total_acknowledged: 400
                  total_resolved: 300
                  mtta_seconds: 120.5
                  mttr_seconds: 3600
                team_records:
                - team:
                    name: Platform Team
                    unique_id: abc-def-123
                  total_incidents: 100
                  total_acknowledged: 80
                  total_resolved: 60
                  mtta_seconds: 90.2
                  mttr_seconds: 2400
        '403':
          description: Forbidden
          content:
            application/json:
              example:
                detail: You do not have permission to perform this action.
  /api/v2/account/analytics/service_analytics/:
    post:
      tags:
      - Analytics
      summary: Get Service Analytics
      description: Returns incident metrics for each service.
      requestBody:
        description: Optional filter parameters
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AnalyticsRequestBody'
            example:
              from_date: '2025-09-24'
              to_date: '2025-12-23'
              team_ids: []
              service_ids: []
              user_ids: []
              priority_ids: []
              sla_ids: []
              escalation_policy_ids: []
              tag_ids: []
              urgency: ''
              child_incident: include
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceAnalyticsResponse'
              example:
                all_services:
                  total_incidents: 500
                  total_acknowledged: 400
                  total_resolved: 300
                  mtta_seconds: 120.5
                  mttr_seconds: 3600
                service_records:
                - team:
                    name: Platform Team
                    unique_id: abc-def-123
                  service:
                    name: API Gateway
                    unique_id: xyz-789
                  total_incidents: 100
                  total_acknowledged: 80
                  total_resolved: 60
                  mtta_seconds: 90.2
                  mttr_seconds: 2400
        '403':
          description: Forbidden
          content:
            application/json:
              example:
                detail: You do not have permission to perform this action.
  /api/v2/account/analytics/user_analytics/:
    post:
      tags:
      - Analytics
      summary: Get User Analytics
      description: Returns incident metrics for each user.
      requestBody:
        description: Optional filter parameters
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AnalyticsRequestBody'
            example:
              from_date: '2025-09-24'
              to_date: '2025-12-23'
              team_ids: []
              service_ids: []
              user_ids: []
              priority_ids: []
              sla_ids: []
              escalation_policy_ids: []
              tag_ids: []
              urgency: ''
              child_incident: include
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserAnalyticsResponse'
              example:
                all_users:
                  total_incidents: 500
                  total_acknowledged: 400
                  total_resolved: 300
                  mtta_seconds: 120.5
                  mttr_seconds: 3600
                user_records:
                - user:
                    full_name: Jane Doe
                    username: jane.doe
                  total_incidents: 100
                  total_acknowledged: 80
                  total_resolved: 60
                  mtta_seconds: 90.2
                  mttr_seconds: 2400
        '403':
          description: Forbidden
          content:
            application/json:
              example:
                detail: You do not have permission to perform this action.
components:
  schemas:
    AnalyticsServiceInfo:
      type: object
      properties:
        name:
          type: string
          description: Service name.
        unique_id:
          type: string
          format: uuid
          description: Service unique identifier.
    AnalyticsMetrics:
      type: object
      description: Common analytics metrics.
      properties:
        total_incidents:
          type: integer
          description: Total incidents.
        total_acknowledged:
          type: integer
          description: Incidents with status > 1 (acknowledged or resolved).
        total_resolved:
          type: integer
          description: Incidents with status = 3.
        mtta_seconds:
          type: number
          format: float
          description: Weighted average Mean Time to Acknowledge in seconds.
        mttr_seconds:
          type: number
          format: float
          description: Weighted average Mean Time to Resolve in seconds.
    UserAnalyticsResponse:
      type: object
      properties:
        all_users:
          $ref: '#/components/schemas/AnalyticsMetrics'
        user_records:
          type: array
          items:
            $ref: '#/components/schemas/UserAnalyticsRecord'
    TeamAnalyticsRecord:
      type: object
      properties:
        team:
          $ref: '#/components/schemas/AnalyticsTeamInfo'
        total_incidents:
          type: integer
        total_acknowledged:
          type: integer
        total_resolved:
          type: integer
        mtta_seconds:
          type: number
          format: float
        mttr_seconds:
          type: number
          format: float
    AnalyticsUserInfo:
      type: object
      properties:
        full_name:
          type: string
          description: User's full name (first + last name).
        username:
          type: string
          description: Username.
    ServiceAnalyticsRecord:
      type: object
      properties:
        team:
          $ref: '#/components/schemas/AnalyticsTeamInfo'
        service:
          $ref: '#/components/schemas/AnalyticsServiceInfo'
        total_incidents:
          type: integer
        total_acknowledged:
          type: integer
        total_resolved:
          type: integer
        mtta_seconds:
          type: number
          format: float
        mttr_seconds:
          type: number
          format: float
    TeamAnalyticsResponse:
      type: object
      properties:
        all_teams:
          $ref: '#/components/schemas/AnalyticsMetrics'
        team_records:
          type: array
          items:
            $ref: '#/components/schemas/TeamAnalyticsRecord'
    IncidentStatsResponse:
      type: object
      description: Aggregate incident counts for the account and for the requesting user.
      properties:
        total_incidents:
          type: integer
          description: Total incidents matching filters.
        total_triggered_incidents:
          type: integer
          description: Incidents with status = triggered (1).
        total_acknowledged_incidents:
          type: integer
          description: Incidents with status = acknowledged (2).
        total_resolved_incidents:
          type: integer
          description: Incidents with status = resolved (3).
        user_total_incidents:
          type: integer
          description: Incidents assigned to the requesting user.
        user_triggered_incidents:
          type: integer
          description: User's incidents with status = triggered.
        user_acknowledged_incidents:
          type: integer
          description: User's incidents with status = acknowledged.
        user_resolved_incidents:
          type: integer
          description: User's incidents with status = resolved.
    UserAnalyticsRecord:
      type: object
      properties:
        user:
          $ref: '#/components/schemas/AnalyticsUserInfo'
        total_incidents:
          type: integer
        total_acknowledged:
          type: integer
        total_resolved:
          type: integer
        mtta_seconds:
          type: number
          format: float
        mttr_seconds:
          type: number
          format: float
    ServiceAnalyticsResponse:
      type: object
      properties:
        all_services:
          $ref: '#/components/schemas/AnalyticsMetrics'
        service_records:
          type: array
          items:
            $ref: '#/components/schemas/ServiceAnalyticsRecord'
    AnalyticsTeamInfo:
      type: object
      properties:
        name:
          type: string
          description: Team name.
        unique_id:
          type: string
          format: uuid
          description: Team unique identifier.
    AnalyticsRequestBody:
      type: object
      description: Common request body for all analytics endpoints. All fields are optional.
      properties:
        from_date:
          type: string
          format: date
          description: Start date in YYYY-MM-DD format
          example: '2025-09-24'
        to_date:
          type: string
          format: date
          description: End date in YYYY-MM-DD format
          example: '2025-12-23'
        team_ids:
          type: array
          items:
            type: string
            format: uuid
          description: List of team unique_id UUIDs. Empty array means all accessible teams.
        service_ids:
          type: array
          items:
            type: string
            format: uuid
          description: List of service unique_id UUIDs.
        user_ids:
          type: array
          items:
            type: string
          description: List of usernames. Use "Unassigned" to filter unassigned incidents.
        priority_ids:
          type: array
          items:
            type: string
            format: uuid
          description: List of team priority unique_id UUIDs.
        sla_ids:
          type: array
          items:
            type: string
            format: uuid
          description: List of SLA unique_id UUIDs.
        escalation_policy_ids:
          type: array
          items:
            type: string
            format: uuid
          description: List of escalation policy unique_id UUIDs.
        tag_ids:
          type: array
          items:
            type: string
            format: uuid
          description: List of team tag unique_id UUIDs.
        urgency:
          description: 0 for low, 1 for high.
          example: '1'
        child_incident:
          type: string
          description: Set to "exclude" to exclude merged child incidents. Any other value has no effect.
          example: include
        tta:
          type: number
          description: Time-to-acknowledge threshold in seconds. Requires tta_comparator.
        tta_comparator:
          type: string
          enum:
          - gt
          - lt
          description: Required if tta is set.
        ttr:
          type: number
          description: Time-to-resolve threshold in seconds. Requires ttr_comparator. Must be >= tta if both are set.
        ttr_comparator:
          type: string
          enum:
          - gt
          - lt
          description: Required if ttr is set.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: Token <api_key>