> ## Documentation Index
> Fetch the complete documentation index at: https://docs-v2.sortx.co.uk/llms.txt
> Use this file to discover all available pages before exploring further.

# Events

> Service events (occurrences) with their booking, and the workspace's live counts



## OpenAPI

````yaml /openapi.json get /planned-maintenance/events
openapi: 3.1.0
info:
  title: SortX API
  version: 1.0.0
  description: >-
    Reactive repairs, planned maintenance, compliance and the repairs desk for
    UK letting agents and property managers.
servers:
  - url: https://api.sortx.co.uk
    description: Production
security: []
tags:
  - name: tenants
  - name: entitlements
  - name: events
  - name: workspace-settings
  - name: operational-catalogues
  - name: money
  - name: contacts
  - name: properties
  - name: address-lookup
  - name: tenancies
  - name: contractor-invoices
  - name: keys
  - name: inspections
  - name: handovers
  - name: planned-maintenance
  - name: contractors
  - name: documents
  - name: compliance
  - name: activity
  - name: tasks
  - name: today
  - name: reports
  - name: workspace-search
  - name: calendar
  - name: telephony
  - name: maintenance-pro
  - name: front-desk
  - name: maintenance-pro-public
  - name: maintenance-pro-contractor
paths:
  /planned-maintenance/events:
    get:
      tags:
        - planned-maintenance
      summary: Events
      description: >-
        Service events (occurrences) with their booking, and the workspace's
        live counts
      operationId: planned-maintenance.events
      parameters:
        - name: status
          in: query
          schema:
            anyOf:
              - type: string
              - type: 'null'
          required: false
        - name: programmeId
          in: query
          schema:
            anyOf:
              - type: string
              - type: 'null'
          required: false
        - name: propertyId
          in: query
          schema:
            anyOf:
              - type: string
              - type: 'null'
          required: false
        - name: blockId
          in: query
          schema:
            anyOf:
              - type: string
              - type: 'null'
          required: false
        - name: assetId
          in: query
          schema:
            anyOf:
              - type: string
              - type: 'null'
          required: false
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceEventPageRow'
        '400':
          description: >-
            TenantCreateRejected | ConfigMissing | IntegrationRejected |
            AuthRejected | RegistrationRejected | UnknownIntegration |
            WebhookUnroutable | RateUnavailable
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/TenantCreateRejectedEncoded'
                  - $ref: '#/components/schemas/ConfigMissingEncoded'
                  - $ref: '#/components/schemas/IntegrationRejectedEncoded'
                  - $ref: '#/components/schemas/AuthRejectedEncoded'
                  - $ref: '#/components/schemas/RegistrationRejectedEncoded'
                  - $ref: '#/components/schemas/UnknownIntegrationEncoded'
                  - $ref: '#/components/schemas/WebhookUnroutableEncoded'
                  - $ref: '#/components/schemas/RateUnavailableEncoded'
                  - $ref: '#/components/schemas/PlannedInputInvalid'
        '401':
          description: Unauthenticated | WebhookRejected | ApiKeyRejected
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/UnauthenticatedEncoded'
                  - $ref: '#/components/schemas/WebhookRejectedEncoded'
                  - $ref: '#/components/schemas/ApiKeyRejectedEncoded'
        '402':
          description: TenantSuspended
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TenantSuspendedEncoded'
        '403':
          description: >-
            EntitlementMissing | NotAMember | ScopeUnknown | ScopeMissing |
            TenantMismatch | WorkspaceOwnerRequired | WorkspaceRoleRequired
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/EntitlementMissingEncoded'
                  - $ref: '#/components/schemas/NotAMemberEncoded'
                  - $ref: '#/components/schemas/ScopeUnknownEncoded'
                  - $ref: '#/components/schemas/ScopeMissingEncoded'
                  - $ref: '#/components/schemas/TenantMismatchEncoded'
                  - $ref: '#/components/schemas/WorkspaceOwnerRequiredEncoded'
                  - $ref: '#/components/schemas/WorkspaceRoleRequiredEncoded'
        '404':
          description: TenantNotFound | ModuleRequestNotFound
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/TenantNotFoundEncoded'
                  - $ref: '#/components/schemas/ModuleRequestNotFoundEncoded'
        '409':
          description: WebhookDuplicate | RegistrationConflict | MoneyBusy
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/WebhookDuplicateEncoded'
                  - $ref: '#/components/schemas/RegistrationConflictEncoded'
                  - $ref: '#/components/schemas/MoneyBusyEncoded'
        '429':
          description: RateLimited
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RateLimitedEncoded'
        '503':
          description: IntegrationUnavailable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IntegrationUnavailableEncoded'
      security:
        - apiKey: []
components:
  schemas:
    ServiceEventPageRow:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/ServiceEventRow'
        counts:
          type: object
          properties:
            due:
              anyOf:
                - type: number
                - type: string
                  enum:
                    - Infinity
                    - '-Infinity'
                    - NaN
            overdue:
              anyOf:
                - type: number
                - type: string
                  enum:
                    - Infinity
                    - '-Infinity'
                    - NaN
            instructed:
              anyOf:
                - type: number
                - type: string
                  enum:
                    - Infinity
                    - '-Infinity'
                    - NaN
            booked:
              anyOf:
                - type: number
                - type: string
                  enum:
                    - Infinity
                    - '-Infinity'
                    - NaN
            awaitingReview:
              anyOf:
                - type: number
                - type: string
                  enum:
                    - Infinity
                    - '-Infinity'
                    - NaN
          required:
            - due
            - overdue
            - instructed
            - booked
            - awaitingReview
          additionalProperties: false
      required:
        - items
        - counts
      additionalProperties: false
    TenantCreateRejectedEncoded:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - TenantCreateRejected
        reason:
          type: string
        field:
          anyOf:
            - type: string
            - type: 'null'
      required:
        - _tag
        - reason
      additionalProperties: false
    ConfigMissingEncoded:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - ConfigMissing
        key:
          type: string
      required:
        - _tag
        - key
      additionalProperties: false
    IntegrationRejectedEncoded:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - IntegrationRejected
        integration:
          type: string
        reason:
          type: string
      required:
        - _tag
        - integration
        - reason
      additionalProperties: false
    AuthRejectedEncoded:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - AuthRejected
        code:
          type: string
        message:
          type: string
      required:
        - _tag
        - code
        - message
      additionalProperties: false
    RegistrationRejectedEncoded:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - RegistrationRejected
        message:
          type: string
        field:
          anyOf:
            - type: string
            - type: 'null'
      required:
        - _tag
        - message
      additionalProperties: false
    UnknownIntegrationEncoded:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - UnknownIntegration
        integration:
          type: string
      required:
        - _tag
        - integration
      additionalProperties: false
    WebhookUnroutableEncoded:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - WebhookUnroutable
        integration:
          type: string
        reason:
          type: string
      required:
        - _tag
        - integration
        - reason
      additionalProperties: false
    RateUnavailableEncoded:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - RateUnavailable
        base:
          type: string
        quote:
          type: string
        'on':
          type: string
      required:
        - _tag
        - base
        - quote
        - 'on'
      additionalProperties: false
    PlannedInputInvalid:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - PlannedInputInvalid
        field:
          type: string
        message:
          type: string
      required:
        - _tag
        - field
        - message
      additionalProperties: false
    UnauthenticatedEncoded:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - Unauthenticated
      required:
        - _tag
      additionalProperties: false
    WebhookRejectedEncoded:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - WebhookRejected
        integration:
          type: string
        reason:
          type: string
      required:
        - _tag
        - integration
        - reason
      additionalProperties: false
    ApiKeyRejectedEncoded:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - ApiKeyRejected
      required:
        - _tag
      additionalProperties: false
    TenantSuspendedEncoded:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - TenantSuspended
        tenantId:
          type: string
        reason:
          type: string
      required:
        - _tag
        - tenantId
        - reason
      additionalProperties: false
    EntitlementMissingEncoded:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - EntitlementMissing
        tenantId:
          type: string
        moduleId:
          type: string
      required:
        - _tag
        - tenantId
        - moduleId
      additionalProperties: false
    NotAMemberEncoded:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - NotAMember
        userId:
          type: string
        slug:
          type: string
      required:
        - _tag
        - userId
        - slug
      additionalProperties: false
    ScopeUnknownEncoded:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - ScopeUnknown
        scope:
          type: string
      required:
        - _tag
        - scope
      additionalProperties: false
    ScopeMissingEncoded:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - ScopeMissing
        scope:
          type: string
      required:
        - _tag
        - scope
      additionalProperties: false
    TenantMismatchEncoded:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - TenantMismatch
        header:
          type: string
        organizationId:
          type: string
      required:
        - _tag
        - header
        - organizationId
      additionalProperties: false
    WorkspaceOwnerRequiredEncoded:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - WorkspaceOwnerRequired
      required:
        - _tag
      additionalProperties: false
    WorkspaceRoleRequiredEncoded:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - WorkspaceRoleRequired
        role:
          anyOf:
            - type: string
            - type: 'null'
        required:
          type: array
          items:
            type: string
        message:
          type: string
      required:
        - _tag
        - role
        - required
        - message
      additionalProperties: false
    TenantNotFoundEncoded:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - TenantNotFound
        slug:
          type: string
      required:
        - _tag
        - slug
      additionalProperties: false
    ModuleRequestNotFoundEncoded:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - ModuleRequestNotFound
        id:
          type: string
      required:
        - _tag
        - id
      additionalProperties: false
    WebhookDuplicateEncoded:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - WebhookDuplicate
        integration:
          type: string
        externalId:
          type: string
      required:
        - _tag
        - integration
        - externalId
      additionalProperties: false
    RegistrationConflictEncoded:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - RegistrationConflict
        message:
          type: string
        field:
          anyOf:
            - type: string
            - type: 'null'
      required:
        - _tag
        - message
      additionalProperties: false
    MoneyBusyEncoded:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - MoneyBusy
        message:
          type: string
      required:
        - _tag
        - message
      additionalProperties: false
    RateLimitedEncoded:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - RateLimited
        key:
          type: string
        retryAfterSeconds:
          anyOf:
            - type: number
            - type: string
              enum:
                - Infinity
                - '-Infinity'
                - NaN
        message:
          type: string
      required:
        - _tag
        - key
        - retryAfterSeconds
        - message
      additionalProperties: false
    IntegrationUnavailableEncoded:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - IntegrationUnavailable
        integration:
          type: string
        detail:
          anyOf:
            - type: string
            - type: 'null'
      required:
        - _tag
        - integration
      additionalProperties: false
    ServiceEventRow:
      type: object
      properties:
        id:
          type: string
        programmeId:
          type: string
        programmeReference:
          type: string
        programmeName:
          type: string
        occurrence:
          anyOf:
            - type: number
            - type: string
              enum:
                - Infinity
                - '-Infinity'
                - NaN
        reference:
          type: string
        status:
          type: string
          enum:
            - due
            - instructed
            - booked
            - completed
            - cancelled
        reviewState:
          anyOf:
            - type: string
              enum:
                - pending
                - accepted
                - rejected
            - type: 'null'
        dueOn:
          type: string
        instructBy:
          type: string
        overdue:
          type: boolean
        revisit:
          type: boolean
        statutory:
          type: boolean
        propertyId:
          anyOf:
            - type: string
            - type: 'null'
        propertyLabel:
          anyOf:
            - type: string
            - type: 'null'
        blockId:
          anyOf:
            - type: string
            - type: 'null'
        blockLabel:
          anyOf:
            - type: string
            - type: 'null'
        assetId:
          anyOf:
            - type: string
            - type: 'null'
        assetLabel:
          anyOf:
            - type: string
            - type: 'null'
        complianceKind:
          anyOf:
            - type: string
              enum:
                - gas_safety
                - eicr
                - epc
                - smoke_co
            - type: 'null'
        contractorContactId:
          anyOf:
            - type: string
            - type: 'null'
        contractorName:
          anyOf:
            - type: string
            - type: 'null'
        instructedAt:
          anyOf:
            - type: string
            - type: 'null'
        instructionNotes:
          anyOf:
            - type: string
            - type: 'null'
        instructedAutomatically:
          type: boolean
        autoInstructSkippedReason:
          anyOf:
            - type: string
            - type: 'null'
        booking:
          anyOf:
            - type: object
              properties:
                appointmentId:
                  type: string
                status:
                  type: string
                  enum:
                    - held
                    - confirmed
                    - cancelled
                    - done
                startsAt:
                  type: string
                endsAt:
                  type: string
                staffId:
                  anyOf:
                    - type: string
                    - type: 'null'
                staffName:
                  anyOf:
                    - type: string
                    - type: 'null'
                revision:
                  anyOf:
                    - type: number
                    - type: string
                      enum:
                        - Infinity
                        - '-Infinity'
                        - NaN
              required:
                - appointmentId
                - status
                - startsAt
                - endsAt
                - staffId
                - staffName
                - revision
              additionalProperties: false
            - type: 'null'
        completedOn:
          anyOf:
            - type: string
            - type: 'null'
        completedAt:
          anyOf:
            - type: string
            - type: 'null'
        completedByUserId:
          anyOf:
            - type: string
            - type: 'null'
        completionNotes:
          anyOf:
            - type: string
            - type: 'null'
        reviewedAt:
          anyOf:
            - type: string
            - type: 'null'
        reviewedByUserId:
          anyOf:
            - type: string
            - type: 'null'
        reviewNotes:
          anyOf:
            - type: string
            - type: 'null'
        rejectionReason:
          anyOf:
            - type: string
            - type: 'null'
        remedialRepair:
          anyOf:
            - type: object
              properties:
                id:
                  type: string
                reference:
                  anyOf:
                    - type: string
                    - type: 'null'
              required:
                - id
                - reference
              additionalProperties: false
            - type: 'null'
        nextEventId:
          anyOf:
            - type: string
            - type: 'null'
        certificateDocumentId:
          anyOf:
            - type: string
            - type: 'null'
        costCodeId:
          anyOf:
            - type: string
            - type: 'null'
        cancelledAt:
          anyOf:
            - type: string
            - type: 'null'
        cancelReason:
          anyOf:
            - type: string
            - type: 'null'
        evidenceCount:
          anyOf:
            - type: number
            - type: string
              enum:
                - Infinity
                - '-Infinity'
                - NaN
        revision:
          anyOf:
            - type: number
            - type: string
              enum:
                - Infinity
                - '-Infinity'
                - NaN
        createdAt:
          type: string
        updatedAt:
          type: string
      required:
        - id
        - programmeId
        - programmeReference
        - programmeName
        - occurrence
        - reference
        - status
        - reviewState
        - dueOn
        - instructBy
        - overdue
        - revisit
        - statutory
        - propertyId
        - propertyLabel
        - blockId
        - blockLabel
        - assetId
        - assetLabel
        - complianceKind
        - contractorContactId
        - contractorName
        - instructedAt
        - instructionNotes
        - instructedAutomatically
        - autoInstructSkippedReason
        - booking
        - completedOn
        - completedAt
        - completedByUserId
        - completionNotes
        - reviewedAt
        - reviewedByUserId
        - reviewNotes
        - rejectionReason
        - remedialRepair
        - nextEventId
        - certificateDocumentId
        - costCodeId
        - cancelledAt
        - cancelReason
        - evidenceCount
        - revision
        - createdAt
        - updatedAt
      additionalProperties: false
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        A workspace API key (Settings → API keys), scoped to `<group>:read` /
        `<group>:write`.

````

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