> ## 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.

# Replace entitlements

> **Replace entitlements** adjusts leave accounts so that the entitlement total for selected entry types **matches exactly** the values provided in the import file. The system computes the difference between the target value and the current entitlement total (based on the `EntryTypes` parameter), then creates a positive or negative adjustment entry. It corresponds to the **"Import cumulative entitlements"** feature in the Lucca Absences UI. See the [Entitlements imports guide](/api-reference/legacy/timmi-absences/guides/entitlements-imports) to understand the differences with *Import entitlements*.

**Supported file formats:**
- CSV
  - "UTF-8" encoding
  - separator “;”
- XSLX

**Columns to fill in:**

| Column name                                     | Description                                              |
| :---------------------------------------------- | :------------------------------------------------------- |
| `LegalEntityCode`                               | Employee legal entity code.                              |
| `EmployeeNumber`                                | Employee payroll number.                                 |
| `LastName`                                      | Last name.                                               |
| `FirstName`                                     | First name.                                              |
| Account number or name (one column per account) | Value to import for the account defined in the header.   |


*Remark:
A template file can be downloaded from the import page (Credit / Debit> A group of collaborators> File import).*

In the event of a malformed (or unrecognized) file, no data will be imported; the problems detected will be specified in the `globalErrors` field.

If successful, the number of imported lines is indicated by the “successLinesCount” field; the lines in error are detailed in the `lineErrors` field.


*Remarks:
Any import made by the API is of course available in the import history.
A simulation returns the same level of information, but does not trigger an import*

**List of errors handled**

Here is the list of fatal errors, which can be returned in the `globalErrors`:
- Unauthorized
- FileEmpty,
- FileExtensionNotSupported,
- ColumnsFormatNotSupported,
- AccountColumnMissing,
- ColumnNamesDistinct,
- LineErrorForbiddenInStrictMode,

The list of line processing errors, which can be restored in the `lineErrors`:
- AccountNotFound,
- AccountsNotFound,
- AccountColumnsProcessing,
- LegalEntityCodesNotFound,
- MissingValuesForAccount,
- AccountNotAvailableForUser,
- LegalEntityCodeRequired,
- EmployeeNumberRequired,
- LoginRequired,
- LoginNotFound,
- AccountNumberRequired,
- LegalEntityNotFound,
- EmployeeNumberNotExist,
- EmployeeNumberNotInLegalEntity,
- FistNameAndLastNameNotMatching,
- FistNameNotMatching,
- LastLameNotMatching,
- FistNameAndLastNameNotMatchingEmployeeNumber,
- FistNameNotMatchingEmployeeNumber,
- LastLameNotMatchingEmployeeNumber,
- FistNameAndLastNameNotMatchingLogin,
- FistNameNotMatchingLogin,
- LastLameNotMatchingLogin,
- DuplicatedLine,
- AmbiguousLegalEntity,
- ColumnNotExists,
- LegalEntityNameNotAvailable,
- AccountNameNotUnique

The list of import generation errors:
- UnableToCreditAccount




## OpenAPI

````yaml /openapi-specs/timmi-absences-v3.yaml post /timmi-absences/api/public/services/v1.0/leaveEntitlementsReplace
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/public/services/v1.0/leaveEntitlementsReplace:
    parameters:
      - $ref: '#/components/parameters/Authorization'
    post:
      tags:
        - Imports
      summary: Replace entitlements
      description: >
        **Replace entitlements** adjusts leave accounts so that the entitlement
        total for selected entry types **matches exactly** the values provided
        in the import file. The system computes the difference between the
        target value and the current entitlement total (based on the
        `EntryTypes` parameter), then creates a positive or negative adjustment
        entry. It corresponds to the **"Import cumulative entitlements"**
        feature in the Lucca Absences UI. See the [Entitlements imports
        guide](/api-reference/legacy/timmi-absences/guides/entitlements-imports)
        to understand the differences with *Import entitlements*.


        **Supported file formats:**

        - CSV
          - "UTF-8" encoding
          - separator “;”
        - XSLX


        **Columns to fill in:**


        | Column name                                     |
        Description                                              |

        | :---------------------------------------------- |
        :------------------------------------------------------- |

        | `LegalEntityCode`                               | Employee legal
        entity code.                              |

        | `EmployeeNumber`                                | Employee payroll
        number.                                 |

        | `LastName`                                      | Last
        name.                                               |

        | `FirstName`                                     | First
        name.                                              |

        | Account number or name (one column per account) | Value to import for
        the account defined in the header.   |



        *Remark:

        A template file can be downloaded from the import page (Credit / Debit>
        A group of collaborators> File import).*


        In the event of a malformed (or unrecognized) file, no data will be
        imported; the problems detected will be specified in the `globalErrors`
        field.


        If successful, the number of imported lines is indicated by the
        “successLinesCount” field; the lines in error are detailed in the
        `lineErrors` field.



        *Remarks:

        Any import made by the API is of course available in the import history.

        A simulation returns the same level of information, but does not trigger
        an import*


        **List of errors handled**


        Here is the list of fatal errors, which can be returned in the
        `globalErrors`:

        - Unauthorized

        - FileEmpty,

        - FileExtensionNotSupported,

        - ColumnsFormatNotSupported,

        - AccountColumnMissing,

        - ColumnNamesDistinct,

        - LineErrorForbiddenInStrictMode,


        The list of line processing errors, which can be restored in the
        `lineErrors`:

        - AccountNotFound,

        - AccountsNotFound,

        - AccountColumnsProcessing,

        - LegalEntityCodesNotFound,

        - MissingValuesForAccount,

        - AccountNotAvailableForUser,

        - LegalEntityCodeRequired,

        - EmployeeNumberRequired,

        - LoginRequired,

        - LoginNotFound,

        - AccountNumberRequired,

        - LegalEntityNotFound,

        - EmployeeNumberNotExist,

        - EmployeeNumberNotInLegalEntity,

        - FistNameAndLastNameNotMatching,

        - FistNameNotMatching,

        - LastLameNotMatching,

        - FistNameAndLastNameNotMatchingEmployeeNumber,

        - FistNameNotMatchingEmployeeNumber,

        - LastLameNotMatchingEmployeeNumber,

        - FistNameAndLastNameNotMatchingLogin,

        - FistNameNotMatchingLogin,

        - LastLameNotMatchingLogin,

        - DuplicatedLine,

        - AmbiguousLegalEntity,

        - ColumnNotExists,

        - LegalEntityNameNotAvailable,

        - AccountNameNotUnique


        The list of import generation errors:

        - UnableToCreditAccount
      operationId: post-timmi-absences-leave-entitlements-replace
      parameters:
        - schema:
            type: boolean
            default: false
          in: query
          name: strict
          description: >-
            In strict mode, if the import has errors, nothing is imported.
            Without strict mode, the lines in error are ignored and those in
            success are imported.
        - schema:
            type: boolean
            default: false
          in: query
          name: simulate
          description: >-
            Allows you to simulate the import. In this case, the response
            indicates the theoretical result of the import without any data
            being recorded.
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                File:
                  type: string
                  contentMediaType: application/octet-stream
                Description:
                  type: string
                  description: >-
                    Description of the entries generated by the import (visible
                    to users in the account details).
                ReferenceDate:
                  type: string
                  description: |-
                    Reference date (text mode).
                    Respect the format: yyyy-MM-ddThh: mm: ss
                  format: date-time
                EntryTypes:
                  type: string
                  description: >-
                    Types of entries to take into account, separated by commas,
                    from the following list:

                    AutoAccruals,

                    ManualAccruals,

                    Regularisations,

                    EntitlementsImport,

                    Seniority,

                    Fractionnement,

                    TimeSavings,

                    Comp


                    By default: `AutoAccruals, ManualAccruals, Regularizations`
                    which correspond to the main cases of acquisition (automatic
                    acquisition, manual adjustments, regularisations).
                  default: AutoAccruals,ManualAccruals,Regularizations
        description: ''
      responses:
        '200':
          $ref: '#/components/responses/ImportResponse'
        '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:
    ImportResponse:
      description: Example response
      content:
        application/json:
          schema:
            type: object
            properties:
              successLinesCount:
                type: integer
              globalErrors:
                type: object
              lineErrors:
                type: object
          examples:
            ImportResponse:
              value:
                successLinesCount: 0
                globalErrors:
                  columnsFormatNotSupported: >-
                    The file must have columns 'login, lastName, firstName' or
                    'code, employeeNumber, lastName, firstName'.
                lineErrors:
                  '7':
                    loginNotFound: User login not found
                  '8':
                    duplicatedLine: Line 8 is identical to line 23
                  '9':
                    lastLameNotMatchingLogin: Lastname does not match to the login of this employee
                    accountNotAvailableForUser: The user does not have access to the account 6
    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

````