freshworks Time Off API

Manage time-off types and employee leave requests.

OpenAPI Specification

freshworks-time-off-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Freshworks Freshcaller Accounts Time Off API
  description: The Freshcaller API provides access to cloud-based phone system functionality for contact center operations. It allows developers to export call data, call recordings, user information, and agent team details stored in the Freshcaller system. The API supports integration of voice and telephony workflows into broader business applications, enabling organizations to automate call center reporting, synchronize agent data, and build custom dashboards around their phone operations.
  version: '1.0'
  contact:
    name: Freshworks Support
    url: https://support.freshcaller.com/
  termsOfService: https://www.freshworks.com/terms/
servers:
- url: https://{domain}.freshcaller.com/api/v1
  description: Freshcaller Production Server
  variables:
    domain:
      default: yourdomain
      description: Your Freshcaller subdomain
security:
- apiKeyAuth: []
tags:
- name: Time Off
  description: Manage time-off types and employee leave requests.
paths:
  /time_off_types:
    get:
      operationId: listTimeOffTypes
      summary: List all time-off types
      description: Retrieves a list of all time-off types configured in Freshteam such as vacation, sick leave, and personal days.
      tags:
      - Time Off
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/TimeOffType'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /time_offs:
    get:
      operationId: listTimeOffRequests
      summary: List all time-off requests
      description: Retrieves a paginated list of all employee time-off requests.
      tags:
      - Time Off
      parameters:
      - $ref: '#/components/parameters/PageParam'
      - name: user_id
        in: query
        description: Filter by employee user ID.
        schema:
          type: integer
      - name: status
        in: query
        description: Filter by request status.
        schema:
          type: string
          enum:
          - pending
          - approved
          - declined
          - cancelled
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/TimeOffRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
    post:
      operationId: createTimeOffRequest
      summary: Create a time-off request
      description: Creates a new time-off request for an employee.
      tags:
      - Time Off
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TimeOffRequestCreate'
      responses:
        '201':
          description: Time-off request created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TimeOffRequest'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  schemas:
    TimeOffType:
      type: object
      properties:
        id:
          type: integer
          description: Unique ID of the time-off type.
        name:
          type: string
          description: Name of the time-off type (e.g., Vacation, Sick Leave).
        description:
          type: string
          description: Description.
        is_paid:
          type: boolean
          description: Whether the time-off type is paid leave.
    TimeOffRequestCreate:
      type: object
      required:
      - leave_type_id
      - start_date
      - end_date
      properties:
        leave_type_id:
          type: integer
          description: ID of the time-off type.
        start_date:
          type: string
          format: date
          description: Start date.
        end_date:
          type: string
          format: date
          description: End date.
        comments:
          type: string
          description: Comments or reason for the request.
        notify:
          type: array
          items:
            type: integer
          description: User IDs to notify about the request.
    Error:
      type: object
      properties:
        code:
          type: string
          description: Error code.
        message:
          type: string
          description: Human-readable error message.
    TimeOffRequest:
      type: object
      properties:
        id:
          type: integer
          description: Unique ID of the time-off request.
        user_id:
          type: integer
          description: ID of the employee.
        leave_type_id:
          type: integer
          description: ID of the time-off type.
        start_date:
          type: string
          format: date
          description: Start date of the leave.
        end_date:
          type: string
          format: date
          description: End date of the leave.
        status:
          type: string
          description: Status of the request.
          enum:
          - pending
          - approved
          - declined
          - cancelled
        comments:
          type: string
          description: Comments from the requester.
        created_at:
          type: string
          format: date-time
          description: Timestamp when created.
        updated_at:
          type: string
          format: date-time
          description: Timestamp when last updated.
  parameters:
    PageParam:
      name: page
      in: query
      description: Page number for pagination.
      schema:
        type: integer
        minimum: 1
        default: 1
  responses:
    Unauthorized:
      description: Authentication credentials are missing or invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    BadRequest:
      description: The request body or parameters are invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-Api-Auth
      description: API key authentication. The API key can be found in your Freshcaller admin settings.
externalDocs:
  description: Freshcaller API Documentation
  url: https://developers.freshcaller.com/api/