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

# Fetch Timeline

> Fetch per-user activity timeline for a selected day and optional hour filter. Returns paginated results with totalActiveUsers for load-more support.




## OpenAPI

````yaml /openapi.yaml post /v1/proof-of-work/timeline
openapi: 3.1.0
info:
  title: Trackpilots API & Webhooks
  version: 1.1.0
  description: >
    Trackpilots REST APIs and Webhook events.

    Webhooks are sent by the Trackpilots desktop agent to customer-configured
    endpoints.

    Clients only send `secret_key`. All other fields are generated by the
    server.
servers:
  - url: https://api.trackpilots.com
    description: Production server
security: []
tags:
  - name: Teams
    description: Team management APIs
  - name: Desktop Events
    description: Desktop agent webhook events
paths:
  /v1/proof-of-work/timeline:
    post:
      tags:
        - Proof Of Work
      summary: Fetch Timeline
      description: >
        Fetch per-user activity timeline for a selected day and optional hour
        filter. Returns paginated results with totalActiveUsers for load-more
        support.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FetchPowTimelineRequest'
      responses:
        '200':
          description: Fetched timeline successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/200FetchPowTimelineResponse'
        '400':
          description: Request validation failed
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/400FetchPowTimelineValidationErrorResponse
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '422':
          $ref: '#/components/responses/422UnprocessableUserIdorTeamIdErrorResponse'
        '500':
          $ref: '#/components/responses/InternalServerError'
      security:
        - BearerAuth: []
components:
  schemas:
    FetchPowTimelineRequest:
      type: object
      description: >
        Request payload to fetch the activity timeline for a day. Either userId
        or teamId must be provided. Both cannot be empty.
      required:
        - timeZone
        - startDate
        - endDate
      properties:
        startDate:
          type: string
          format: date-time
          example: '2026-02-08 00:00:00'
        endDate:
          type: string
          format: date-time
          example: '2026-02-08 23:59:59'
        timeZone:
          type: string
          example: Asia/Kolkata
          description: IANA timezone of the requester
        offset:
          type: integer
          description: Page number for pagination (1-based). Defaults to 1.
          minimum: 1
          example: 1
        userId:
          type: array
          description: List of user UUIDs to fetch timeline for
          items:
            type: string
            format: uuid
            example: ab7c4f30-1024-471a-a767-739df0dc53fd
        teamId:
          type: array
          description: List of team UUIDs to fetch timeline for
          items:
            type: string
            format: uuid
            example: 3d4c2ced-f4d6-42ea-b6db-7dcf24a77845
      anyOf:
        - required:
            - userId
        - required:
            - teamId
    200FetchPowTimelineResponse:
      type: object
      properties:
        statusCode:
          type: integer
          example: 200
        statusMessage:
          type: string
          example: Fetched timeline successfully
        error:
          nullable: true
          example: null
        response:
          type: object
          properties:
            totalActiveUsers:
              type: integer
              description: Total number of users with timeline data (used for pagination)
              example: 8
            usersList:
              type: array
              items:
                type: object
                properties:
                  userId:
                    type: string
                    format: uuid
                    example: ab7c4f30-1024-471a-a767-739df0dc53fd
                  userName:
                    type: string
                    example: Sakthivel Govinthan
                  emailId:
                    type: string
                    format: email
                    example: sakthivel@example.com
                  profilePicUrl:
                    type: string
                    nullable: true
                    example: https://trackpilots.s3.amazonaws.com/profile-pic/xxx.png
                  productiveTimeSpend:
                    type: integer
                    description: Productive time in seconds
                    example: 14288
                  unProductiveTimeSpend:
                    type: integer
                    description: Unproductive time in seconds
                    example: 0
                  neutralTimeSpend:
                    type: integer
                    description: Neutral time in seconds
                    example: 2499
                  idleTimeSpend:
                    type: integer
                    description: Idle time in seconds
                    example: 1645
                  appTrackingDetails:
                    type: array
                    description: >-
                      Chronological list of app activity segments for the
                      timeline chart
                    items:
                      type: object
                      properties:
                        category:
                          type: string
                          enum:
                            - productive
                            - neutral
                            - unproductive
                            - idle
                          example: productive
                        appName:
                          type: string
                          example: Google Chrome
                        title:
                          type: string
                          example: GitHub - trackpilots/trackpilots-web-app
                        startTime:
                          type: string
                          format: date-time
                          example: '2026-02-08T04:32:01.000Z'
                        endTime:
                          type: string
                          format: date-time
                          example: '2026-02-08T04:45:22.000Z'
    400FetchPowTimelineValidationErrorResponse:
      type: object
      properties:
        statusCode:
          type: integer
          example: 400
        statusMessage:
          type: string
          example: Failed to fetch timeline data
        error:
          type: object
          properties:
            message:
              type: string
              example: Request body is not valid
            code:
              type: string
              example: REQUEST_VALIDATION_FAILED
            details:
              type: array
              items:
                type: object
                properties:
                  path:
                    type: array
                    items:
                      type: string
                    example:
                      - userId
                  message:
                    type: string
                    example: Either userId or teamId must be provided
    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          example: false
        statusCode:
          type: integer
          format: int32
          example: 401
        statusMessage:
          type: string
          example: Authentication failed
        data:
          nullable: true
          example: null
        error:
          type: object
          properties:
            message:
              type: string
              example: Authorization header is missing
            code:
              type: string
              enum:
                - AUTHORIZATION_HEADER_MISSING
                - INVALID_API_KEY_SCHEMA
                - API_KEY_MISSING
                - INVALID_API_KEY
                - PLAN_EXPIRED
              example: AUTHORIZATION_HEADER_MISSING
    422UnprocessableUserIdorTeamIdErrorSchema:
      type: object
      properties:
        success:
          type: boolean
          example: false
        statusCode:
          type: integer
          format: int32
          example: 422
        statusMessage:
          type: string
          example: Invalid userId
        response:
          nullable: true
          example: null
        error:
          type: object
          properties:
            message:
              type: string
              example: Provided userId does not exist for this organisation
            code:
              type: string
              enum:
                - INVALID_USER_ID
                - INVALID_TEAM_ID
              example: INVALID_USER_ID
    InternalServerError:
      allOf:
        - $ref: '#/components/schemas/BaseError'
        - type: object
          properties:
            statusCode:
              example: 500
            statusMessage:
              example: Internal server error
            error:
              type: object
              properties:
                message:
                  example: Some technical error has occurred !!
                code:
                  example: UNKNOWN_SERVER_ERROR
    BaseError:
      type: object
      properties:
        success:
          type: boolean
          example: false
        statusCode:
          type: integer
        statusMessage:
          type: string
        data:
          nullable: true
          example: null
        error:
          type: object
          properties:
            message:
              type: string
            code:
              type: string
  responses:
    UnauthorizedError:
      description: Authentication & Authorization errors
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            authorizationHeaderMissing:
              summary: Authorization header missing
              value:
                success: false
                statusCode: 401
                statusMessage: Authentication token header is missing
                data: null
                error:
                  message: Authorization header is missing
                  code: AUTHORIZATION_HEADER_MISSING
            invalidAuthorizationScheme:
              summary: Invalid authorization scheme
              value:
                success: false
                statusCode: 401
                statusMessage: Invalid authentication token schema
                data: null
                error:
                  message: Authorization header must start with 'Bearer'
                  code: INVALID_API_KEY_SCHEMA
            apiKeyMissing:
              summary: API key missing
              value:
                success: false
                statusCode: 401
                statusMessage: Authentication token is missing
                data: null
                error:
                  message: API key value is missing
                  code: API_KEY_MISSING
            invalidApiKey:
              summary: Invalid or inactive API key
              value:
                success: false
                statusCode: 401
                statusMessage: Authentication failed
                data: null
                error:
                  message: Provided API key is invalid or inactive
                  code: INVALID_API_KEY
            planExpired:
              summary: Upgrade required
              value:
                success: false
                statusCode: 401
                statusMessage: Upgrade required
                data: null
                error:
                  message: Upgrade required to use Trackpilots APIs
                  code: PLAN_EXPIRED
    422UnprocessableUserIdorTeamIdErrorResponse:
      description: Unprocessable Entity – Invalid userId or teamIds
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/422UnprocessableUserIdorTeamIdErrorSchema'
          examples:
            invalidUserId:
              summary: Invalid userId
              value:
                success: false
                statusCode: 422
                statusMessage: Invalid userId
                response: null
                error:
                  message: Provided userId does not exist for this organisation
                  code: INVALID_USER_ID
            invalidTeamId:
              summary: Invalid teamId
              value:
                success: false
                statusCode: 422
                statusMessage: Invalid teamId
                response: null
                error:
                  message: One or more teamIds are invalid for this organisation
                  code: INVALID_TEAM_ID
    InternalServerError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/InternalServerError'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````