> ## Documentation Index
> Fetch the complete documentation index at: https://developers.projectcor.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create User Leave

> Creates a new user leave.

⚠️ **Important:**
- Dates must be sent in UTC format (e.g., `2024-11-18T03:00:00Z`)
- Dates cannot overlap with existing leaves for the same user
- If there is an existing date between the submitted dates, the request will not be saved



## OpenAPI

````yaml /api-reference/openapi.json post /user/leaves
openapi: 3.1.0
info:
  title: COR API
  description: >-
    The COR API lets you integrate with projectcor.com applications using simple
    HTTP methods, in either XML or JSON formats, making this an ideal API for
    developing integrations with other softwares, external clients or mobile
    applications
  version: 1.0.0
servers:
  - url: https://api.projectcor.com/v1
    description: Production server
security:
  - bearerAuth: []
paths:
  /user/leaves:
    post:
      tags:
        - User Leaves
      summary: Create User Leave
      description: >-
        Creates a new user leave.


        ⚠️ **Important:**

        - Dates must be sent in UTC format (e.g., `2024-11-18T03:00:00Z`)

        - Dates cannot overlap with existing leaves for the same user

        - If there is an existing date between the submitted dates, the request
        will not be saved
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LeaveInput'
            example:
              userId: 8555
              leaveTypeId: 11
              start: '2024-11-18T03:00:00Z'
              end: '2024-11-19T02:59:00Z'
              allDay: true
      responses:
        '200':
          description: Leave created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Leave'
              example:
                user_id: 8555
                company_id: 2336
                leave_type_id: 11
                start: '2024-11-18T03:00:00Z'
                end: '2024-11-19T02:59:00Z'
                created_at: '2024-11-07 22:11:30'
                updated_at: '2024-11-07 22:11:30'
                all_day: false
                id: 16332
components:
  schemas:
    LeaveInput:
      type: object
      required:
        - userId
        - leaveTypeId
        - start
        - end
      properties:
        userId:
          type: integer
          description: User ID
        leaveTypeId:
          type: integer
          description: Leave type ID
        start:
          type: string
          format: date-time
          description: Start date in UTC format (e.g., 2024-11-18T03:00:00Z)
        end:
          type: string
          format: date-time
          description: End date in UTC format
        allDay:
          type: boolean
          description: Whether the leave is for the entire day
          default: false
    Leave:
      type: object
      properties:
        id:
          type: integer
        user_id:
          type: integer
        company_id:
          type: integer
        leave_type_id:
          type: integer
        start:
          type: string
          format: date-time
        end:
          type: string
          format: date-time
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        deleted_at:
          type: string
          format: date-time
          nullable: true
        all_day:
          type: boolean
        leaveType:
          $ref: '#/components/schemas/LeaveType'
    LeaveType:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        type_code:
          type: string
        company_id:
          type: integer
          nullable: true
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        deleted_at:
          type: string
          format: date-time
          nullable: true
        icon_name:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````