> ## 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.

# addTimeOffPolicy

> The `addTimeOffPolicy` API adds a company-wide time off policy that can be assigned to employees

### Notes: 
- **earningMethod**, **waitingPeriodUnit** and **timeOffRecievedWhen** fields dictate when, and for how long, **timeOffPolicyAssignments** can be applied to employees
- multiple **timeOffPolicies** (even of the same type) can be added to a company
- timeOffPolicyTypes can be retrieved using the `getTimeOffPolicyTypes` API
- ** lumpSumHoursEarned** and ** accrualRatePerHour** are only necessary for Accrual PTO policies

----
After a **timeOffPolicy** is added to a company, employees must be assigned to it using `addTimeOffPolicyAssignment`




## OpenAPI

````yaml post /adminPortal/addTimeOffPolicy
openapi: 3.0.1
info:
  title: Default module
  description: ''
  version: 1.0.0
servers: []
security:
  - basic: []
tags: []
paths:
  /adminPortal/addTimeOffPolicy:
    post:
      tags: []
      summary: addTimeOffPolicy
      description: >
        The `addTimeOffPolicy` API adds a company-wide time off policy that can
        be assigned to employees


        ### Notes: 

        - **earningMethod**, **waitingPeriodUnit** and **timeOffRecievedWhen**
        fields dictate when, and for how long, **timeOffPolicyAssignments** can
        be applied to employees

        - multiple **timeOffPolicies** (even of the same type) can be added to a
        company

        - timeOffPolicyTypes can be retrieved using the `getTimeOffPolicyTypes`
        API

        - ** lumpSumHoursEarned** and ** accrualRatePerHour** are only necessary
        for Accrual PTO policies


        ----

        After a **timeOffPolicy** is added to a company, employees must be
        assigned to it using `addTimeOffPolicyAssignment`
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                method:
                  type: string
                  title: addCompanyBankAccount
                timeOffPolicy:
                  type: object
                  properties:
                    companyId:
                      type: string
                    timeOffPolicyType:
                      type: string
                    timeOffPolicyName:
                      type: string
                    earningMethod:
                      type: string
                      enum:
                        - Lump Sum (All at once)
                        - Accrual (Earned over time)
                    lumpSumHoursEarned:
                      type: number
                    accrualRatePerHour:
                      type: number
                    canCarryoverHours:
                      type: boolean
                    carryoverLimitHours:
                      type: number
                    maxAccumulatedHours:
                      type: number
                    carryoverDate:
                      type: string
                    waitingPeriodUnit:
                      type: string
                      enum:
                        - Days
                        - Weeks
                        - Months
                    waitingPeriodQuantity:
                      type: number
                    isProratedByStartDate:
                      type: boolean
                    timeOffReceivedWhen:
                      type: string
                      enum:
                        - On Hire Date
                        - After First Payroll
                        - Start of Year
                    payoutOnTerminations:
                      type: boolean
                    maxPayoutHours:
                      type: number
                    effectiveStartDate:
                      type: string
                    effectiveEndDate:
                      type: string
                  required:
                    - companyId
                    - timeOffPolicyType
                    - timeOffPolicyName
                    - earningMethod
                    - canCarryoverHours
                    - carryoverDate
                    - waitingPeriodUnit
                    - waitingPeriodQuantity
                    - isProratedByStartDate
                    - timeOffReceivedWhen
                    - payoutOnTerminations
                    - maxPayoutHours
                    - effectiveStartDate
                    - effectiveEndDate
                    - carryoverLimitHours
                    - maxAccumulatedHours
              required:
                - method
                - timeOffPolicy
            example:
              method: addTimeOffPolicy
              timeOffPolicy:
                companyId: BE2EE31D-B043-44E1-B78F-5E97A3EDA919
                timeOffPolicyType: Personal Days
                timeOffPolicyName: PTO Full Time
                earningMethod: Lump Sum (All at once)
                lumpSumHoursEarned: 80
                accrualRatePerHour: 1.5
                canCarryoverHours: true
                carryoverLimitHours: 40
                maxAccumulatedHours: 160
                carryoverDate: '2024-06-02'
                waitingPeriodUnit: Weeks
                waitingPeriodQuantity: 30
                isProratedByStartDate: true
                timeOffReceivedWhen: Start of Year
                payoutOnTerminations: true
                maxPayoutHours: 40
                effectiveStartDate: '2024-01-01'
                effectiveEndDate: '2026-01-01'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  timeOffPolicy:
                    type: object
                    properties:
                      timeOffPolicyId:
                        type: string
                      status:
                        type: string
                      message:
                        type: string
                    required:
                      - timeOffPolicyId
                      - status
                      - message
                required:
                  - timeOffPolicy
              examples:
                '1':
                  summary: Success
                  value:
                    timeOffPolicy:
                      timeOffPolicyId: EBA8563B-A2EA-46D6-A68A-5CEA5341575F
                      status: active
                      message: Time off policy has been added successfully
                '2':
                  summary: Exception
                  value:
                    error:
                      code: 400
                      message: Invalid CompanyId
          headers: {}
        '400':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: integer
                      message:
                        type: string
                    required:
                      - code
                required:
                  - error
              example:
                error:
                  code: 400
                  message: 'Invalid waitingPeriodUnit: Minutes.'
          headers: {}
      deprecated: false
      security:
        - basic: []
components:
  securitySchemes:
    basic:
      type: http
      scheme: basic

````