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

# upsertTimeEntry

> Use `upsertTimeEntry` to update an existing time entry or to insert a new time entry for an employee

### When to use:
- When an employee forgets to clock in or clock out for a shift
- When an employee forgets to add a break in a shift
- When the clock in or clock out time for a shift needs amending

### What it does:
- Inserts a time entry if no existing timeEntryId is provided
- Updates an exiting time entry if a timeEntryId is provided
- Ensures there is no overlap between inserted and updated time entries and any other shifts on the same day
- Triggers time card recalculation in accordance with the overtime rules for the policy

### Note:
- To remove a shift entirely use the `deleteTimeEntry` API
- Use workDate when inserting a timeEntry, and timeEntryId when updating an existing time entry



## OpenAPI

````yaml post /adminPortal/upsertTimeEntry
openapi: 3.1.0
info:
  title: Default module
  description: |
    Webhook events emitted when a company's KYB status is created or changes.

    Rollfi sends these requests to the webhook URL configured for the client.
    Consumers should return a successful 2xx response after accepting the event.
  version: 1.0.0
servers: []
security: []
tags:
  - name: Admin Portal
  - name: TimeOff Admin
  - name: TimeTracking Admin
  - name: TimeOff User
  - name: TimeTracking User
  - name: TimeTracking Reports
  - name: TimeOff Reports
  - name: Pay Schedule Webhooks
  - name: Pay Period Webhooks
  - name: Employee Bank Account Webhooks
  - name: Employee KYC Webhooks
  - name: Company Bank Account Webhooks
  - name: Company Webhooks
  - name: Employee Status Webhooks
paths:
  /adminPortal/upsertTimeEntry:
    post:
      tags:
        - TimeTracking Admin
      summary: upsertTimeEntry
      description: >-
        Use `upsertTimeEntry` to update an existing time entry or to insert a
        new time entry for an employee


        ### When to use:

        - When an employee forgets to clock in or clock out for a shift

        - When an employee forgets to add a break in a shift

        - When the clock in or clock out time for a shift needs amending


        ### What it does:

        - Inserts a time entry if no existing timeEntryId is provided

        - Updates an exiting time entry if a timeEntryId is provided

        - Ensures there is no overlap between inserted and updated time entries
        and any other shifts on the same day

        - Triggers time card recalculation in accordance with the overtime rules
        for the policy


        ### Note:

        - To remove a shift entirely use the `deleteTimeEntry` API

        - Use workDate when inserting a timeEntry, and timeEntryId when updating
        an existing time entry
      operationId: upsertTimeEntry
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                method:
                  type: string
                userId:
                  type: string
                companyId:
                  type: string
                timeEntry:
                  type: object
                  properties:
                    timeEntryId:
                      type: string
                    workDate:
                      type: string
                    clockInTime:
                      type: string
                    clockOutTime:
                      type: string
                    breaks:
                      type: array
                      items:
                        type: object
                        properties:
                          breakStart:
                            type: string
                          breakEnd:
                            type: string
                        required:
                          - breakStart
                          - breakEnd
                  required:
                    - clockInTime
                    - clockOutTime
              required:
                - method
                - userId
                - companyId
                - timeEntry
            examples:
              '1':
                value:
                  method: upsertTimeEntry
                  userId: C4CA148F-F2C6-4E70-8349-57CC6DFC1C2B
                  companyId: 5221FFCF-E84B-4690-B7DC-DE29D549096B
                  timeEntry:
                    timeEntryId: D70A1260-A592-4A5D-B0E5-36E02AF1BC4C
                    clockInTime: '9:00:00'
                    clockOutTime: '20:30:00'
                    breaks:
                      - breakStart: '12:00:00'
                        breakEnd: '12:45:00'
                      - breakStart: '16:00:00'
                        breakEnd: '16:30:00'
                summary: Update
              '2':
                value:
                  method: upsertTimeEntry
                  userId: C4CA148F-F2C6-4E70-8349-57CC6DFC1C2B
                  companyId: 5221FFCF-E84B-4690-B7DC-DE29D549096B
                  timeEntry:
                    workDate: '2026-03-22'
                    clockInTime: '9:00:00'
                    clockOutTime: '20:30:00'
                    breaks:
                      - breakStart: '12:00:00'
                        breakEnd: '12:45:00'
                      - breakStart: '16:00:00'
                        breakEnd: '16:30:00'
                summary: Insert
      responses:
        '200':
          description: Time entry upserted
          content:
            application/json:
              schema:
                type: object
                properties:
                  timeEntry:
                    type: object
                    properties:
                      timeEntryId:
                        type: string
                      status:
                        type: string
                      message:
                        type: string
                    required:
                      - timeEntryId
                      - status
                      - message
                required:
                  - timeEntry
              examples:
                '1':
                  summary: Update
                  value:
                    timeEntry:
                      timeEntryId: D70A1260-A592-4A5D-B0E5-36E02AF1BC4C
                      status: Ready
                      message: Time entry updated successfully.
                '2':
                  summary: Insert
                  value:
                    timeEntry:
                      timeEntryId: 4081DFA4-17CA-42EE-89C4-C76AA8F2BC2E
                      status: Ready
                      message: Time entry inserted successfully.
          headers: {}
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: integer
                      message:
                        type: string
                    required:
                      - code
                      - message
                required:
                  - error
              example:
                error:
                  code: 400
                  message: 'Time entry overlaps with existing entry: 09:00:00 - 20:30:00'
          headers: {}
      deprecated: false
      security: []

````