openapi: 3.2.0 info: title: Assignar Public Leave Requests API version: Version 2 description: The Assignar Public API provides the ability for customers to extend the capability of the Assignar platform. servers: - description: Australia/New Zealand url: https://api.assignar.com.au/v2 - description: North America/Europe url: https://api.assignar.com/v2 security: - OAuth2: - target-entity:b816a5d3-40c3-477f-a551-1d066d7211cc:api_access tags: - name: Leave Requests paths: /leave-requests: post: summary: Create new leave requests for multiple users description: Submit new leave requests for multiple users of user-type "Field Worker" tags: - Leave Requests requestBody: required: true content: application/json: schema: type: object required: - user_ids - leave_type_id - leave_dates properties: user_ids: type: array items: type: integer format: int64 description: Array of user IDs to create leave requests for minItems: 1 leave_type_id: type: integer format: int64 description: ID of the leave type leave_dates: type: array items: type: object required: - start_at - end_at properties: start_at: type: string format: date-time description: Start date and time (YYYY-MM-DDTHH:mm format) example: 2025-07-01T08:00 end_at: type: string format: date-time description: End date and time (YYYY-MM-DDTHH:mm format) example: 2025-07-01T12:00 description: Array of leave date ranges minItems: 1 description: type: string description: Optional description for the leave request create_as_approved: type: boolean description: Whether to create the leave requests as approved default: false create_timesheets: type: boolean description: Whether to create timesheets for the approved leave requests default: false timesheet_timezone: type: string description: The IANA timezone identifier (e.g., America/Chicago, Europe/London, Australia/Sydney) default: UTC example: America/Chicago responses: '201': description: Leave requests created successfully content: application/json: schema: type: object properties: status: type: string example: success data: type: array items: $ref: '#/components/schemas/LeaveRequest' '400': description: Invalid input '401': description: Unauthorized '403': description: Forbidden operationId: postLeaveRequests x-operation-id-source: derived get: summary: List all leave requests tags: - Leave Requests operationId: getLeaveRequests responses: '200': description: Success content: application/json: schema: type: object properties: status: type: integer description: The response status example: 200 data: type: array items: $ref: '#/components/schemas/LeaveRequest' count: type: integer description: Total number of records example: 1 /leave-requests/{leaveRequestId}: get: summary: Leave Request by ID tags: - Leave Requests operationId: getLeaveRequestById parameters: - name: id in: path required: true description: ID of the leave request to retrieve schema: type: integer format: int64 responses: '200': description: Success content: application/json: schema: type: object properties: status: type: integer description: The response status example: 200 data: $ref: '#/components/schemas/LeaveRequest' put: summary: Update an existing leave request description: Modify an existing leave request in pending status tags: - Leave Requests parameters: - name: id in: path required: true description: ID of the leave request to update schema: type: integer format: int64 requestBody: required: true content: application/json: schema: type: object properties: leave_type_id: type: integer format: int64 description: ID of the leave type leave_dates: type: array items: type: object required: - start_at - end_at properties: start_at: type: string format: date-time description: Start date and time (YYYY-MM-DDTHH:mm format) example: 2025-07-01T08:00 end_at: type: string format: date-time description: End date and time (YYYY-MM-DDTHH:mm format) example: 2025-07-01T12:00 description: Array of leave date ranges minItems: 1 description: type: string description: Updated description for the leave request responses: '200': description: Success '400': description: Invalid input '401': description: Unauthorized '403': description: Forbidden '404': description: Leave request not found operationId: putLeaveRequestsByLeaveRequestId x-operation-id-source: derived /leave-requests/{leaveRequestId}/approve: put: summary: Approve a leave request tags: - Leave Requests parameters: - name: leaveRequestId in: path required: true description: ID of the leave request to approve schema: type: integer format: int64 requestBody: required: true content: application/json: schema: type: object properties: create_timesheets: type: boolean description: Whether to create timesheets for the approved leave requests default: false timesheet_timezone: type: string description: The IANA timezone identifier (e.g., America/Chicago, Europe/London, Australia/Sydney) default: UTC example: America/Chicago comments: type: string description: Comments for the approved leave request responses: '200': description: Success '400': description: Invalid input '401': description: Unauthorized '403': description: Forbidden '404': description: Leave request not found operationId: putLeaveRequestsByLeaveRequestIdApprove x-operation-id-source: derived /leave-requests/{leaveRequestId}/decline: put: summary: Decline a leave request tags: - Leave Requests parameters: - name: leaveRequestId in: path required: true description: ID of the leave request to decline schema: type: integer format: int64 requestBody: required: true content: application/json: schema: type: object properties: comments: type: string description: Comments for the declined leave request responses: '200': description: Success '400': description: Invalid input '401': description: Unauthorized '403': description: Forbidden '404': description: Leave request not found operationId: putLeaveRequestsByLeaveRequestIdDecline x-operation-id-source: derived /leave-requests/{leaveRequestId}/cancel: put: summary: Cancel a leave request tags: - Leave Requests parameters: - name: leaveRequestId in: path required: true description: ID of the leave request to cancel schema: type: integer format: int64 responses: '200': description: Success '400': description: Invalid input '401': description: Unauthorized '403': description: Forbidden '404': description: Leave request not found operationId: putLeaveRequestsByLeaveRequestIdCancel x-operation-id-source: derived components: schemas: UrlAttachment: type: object readOnly: true properties: url: type: string format: url description: Download URL for the file. expiry: type: integer description: Expiry date of the download url in timestamp. example: url: https://url-to-attachment expiry: 1742575641898 LeaveRequest: type: object properties: id: type: integer example: 1 user_id: type: integer example: 432 leave_type_id: type: integer example: 2 start_datetime: type: string format: date-time example: 2025-03-21T00:00 end_datetime: type: string format: date-time example: 2025-03-21T23:59 is_approved: type: boolean example: true created_time: type: string format: date-time example: '2025-03-20T07:59:18.000Z' modified_time: type: string format: date-time example: '2025-03-20T09:12:46.000Z' deleted_time: type: string format: date-time example: '2025-03-20T23:47:29.000Z' approved_by_id: type: integer example: 432 created_by_id: type: integer example: 432 modified_by_id: type: integer example: 432 deleted_by_id: type: integer example: 432 status_id: type: integer example: 2 responded_by_id: type: - integer - 'null' example: null responded_at: type: - string - 'null' format: date-time example: '2025-03-21T14:47:05.000Z' attachment_path: type: - string - 'null' example: null description: type: - string - 'null' example: null comments: type: - string - 'null' example: null user: type: object properties: full_name: type: string example: Pat Smith user_id: type: integer example: 432 username: type: string example: pat.smith first_name: type: string example: Pat last_name: type: string example: Smith leave_type: type: object properties: id: type: integer example: 1 type: type: string example: annual label: type: string example: Annual leave code: type: - string - 'null' example: null status: type: object properties: id: type: integer example: 2 label: type: string example: approved leave_dates: type: array items: type: object properties: start_at: type: string format: date-time example: 2025-03-21T07:30 end_at: type: string format: date-time example: 2025-03-21T16:00 id: type: integer example: 5041 leave_request_id: type: integer example: 850 timesheet_id: type: integer example: 33170 created_by_id: type: integer example: 4555 modified_by_id: type: integer example: 4555 example: - start_at: 2025-03-21T07:30 end_at: 2025-03-21T16:00 id: 5041 leave_request_id: 850 timesheet_id: 33170 created_by_id: 4555 modified_by_id: 4555 attachment_url: $ref: '#/components/schemas/UrlAttachment' securitySchemes: OAuth2: type: oauth2 flows: clientCredentials: tokenUrl: https://login.assignar.com/oauth2/token scopes: target-entity:b816a5d3-40c3-477f-a551-1d066d7211cc:api_access: Access to API description: 'The client credentials flow is a server-to-server flow. There is no user authentication involved in the process. Instead, the client acts on behalf of itself. The client can request an access token using only its client credentials (or other supported means of authentication) when the client is requesting access to the protected resources under its control. The client credentials are passed in the Authorization header as a Basic Auth (base64 encoded "client_id:client_secret"). The token endpoint of the Authorization server where the client can obtain the token is https://login.assignar.com/oauth2/token. The scope ''target-entity:b816a5d3-40c3-477f-a551-1d066d7211cc:api_access'' is required to access the API. ' x-provenance: method: harvested publisher: Assignar source: https://apidocs.assignar.com/api-docs/swagger.yaml note: split by refine-openapis from the provider's own published document, verified by fetch (openapi/_original/*.fetch.json); stamped by stamp-openapi-provenance.py (roadmap#793)