CharlieHR Leave / Absences API

Leave (time off) requests.

OpenAPI Specification

charliehr-leave-absences-api-openapi.yml Raw ↑
openapi: 3.0.1
info:
  title: CharlieHR Company Leave / Absences API
  description: 'REST API for the CharlieHR small-business HR platform. Exposes a company''s team members, leave requests, leave allowances, and company structure (offices and teams). Authentication uses OAuth 2.0: a Client ID and Client Secret are exchanged for an access token that is sent in the Authorization header. Endpoints and fields documented here reflect CharlieHR''s public API documentation; some response field details are not fully published and are represented as free-form objects.'
  termsOfService: https://www.charliehr.com/terms/
  contact:
    name: CharlieHR Support
    url: https://help.charliehr.com/
  version: '1.0'
servers:
- url: https://charliehr.com/api/v1
  description: CharlieHR API v1
security:
- oauth2: []
tags:
- name: Leave / Absences
  description: Leave (time off) requests.
paths:
  /team_members/{id}/leave_requests:
    get:
      operationId: listTeamMemberLeaveRequests
      tags:
      - Leave / Absences
      summary: List a team member's leave requests
      description: Returns the leave requests for a specific team member.
      parameters:
      - $ref: '#/components/parameters/TeamMemberId'
      - $ref: '#/components/parameters/Page'
      - $ref: '#/components/parameters/PerPage'
      responses:
        '200':
          description: A list of leave requests for the team member.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LeaveRequestList'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
  /leave_requests:
    get:
      operationId: listLeaveRequests
      tags:
      - Leave / Absences
      summary: List leave requests
      description: Returns all leave requests for the currently authenticated company. Supports pagination via the page and per_page query parameters.
      parameters:
      - $ref: '#/components/parameters/Page'
      - $ref: '#/components/parameters/PerPage'
      responses:
        '200':
          description: A paginated list of leave requests.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LeaveRequestList'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /leave_requests/{id}:
    get:
      operationId: getLeaveRequest
      tags:
      - Leave / Absences
      summary: Get a leave request
      description: Returns a single leave request from the authenticated company.
      parameters:
      - $ref: '#/components/parameters/LeaveRequestId'
      responses:
        '200':
          description: A single leave request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LeaveRequestResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  responses:
    NotFound:
      description: The requested resource was not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Authentication failed or the access token is missing or invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    LeaveRequestList:
      type: object
      properties:
        success:
          type: boolean
        data:
          type: array
          items:
            $ref: '#/components/schemas/LeaveRequest'
        meta:
          $ref: '#/components/schemas/Pagination'
    Pagination:
      type: object
      description: Pagination metadata returned with list responses.
      properties:
        page:
          type: integer
        per_page:
          type: integer
        total:
          type: integer
    LeaveRequestResponse:
      type: object
      properties:
        success:
          type: boolean
        data:
          $ref: '#/components/schemas/LeaveRequest'
    LeaveRequest:
      type: object
      description: A single leave (time off) request.
      properties:
        id:
          type: string
        team_member_id:
          type: string
        leave_type:
          type: string
          description: The type of leave (for example holiday or sickness).
        start_date:
          type: string
          format: date
        end_date:
          type: string
          format: date
        status:
          type: string
          description: The approval status of the request.
        created_at:
          type: string
          format: date-time
    Error:
      type: object
      properties:
        success:
          type: boolean
          example: false
        error:
          type: string
        message:
          type: string
  parameters:
    PerPage:
      name: per_page
      in: query
      required: false
      description: Number of records to return per page.
      schema:
        type: integer
        minimum: 1
    Page:
      name: page
      in: query
      required: false
      description: Page number for paginated results.
      schema:
        type: integer
        minimum: 1
    LeaveRequestId:
      name: id
      in: path
      required: true
      description: The unique identifier of the leave request.
      schema:
        type: string
    TeamMemberId:
      name: id
      in: path
      required: true
      description: The unique identifier of the team member.
      schema:
        type: string
  securitySchemes:
    oauth2:
      type: oauth2
      description: OAuth 2.0. A Client ID and Client Secret issued in the CharlieHR app are exchanged for an access token, which is sent in the Authorization header of each request.
      flows:
        clientCredentials:
          tokenUrl: https://charliehr.com/oauth/token
          scopes: {}