# Create an absence request.

Create an absence request.Expect error codes:INVALID_ABSENCE_TIME - when invalid absence time providedINVALID_ABSENCE_ALLOWANCE - when employee absence allowance is not enoughINVALID_HIRE_DATE - when employee hire date is invalidREQUESTING_RULES_VIOLATED - when requesting rules violatedINVALID_APPROVAL_FLOW - when approval flow is not configuredINVALID_ABSENCE_TYPE - when invalid absence type providedINVALID_REASON - when invalid reason providedINVALID_SUBSTITUTE - when invalid substitute providedINVALID_COMMENT - when invalid comment providedINVALID_TIME_PART - when invalid time part providedINVALID_ATTACHMENTS_REQUIRED - when attachments are required

Endpoint: POST /leave/request/v1/create
Version: v1
Security: basicAuth

## Request fields (application/json):

  - `employee` (string, required)
    Employee e-mail or login. Absence request will be created for the chosen employee. Chosen employee will be also a creator of request.
    Example: "john.white@mycompany.com"

  - `fromPart` (string, required)
    Time part value for absence start. Allowed values are based on minimal duration of absence request in absence type configuration.
    Enum: "MORNING", "AFTERNOON", "END_OF_DAY", "HH:mm"

  - `toPart` (string, required)
    Time part value for absence end. Allowed values are based on minimal duration of absence request in absence type configuration.
    Enum: "MORNING", "AFTERNOON", "END_OF_DAY", "HH:mm"

  - `absenceTypeId` (string, required)
    Absence type Id
    Example: "PTO"

  - `reason` (string)
    Reason content
    Example: "Home office"

  - `substitute` (string)
    Employee e-mail or login
    Example: "john.white@mycompany.com"

  - `comment` (string)
    Comment content
    Example: "Home office"

  - `dateFrom` (string)

  - `dateTo` (string)

## Response 200 fields (application/json):

  - `id` (integer, required)
    Absence request ID

## Response 400 fields (application/json):

  - `message` (string)
    Human readable error explanation.
    Example: "Api error"

  - `code` (string)
    Error code.
    Example: "INVALID_JSON_PAYLOAD"

  - `field` (string)
    Which field of payload object caused error. NULL when error is not related to particular field
    Example: "field"

## Response 401 fields (application/json):

  - `message` (string, required)
    Error details
    Example: "Authentication failure"

  - `code` (string, required)
    General type of error
    Example: "AUTH"

  - `field` (string)
    Leftover for backward compatibility

## Response 429 fields (application/json):

  - `code` (string, required)
    General type of error
    Example: "QUOTA_EXCEEDED"

  - `field` (string, required)
    Detailed info about quota and it's current usage
    Example: "Your current usage is 101/day, 10/hour, 1/sec\nYour current limits 100/day, 10/hour, 1/sec."

## Response 500 fields (application/json):

  - `message` (string, required)
    Error details
    Example: "An unexpected error occurred"

  - `code` (string, required)
    General type of error
    Example: "INTERNAL_SERVER_ERROR"

## Response 504 fields (application/json):

  - `message` (string, required)
    Error details
    Example: "Public API call exceeded timeout"

  - `code` (string, required)
    General type of error
    Example: "TIMEOUT"


## Response 403 fields
