API reference

Leave

Endpoints and input schemas from the console's API registry.

GET /api/leave

List leave requests

Needs the leave.applyOwn or leave.readAll permission on the API key's role.

No request-body schema is supplied for this operation in the registry.

Documented responses

  • 200 — OK
  • 400 — The body is not valid; `error` says why
  • 401 — No valid API key
  • 403 — The key's role lacks the permission, or the module is off

POST /api/leave

Create a leave request

Needs the leave.applyOwn or leave.approve permission on the API key's role.

JSON request schema
{
  "type": "object",
  "properties": {
    "leaveTypeId": {
      "type": "string"
    },
    "startDate": {
      "type": "string"
    },
    "endDate": {
      "type": "string"
    },
    "isHalfDay": {
      "default": false,
      "type": "boolean"
    },
    "halfDayPeriod": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "AM",
            "PM"
          ]
        },
        {
          "type": "null"
        }
      ]
    },
    "reason": {
      "type": "string"
    },
    "userId": {
      "type": "string"
    },
    "notifyUserIds": {
      "maxItems": 10,
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 64
      }
    },
    "expectedDays": {
      "type": "number",
      "minimum": 0,
      "maximum": 366
    },
    "startTime": {
      "type": "string",
      "maxLength": 5
    },
    "hours": {
      "type": "number",
      "exclusiveMinimum": 0,
      "maximum": 24
    },
    "attachments": {
      "maxItems": 5,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "fileUrl": {
            "type": "string",
            "format": "starts_with",
            "pattern": "^\\/api\\/files\\/leave-files\\/.*"
          },
          "fileName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "fileSize": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "fileUrl",
          "fileName",
          "fileSize"
        ]
      }
    }
  },
  "required": [
    "leaveTypeId",
    "startDate",
    "endDate"
  ]
}

Documented responses

  • 200 — OK
  • 201 — Created
  • 400 — The body is not valid; `error` says why
  • 401 — No valid API key
  • 403 — The key's role lacks the permission, or the module is off

GET /api/leave/{id}

Read a leave request

Needs the leave.applyOwn or leave.readAll permission on the API key's role.

Path parameters

  • id — required path parameter

No request-body schema is supplied for this operation in the registry.

Documented responses

  • 200 — OK
  • 400 — The body is not valid; `error` says why
  • 401 — No valid API key
  • 403 — The key's role lacks the permission, or the module is off
  • 404 — Not found in this company

Other policy and state errors may also apply. See API key permissions and limits and the complete OpenAPI document.