Laurel Activities API

The Activities API from Laurel — 16 operation(s) for activities.

OpenAPI Specification

laurel-activities-api-openapi.yml Raw ↑
openapi: 3.0.0
info:
  title: Identity Service Ably Activities API
  description: ''
  version: '1'
  contact: {}
servers: []
security:
- ApiBearerAuth: []
tags:
- name: Activities
paths:
  /api/v1/activities/track-from-service:
    post:
      operationId: ActivityController_trackOneFromService_v1
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TrackOneUserActivityDto'
      responses:
        '201':
          description: ''
          content:
            application/json:
              schema:
                oneOf:
                - $ref: '#/components/schemas/TimerActivityDto'
                - $ref: '#/components/schemas/TrackedActivityDto'
                - $ref: '#/components/schemas/UserActivityDto'
      summary: Creates a tracked Activity with customerId and userId returns the new Activity
      tags:
      - Activities
  /api/v1/activities/update-from-service:
    post:
      operationId: ActivityController_updateOneFromService_v1
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateOneActivityFromServiceDto'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                oneOf:
                - $ref: '#/components/schemas/TimerActivityDto'
                - $ref: '#/components/schemas/TrackedActivityDto'
                - $ref: '#/components/schemas/UserActivityDto'
      summary: Updates an already-tracked Activity located by (customerId, externalId), for service backfill
      tags:
      - Activities
  /api/v1/activities/track-from-agent:
    post:
      operationId: ActivityController_trackOne_v1
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TrackOneActivityDto'
      responses:
        '201':
          description: ''
          content:
            application/json:
              schema:
                oneOf:
                - $ref: '#/components/schemas/TimerActivityDto'
                - $ref: '#/components/schemas/TrackedActivityDto'
                - $ref: '#/components/schemas/UserActivityDto'
      summary: Creates a tracked Activity for a given user
      tags:
      - Activities
  /api/v1/activities:
    post:
      operationId: ActivityController_create_v1
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateUserActivityDto'
      responses:
        '201':
          description: ''
          content:
            application/json:
              schema:
                oneOf:
                - $ref: '#/components/schemas/TimerActivityDto'
                - $ref: '#/components/schemas/TrackedActivityDto'
                - $ref: '#/components/schemas/UserActivityDto'
      summary: Creates a new Activity for a given user
      tags:
      - Activities
    get:
      operationId: ActivityController_findMany_v1
      parameters:
      - name: startedBefore
        required: true
        in: query
        description: the date to get activities that their started at time is less than this date
        schema:
          format: iso-date-time
          example: '2022-08-12T20:44:48Z'
          type: string
      - name: stoppedAfter
        required: true
        in: query
        description: the date to get activities that their stopped at time is greater than this date
        schema:
          format: iso-date-time
          example: '2022-08-12T20:44:48Z'
          type: string
      - name: includeDeleted
        required: false
        in: query
        description: if true, include soft-deleted activities; defaults to excluding them
        schema:
          nullable: true
          type: boolean
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/Activity'
                type: array
      summary: Returns activities within a specified time range for a given user
      tags:
      - Activities
  /api/v1/activities/dismiss-open-time:
    post:
      operationId: ActivityController_dismissOpenTime_v1
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DismissOpenTimeRequestDto'
      responses:
        '201':
          description: ''
          content:
            application/json:
              schema:
                oneOf:
                - $ref: '#/components/schemas/TimerActivityDto'
                - $ref: '#/components/schemas/TrackedActivityDto'
                - $ref: '#/components/schemas/UserActivityDto'
      summary: 'Dismisses a slice of open time by creating a soft-deleted user activity

        that fills the gap. Open time is derived from the gaps between activities,

        so filling the gap is what removes it. Emits no events.'
      tags:
      - Activities
  /api/v1/activities/timer:
    post:
      operationId: ActivityController_createTimerActivity_v1
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateTimerActivityDto'
      responses:
        '201':
          description: ''
          content:
            application/json:
              schema:
                oneOf:
                - $ref: '#/components/schemas/TimerActivityDto'
                - $ref: '#/components/schemas/TrackedActivityDto'
                - $ref: '#/components/schemas/UserActivityDto'
      summary: Creates a new Timer Activity, optionally adding it to an existing entry
      tags:
      - Activities
  /api/v2/activities:
    get:
      operationId: ActivityController_findManyActivityDtos_v2
      parameters:
      - name: userId
        required: true
        in: query
        description: the user whose entries you are searching for
        schema:
          format: objectid
          type: string
      - name: customerId
        required: true
        in: query
        description: the user's customer
        schema:
          format: objectid
          type: string
      - name: startedBefore
        required: true
        in: query
        description: the date to get activities that their started at time is less than this date
        schema:
          format: iso-date-time
          example: '2022-08-12T20:44:48Z'
          type: string
      - name: stoppedAfter
        required: true
        in: query
        description: the date to get activities that their stopped at time is greater than this date
        schema:
          format: iso-date-time
          example: '2022-08-12T20:44:48Z'
          type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                items:
                  oneOf:
                  - $ref: '#/components/schemas/TimerActivityDto'
                  - $ref: '#/components/schemas/TrackedActivityDto'
                  - $ref: '#/components/schemas/UserActivityDto'
                type: array
      summary: Returns activities within a specified time range for a given user
      tags:
      - Activities
  /api/v3/activities:
    get:
      operationId: ActivityController_findManyActivityDtosWithPagination_v3
      parameters:
      - name: pageSize
        required: false
        in: query
        description: max number of item in each page
        schema:
          minimum: 1
          maximum: 100
          format: int64
          type: number
      - name: cursor
        required: false
        in: query
        description: cursor to start from
        schema:
          format: objectid
          type: string
      - name: userId
        required: true
        in: query
        description: the user whose entries you are searching for
        schema:
          format: objectid
          type: string
      - name: customerId
        required: true
        in: query
        description: the user's customer
        schema:
          format: objectid
          type: string
      - name: startedBefore
        required: true
        in: query
        description: the date to get activities that their started at time is less than this date
        schema:
          format: iso-date-time
          example: '2022-08-12T20:44:48Z'
          type: string
      - name: stoppedAfter
        required: true
        in: query
        description: the date to get activities that their stopped at time is greater than this date
        schema:
          format: iso-date-time
          example: '2022-08-12T20:44:48Z'
          type: string
      - name: clientId
        required: false
        in: query
        description: optional client filter
        schema:
          format: objectid
          nullable: true
          type: string
      - name: creationMethod
        required: false
        in: query
        description: optional activity creation method filter
        schema:
          nullable: true
          type: string
          enum:
          - timer
          - tracked
          - user
      - name: category
        required: false
        in: query
        description: optional category filter matching activity.category or captureSource.activityCategory
        schema:
          nullable: true
          type: string
          enum:
          - call
          - chat
          - doc
          - email
          - meeting
          - web
          - terminal
          - app
      - name: initiativeId
        required: false
        in: query
        description: optional initiative filter
        schema:
          format: objectid
          nullable: true
          type: string
      - name: billingType
        required: false
        in: query
        description: optional initiative billing type filter
        schema:
          nullable: true
          type: string
          enum:
          - billable
          - non-billable
      - name: isLocked
        required: false
        in: query
        description: optional lock state filter
        schema:
          nullable: true
          type: boolean
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                properties:
                  items:
                    items:
                      oneOf:
                      - $ref: '#/components/schemas/TimerActivityDto'
                      - $ref: '#/components/schemas/TrackedActivityDto'
                      - $ref: '#/components/schemas/UserActivityDto'
                    type: array
                  nextCursor:
                    type: string
                type: object
      summary: Returns paginated activities within a specified time range for a given user using cursor-based pagination
      tags:
      - Activities
  /api/v1/activities/with-metadata:
    get:
      operationId: ActivityController_findManyWithMetadata_v1
      parameters:
      - name: startedBefore
        required: true
        in: query
        description: the date to get activities that their started at time is less than this date
        schema:
          format: iso-date-time
          example: '2022-08-12T20:44:48Z'
          type: string
      - name: stoppedAfter
        required: true
        in: query
        description: the date to get activities that their stopped at time is greater than this date
        schema:
          format: iso-date-time
          example: '2022-08-12T20:44:48Z'
          type: string
      - name: includeDeleted
        required: false
        in: query
        description: if true, include soft-deleted activities; defaults to excluding them
        schema:
          nullable: true
          type: boolean
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ActivityWithMetadataResponseDto'
      summary: Returns activities joined with their capture metadata (incl. workContext) within a time range for a given user
      tags:
      - Activities
  /api/v1/activities/{activityId}:
    delete:
      operationId: ActivityController_deleteActivityById_v1
      parameters:
      - name: activityId
        required: true
        in: path
        description: individual activity id
        schema:
          format: objectid
          type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
      summary: Deletes an Activity by Id and returns the deleted Activity
      tags:
      - Activities
    patch:
      operationId: ActivityController_updateOneById_v1
      parameters:
      - name: activityId
        required: true
        in: path
        description: individual activity id
        schema:
          format: objectid
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateOneActivityDto'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                oneOf:
                - $ref: '#/components/schemas/TimerActivityDto'
                - $ref: '#/components/schemas/TrackedActivityDto'
                - $ref: '#/components/schemas/UserActivityDto'
      summary: Updates an existing Activity for a given user
      tags:
      - Activities
  /api/v1/activities/archive:
    post:
      operationId: ActivityController_archiveActivities_v1
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ArchiveActivitiesRequestDto'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BatchActivityResultResponseDto'
      summary: Archives (soft-deletes) many Activities by id — sets isDeleted, emits activity-updated, skips locked/missing
      tags:
      - Activities
  /api/v1/activities/unarchive:
    post:
      operationId: ActivityController_unarchiveActivities_v1
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ArchiveActivitiesRequestDto'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BatchActivityResultResponseDto'
      summary: Unarchives (revives) many soft-deleted Activities by id — clears isDeleted, emits activity-updated, skips locked/missing
      tags:
      - Activities
  /api/v1/activities/signal-backfill:
    post:
      operationId: ActivityController_enqueueSignalActivityBackfill_v1
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SignalActivityBackfillRequestDto'
      responses:
        '202':
          description: ''
      summary: 'Enqueues a background job that re-emits ActivityCreatedForSignal events for

        every activity of the given customer started within the date range. Guarded

        by the cross-customer activity read permission held by super-laurel-admins.'
      tags:
      - Activities
  /api/v1/activities/copy-from/customers/{customerId}/users/{userId}:
    post:
      operationId: ActivityController_copyActivities_v1
      parameters:
      - name: customerId
        required: true
        in: path
        description: customer's id
        schema:
          format: objectid
          type: string
      - name: userId
        required: true
        in: path
        description: user's id
        schema:
          format: objectid
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CopyActivitiesRequestDto'
      responses:
        '201':
          description: ''
      tags:
      - Activities
  /api/v1/customers/{customerId}/users/{userId}/activities:
    get:
      operationId: CustomerActivityController_findMany_v1
      parameters:
      - name: customerId
        required: true
        in: path
        description: customer's id
        schema:
          format: objectid
          type: string
      - name: userId
        required: true
        in: path
        description: user's id
        schema:
          format: objectid
          type: string
      - name: startedBefore
        required: true
        in: query
        description: the date to get activities that their started at time is less than this date
        schema:
          format: iso-date-time
          example: '2022-08-12T20:44:48Z'
          type: string
      - name: stoppedAfter
        required: true
        in: query
        description: the date to get activities that their stopped at time is greater than this date
        schema:
          format: iso-date-time
          example: '2022-08-12T20:44:48Z'
          type: string
      - name: includeDeleted
        required: false
        in: query
        description: if true, include soft-deleted activities; defaults to excluding them
        schema:
          nullable: true
          type: boolean
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                items:
                  oneOf:
                  - $ref: '#/components/schemas/TimerActivity'
                  - $ref: '#/components/schemas/TrackedActivity'
                  - $ref: '#/components/schemas/UserActivity'
                type: array
      summary: 'Allows a requester with TimeServicePermission.CustomerAnyUserAnyActivityRead (ie. Super Laurel Admin)

        to view activities from other Customer Users. This is used in the admin dashboard context.'
      tags:
      - Activities
  /api/v1/customers/{customerId}/users/{userId}/activities/{activityId}:
    get:
      operationId: CustomerActivityController_getActivity_v1
      parameters:
      - name: activityId
        required: true
        in: path
        description: individual activity id
        schema:
          format: objectid
          type: string
      - name: customerId
        required: true
        in: path
        description: customer's id
        schema:
          format: objectid
          type: string
      - name: userId
        required: true
        in: path
        description: user's id
        schema:
          format: objectid
          type: string
      - name: includeMetadata
        required: false
        in: query
        description: whether to include activity metadata in the response
        schema:
          type: boolean
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ActivityWithMetadataResponseDto'
      summary: Returns activity by activityId for a given customer and user
      tags:
      - Activities
    patch:
      operationId: CustomerActivityController_updateOne_v1
      parameters:
      - name: activityId
        required: true
        in: path
        description: individual activity id
        schema:
          format: objectid
          type: string
      - name: customerId
        required: true
        in: path
        description: customer's id
        schema:
          format: objectid
          type: string
      - name: userId
        required: true
        in: path
        description: user's id
        schema:
          format: objectid
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateOneCustomerActivityRequestDto'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Activity'
      tags:
      - Activities
components:
  schemas:
    UserActivityDto:
      type: object
      properties:
        _id:
          type: string
          description: activity's id
          format: objectid
        customerId:
          type: string
          description: id of customer who owns this activity
          format: objectid
        userId:
          type: string
          description: id of user who owns this activity
          format: objectid
        creationMethod:
          type: string
          enum:
          - user
        isLocked:
          type: boolean
          description: if true, this activity is locked and cannot be updated
        category:
          type: string
          description: category of this activity, if any
          nullable: true
        technology:
          type: string
          description: technology of this activity, if any
          nullable: true
        title:
          type: string
          description: activity's title
        detail:
          type: string
          description: activity's detail
        startedAt:
          type: string
          description: date and time this activity started
          example: '2022-08-12T20:44:48Z'
          format: iso-date-time
        stoppedAt:
          type: string
          description: date and time this activity stopped
          example: '2022-08-12T20:44:48Z'
          format: iso-date-time
        externalId:
          type: string
          description: activity's external id
          nullable: true
        assignedBy:
          description: how the activity's initiative was assigned
          enum:
          - none
          - user
          - ml
          type: string
        createdAt:
          type: string
          description: date and time activity was created
          example: '2022-08-12T20:44:48Z'
          format: iso-date-time
        updatedAt:
          type: string
          description: date and time activity was last updated
          example: '2022-08-12T20:44:48Z'
          format: iso-date-time
        threadId:
          type: string
          description: activity's thread id
          nullable: true
        enhancedByAi:
          type: boolean
          description: indicates if this activity was enhanced by AI
          nullable: true
        isCopiedByAdmin:
          type: boolean
          description: indicates if this activity was copied by admin
          nullable: true
        isSeeded:
          type: boolean
          description: indicates if this activity was created via seeding
          nullable: true
        disableThreading:
          type: boolean
          description: if true, disables threading for this activity
          nullable: true
        initiative:
          nullable: true
          oneOf:
          - $ref: '#/components/schemas/UserInitiativeDto'
          - $ref: '#/components/schemas/PmsInitiativeDto'
      required:
      - _id
      - customerId
      - userId
      - creationMethod
      - isLocked
      - title
      - detail
      - startedAt
      - stoppedAt
      - assignedBy
      - createdAt
      - updatedAt
    BatchActivityResultResponseDto:
      type: object
      properties:
        successes:
          description: activities whose isDeleted flag was updated
          type: array
          items:
            $ref: '#/components/schemas/BatchActivitySuccessDto'
        errors:
          description: activities that were skipped (not found or locked)
          type: array
          items:
            $ref: '#/components/schemas/BatchActivityErrorDto'
      required:
      - successes
      - errors
    UserInitiativeDto:
      type: object
      properties:
        _id:
          type: string
          description: initiative's id
          format: objectid
        billingType:
          description: initiative's billing type
          enum:
          - billable
          - non-billable
          type: string
        callSign:
          type: string
          description: a short name or abbreviation that identifies this initiative
        createdAt:
          type: string
          description: date and time this initiative was created
          example: '2022-08-12T20:44:48Z'
          format: iso-date-time
        locale:
          type: string
          description: BCP-47 locale for this initiative (e.g. en-US, fr-CA)
          enum:
          - da-DK
          - de-DE
          - en-CA
          - en-GB
          - en-US
          - es-ES
          - es-MX
          - fi-FI
          - fr-CA
          - fr-FR
          - is-IS
          - it-IT
          - ko-KR
          - nl-NL
          - no-NO
          - pt-PT
          - sv-SE
          nullable: true
        status:
          description: initiative's status
          enum:
          - active
          - inactive
          type: string
        unitIncrements:
          type: number
          description: unit of billing increments for this initiative
          format: double
        updatedAt:
          type: string
          description: date and time this initiative was last updated
          example: '2022-08-12T20:44:48Z'
          format: iso-date-time
        name:
          type: string
          description: a name that identifies this initiative for the user
        type:
          type: string
          enum:
          - user
        props:
          nullable: true
          type: object
          allOf:
          - $ref: '#/components/schemas/UserInitiativePropsDto'
      required:
      - _id
      - billingType
      - callSign
      - createdAt
      - status
      - unitIncrements
      - updatedAt
      - name
      - type
    UserActivity:
      type: object
      properties:
        _id:
          type: string
          description: activity's id
          format: objectid
        customerId:
          type: string
          description: id of customer who owns this activity
          format: objectid
        userId:
          type: string
          description: id of user who owns this activity
          format: objectid
        creationMethod:
          description: the creation method of the activity
          enum:
          - user
          type: string
        initiativeProps:
          description: if set, is activity's initiative, otherwise activity is unassigned
          nullable: true
          oneOf:
          - $ref: '#/components/schemas/PmsInitiativePropsDigest'
          - $ref: '#/components/schemas/UserInitiativePropsDigest'
        isLocked:
          type: boolean
          description: if true, this activity is locked and cannot be updated
        category:
          type: string
          description: category of this activity, if any
          nullable: true
        technology:
          type: string
          description: technology of this activity, if any
          nullable: true
        source:
          type: string
          description: source of this activity (e.g. 'macos', 'windows'), if any
          nullable: true
        mechanism:
          type: string
          description: mechanism of this activity (e.g. browser used to access web app), if any
          nullable: true
        title:
          type: string
          description: activity's title
        detail:
          type: string
          description: activity's detail
        startedAt:
          type: string
          description: date and time this activity started
          example: '2022-08-12T20:44:48Z'
          format: iso-date-time
        stoppedAt:
          type: string
          description: date and time this activity stopped
          example: '2022-08-12T20:44:48Z'
          format: iso-date-time
        externalId:
          type: string
          description: activity's external id
          nullable: true
        assignedBy:
          description: how the activity's initiative was assigned
          enum:
          - none
          - user
          - ml
          type: string
        createdAt:
          type: string
          description: date and time activity was created
          example: '2022-08-12T20:44:48Z'
          format: iso-date-time
        updatedAt:
          type: string
          description: date and time activity was last updated
          example: '2022-08-12T20:44:48Z'
          format: iso-date-time
        schemaVersion:
          type: string
          description: activities's schemaVersion
        threadId:
          type: string
          description: activity's thread id
          nullable: true
        enhancedByAi:
          type: boolean
          description: indicates if this activity was enhanced by AI
          nullable: true
        isCopiedByAdmin:
          type: boolean
          description: indicates if this activity was copied by admin
          nullable: true
        isSeeded:
          type: boolean
          description: indicates if this activity was created via seeding
          nullable: true
        deletedForRetentionAt:
          type: string
          description: date and time activity data was deleted for retention
          example: '2022-08-12T20:44:48Z'
          format: iso-date-time
          nullable: true
        isDeleted:
          type: boolean
          description: 'If true, this activity has been soft-deleted (e.g. it was the source of a

            split). Soft-deleted activities are excluded from the unassigned tray but

            remain restorable, which is what keeps a split reversible (undo/merge).'
          nullable: true
        disableThreading:
          type: boolean
          description: if true, disables threading for this activity
          nullable: true
        sessionIds:
          description: The session ids that were used to create this Activity
          nullable: true
          type: array
          items:
            type: string
            format: objectid
        splitFromActivityId:
          type: string
          description: 'If set, the id of the activity this one was split from. Child activities

            created by a split carry their source''s id here; it is the sibling key and

            the seam for a future undo/merge.'
          format: objectid
          nullable: true
      required:
      - _id
      - customerId
      - userId
      - creationMethod
      - isLocked
      - title
      - detail
      - startedAt
      - stoppedAt
      - assignedBy
      - createdAt
      - updatedAt
      - schemaVersion
    EmailMetadata:
      type: object
      properties:
        id:
          type: string
          description: The unique identifier for the email
          nullable: true
        subject:
          type: string
          description: The subject of the email
          nullable: true
        from:
          type: string
          description: Who this email was received from.
          nullable: true
        to:
          description: Who this email was sent to.
          nullable: true
          type: array
          items:
            type: string
        cc:
          description: Who was cc'd on this email.
          nullable: true
          type: array
          items:
            type: string
        bcc:
          description: Who was bcc'd on this email.
          nullable: true
          type: array
          items:
            type: string
        threadId:
          type: string
          description: The id associated with this email thread
          nullable: true
        threadIndex:
          type: string
          description: The thread index which is the position of this email in a thread.
          nullable: true
        threadIndexList:
          description: The list of thread indices representing the position of this email in a thread.
          nullable: true
          type: array
          items:
            type: string
        status:
          type: string
          descr

# --- truncated at 32 KB (100 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/laurel/refs/heads/main/openapi/laurel-activities-api-openapi.yml