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

# Import leaves

> Create absences in batch from a CSV file.

**Important notice: Absence imports cannot be cancelled.** 

In case of a mistake absences must be deleted manually through the interface or using the API (see Use cases). **Use import with care!**

**File format**

Content-Type: CSV. Column divider is semicolon ";". Line breaks between rows.

Encoding: UTF-8

All the following fields must be present with the field name in the header:

- legalEntity: Name of the establishment the employee belongs to.
- employeeNumber: Employee number.
- lastName: Family (last) name of the employee.
- firstName: Given (first) name of the employee.
- accountId: Identifier of the absence account in Lucca Absences (can be found in the leave accounts admin page).
- startDate: Start date of the absence, formatted as `DD/MM/YYYY`.
- flagStartDate: `"AM"` if the absence starts in the morning or `"PM"` if the absence starts in the afternoon.
- endDate: End date of the absence, formatted as `DD/MM/YYYY`.
- flagEndDate: `"AM"` if the absence ends at noon or `"PM"` if the absence ends in the afternoon.
- isApproved: `true` or `false`. Dictates whether the absence request should be created and already approved. 
  Required if the type of the absence requires approval, optional otherwise.

**History**
Import history is available in the import module. It includes imports made via the API.




## OpenAPI

````yaml /openapi-specs/timmi-absences-v3.yaml post /timmi-absences/api/imports/v1.0/leavePeriods
openapi: 3.1.0
info:
  title: Lucca Absences API
  version: '1.0'
  description: Welcome on the documentation for Lucca Absences API.
  contact:
    name: API Support
    url: https://support.lucca.fr
    email: contact@luccasoftware.com
  license:
    name: Unlicensed
    url: https://www.luccasoftware.com
servers:
  - url: https://{host}
    description: Your Lucca account URL.
    variables:
      host:
        default: example.ilucca.net
        description: >-
          The URL of your dedicated Lucca account: `{account}.{env}.{region}`.


          Account reflects your company name. Env indicates the environment.
          Region depends on your server location.


          **Please, use your test or sandbox environments (and not your
          production env.) for testing purposes.**


          Environments:

          - `ilucca`: production environment for customers.

          - `ilucca-test`: test environment for customers.

          - `ilucca-demo`: demo environment for prospects.


          Regions:

          - `.ch` for Swiss located accounts.

          - `.net` for the others.


          Regarding sandboxes, the pattern differs:
          `https://{account}-{sandboxName}.sandbox.{server}.luccasoftware.com`,
          where:

          - `{sandboxName}` is automatically generated upon creation.

          - `{server}` may be "eu1", "eu2" or "ch1".
security: []
tags:
  - name: Leaves
    description: Absences taken on a given day
  - name: Leave Requests
    description: Workflow object for submiting an absence.
  - name: Imports
    description: Absences imports
  - name: SickLeaveCertificates
    description: >-
      Complementary data for certain leave types in order to comply with French
      law.
paths:
  /timmi-absences/api/imports/v1.0/leavePeriods:
    parameters:
      - $ref: '#/components/parameters/Authorization'
    post:
      tags:
        - Imports
      summary: Import leaves
      description: >
        Create absences in batch from a CSV file.


        **Important notice: Absence imports cannot be cancelled.** 


        In case of a mistake absences must be deleted manually through the
        interface or using the API (see Use cases). **Use import with care!**


        **File format**


        Content-Type: CSV. Column divider is semicolon ";". Line breaks between
        rows.


        Encoding: UTF-8


        All the following fields must be present with the field name in the
        header:


        - legalEntity: Name of the establishment the employee belongs to.

        - employeeNumber: Employee number.

        - lastName: Family (last) name of the employee.

        - firstName: Given (first) name of the employee.

        - accountId: Identifier of the absence account in Lucca Absences (can be
        found in the leave accounts admin page).

        - startDate: Start date of the absence, formatted as `DD/MM/YYYY`.

        - flagStartDate: `"AM"` if the absence starts in the morning or `"PM"`
        if the absence starts in the afternoon.

        - endDate: End date of the absence, formatted as `DD/MM/YYYY`.

        - flagEndDate: `"AM"` if the absence ends at noon or `"PM"` if the
        absence ends in the afternoon.

        - isApproved: `true` or `false`. Dictates whether the absence request
        should be created and already approved. 
          Required if the type of the absence requires approval, optional otherwise.

        **History**

        Import history is available in the import module. It includes imports
        made via the API.
      operationId: post-figgo-api-imports-v1.0-leavePeriods
      parameters:
        - schema:
            type: string
          in: header
          name: Content-Type
          required: true
          example: multipart/form-data; boundary=myBoundary
          description: Multipart boundary **MUST** be set in the Content-Type header.
        - schema:
            type: boolean
          in: query
          name: create
          description: Use `false` to simulate the import.
        - schema:
            type: boolean
          in: query
          name: recredit
          description: >-
            Use `true` if absences should **not** be deducted from the user
            balance. Use `false` if absences should be deducted from the user
            balance. Note: if the absence type doesn’t have balance management,
            absence won’t impact the balance in any case.
        - schema:
            type: string
            default: import.csv
          in: query
          name: originalFileName
          description: Filename
        - schema:
            type: boolean
          in: query
          name: synchronize
          description: >-
            Use `true` to force synchronization of the absences in the sync
            webservice (sync to Exchange/0365, Google Calendar, Webhook or ADP
            GXP, depending on configuration). Use `false` to import absences
            without synchronizing absences.
        - schema:
            type: boolean
          in: query
          name: async
          description: >-
            Use `true` if you want to import absences with the asynchronous
            processing (you have to request
            figgo/api/imports/v1.0/leavePeriods/{summaryId}/progress API to
            track the status). Use `false` if you want import absences with the
            synchronous processing (the response is sent when the file is fully
            imported).
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                files:
                  type: array
                  items:
                    type: string
            encoding:
              files:
                contentType: application/vnd.ms-excel
        description: >
          Content of the CSV file to import. Each file in its dedicated part

          of the multipart request. Parts are divided by the 'boundary' string

          set in the Content-Type HTTP header.


          Example of a single file request body:

          ```

          --myBoundary

          Content-Disposition: form-data;
          name="figgo-import-5875e9dd-0b1f-4a9f-8756-0f25fb0a2946.csv";
          filename="figgo-import-5875e9dd-0b1f-4a9f-8756-0f25fb0a2946.csv"

          Content-Type: application/vnd.ms-excel


          legalEntity;employeeNumber;lastName;firstName;accountId;startDate;flagStartDate;endDate;flagEndDate;isApproved

          Lucca FR;M0029;Bart;Maurice;1322;16/08/2022;am;17/08/2022;pm;true

          Lucca FR;M0029;Bart;Maurice;1322;22/08/2022;am;23/08/2022;pm;false

          Lucca FR;M0029;Bart;Maurice;8;29/08/2022;am;30/08/2022;pm;true

          --myBoundary--

          ```
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  summaryId:
                    type: string
                    format: uuid
                  hasError:
                    type: boolean
                x-examples:
                  example-1:
                    summaryId: 51564472-08cc-4410-94cc-a2b67f77f980
                    hasError: false
        '400':
          $ref: '#/components/responses/Problem'
components:
  parameters:
    Authorization:
      name: Authorization
      required: true
      description: 'API key. Value must be formatted like so: `lucca application={api_key}`.'
      in: header
      schema:
        type: string
  responses:
    Problem:
      description: Problem
      content:
        application/json:
          schema:
            type: object
            properties:
              Status:
                type: integer
                description: HTTP status code.
                example: 401
              Message:
                type: string
                description: Human readable error message.
                example: Unauthorized

````