﻿openapi: 3.1.0
info:
  title: Lucca Expenses
  version: '1.0'
  description: |
    Welcome on the documentation for the Lucca Expenses API.
  contact:
    name: API Support
    url: 'https://www.luccasoftware.com'
    email: no-reply@luccasoftware.com
  license:
    name: Apache 2.0
    url: 'https://www.apache.org/licenses/LICENSE-2.0'
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".
tags:
  - name: ExpenseTempItems
    description: Singular expenses.
  - name: ExpenseClaims
    description: Collection of expenses submitted for approval.
  - name: ExpenseClaimItems
    description: Expenses included in an expenseClaim
  - name: CreateExpenseAccountingExport
    description: Service used to create an export and retrieve the exported entry lines.    
paths:
  /api/v3/expenseTempItems:
    parameters:
      - $ref: "#/components/parameters/Authorization"
    get:
      summary: List ExpenseTempItems
      x-mint:
        href: /api-reference/legacy/cleemy-expenses/expenses/list-expensetempitems-temporary-expense
      tags:
        - ExpenseTempItems
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      items:
                        type: array
                        items:
                          $ref: '#/components/schemas/ExpenseTempItem'
        '400':
          $ref: '#/components/responses/ResponseProblem'
        '401':
          $ref: '#/components/responses/ResponseProblem'
        '500':
          $ref: '#/components/responses/ResponseProblem'
      operationId: get-api-v3-expenseTempItems
      parameters:
        - schema:
            type: array
            items:
              type: integer
          in: query
          name: ownerId
          description: Comma-separated list of user identifiers (int).
        - schema:
            type: string
          in: query
          name: orderBy
          description: '{fieldName},{''asc''||''desc''}. Example: `?orderby=purchasedOn,desc`'
        - schema:
            type: string
          in: query
          name: purchasedOn
          description: 'Examples: `between,2022-01-01,202201-31`.'
        - $ref: '#/components/parameters/paging'
      description: |-
        Retrieve a list of `ExpenseTempItems`.

        The `purchasedOn` query parameter can operate comparisons with a given date-time value:
        - `?purchasedOn=2021-01-01`: strict equality.
        - `?purchasedOn=since,2021-01-01`: greater than or equal.
        - `?purchasedOn=until,2021-01-01`: lower than or equal.
        - `?purchasedOn=between,2021-01-01,2021-01-31`: comprised between two dates.
    post:
      summary: Create a new temporary expense
      x-mint:
        href: /api-reference/legacy/cleemy-expenses/expenses/create-a-new-temporary-expense
      description: |-
        Create a new temporary-expense-item.

        **Attaching a receipt**: if the expense nature requires a receipt, you must first upload the file via `POST /lucca-files/api/uploads`, then create an `ExpenseReceipt` via `POST /api/v3/expenseReceipts`, and finally reference the receipt's `id` in the `expenseReceipts` array. Do **not** pass the file upload ID directly — see the [Attaching receipts guide](/api-reference/legacy/cleemy-expenses/guides/attaching-receipts) for the full workflow.
      operationId: post-api-v3-expenseTempItems
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/ExpenseTempItem'
              example:
                id: 12
                purchasedOn: "2025-01-01"
                originalTransaction:
                  grossAmount: 25
                  currencyId: EUR
                  isExpenseAbroad: false
                processedAmounts:
                  grossAmount: 25
                  currencyId: "EUR"
                  netAmount": 25
                  vatBases:
                    - countryVatRateId: 2
                      countryVatRate:
                        id: 2,
                        name: "<string>"
                        url: "<string>"
                      vatAmount": 25
                      amountExcludingVat": 25
                expenseNatureId: 1
                quantity: 1
                ownerId: 1
                paymentMethodId: 1
                deviceId: "Web"
                mileage: null
                effectiveQuantity: 1
                attendees:
                  internal: []
                  external: []
                axisSections: []
                customFields: {}
                merchant: "SNCF"
                comment: "Travel to Paris"
                expenseReceipts: []
                authorizedActions:
                  isCancellable: true
                  isEditable: true
                sourceId:
                  id: 6
                statusId:
                  id: 0
        '400':
          $ref: '#/components/responses/ResponseProblem'
        '401':
          $ref: '#/components/responses/ResponseProblem'
        '403':
          $ref: '#/components/responses/ResponseProblem'
        '500':
          $ref: '#/components/responses/ResponseProblem'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExpenseTempItem'
            example:
              expenseNatureId: 1
              purchasedOn: "2025-01-01"
              paymentMethodId: 1
              quantity: 1
              originalTransaction:
                currencyId: "EUR"
                grossAmount: 25.00
              processedAmounts:
                grossAmount: 25.00
                currencyId: "EUR"
              deviceId: "Web"
              ownerId: 1
              merchant: "SNCF"
              comment: "Travel to Paris"
              expenseReceipts:
                - id: "f0d01fd0-5f27-4061-8dca-bee6318b0103"
      tags:
        - ExpenseTempItems
  /api/v3/expenseTempItems/{expenseTempItemId}:
    parameters:
      - $ref: "#/components/parameters/Authorization"
      - schema:
          type: integer
        name: expenseTempItemId
        in: path
        required: true
        description: Unique identifier of the ExpenseTempItem.
    get:
      summary: Get an ExpenseTempItem by id
      x-mint:
        href: /api-reference/legacy/cleemy-expenses/expenses/get-an-expensetempitem-by-id
      description: Retrieve an temporary expense item by its identifier.
      tags:
        - ExpenseTempItems
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/ExpenseTempItem'
        '400':
          $ref: '#/components/responses/ResponseProblem'
        '401':
          $ref: '#/components/responses/ResponseProblem'
        '404':
          $ref: '#/components/responses/ResponseProblem'
        '500':
          $ref: '#/components/responses/ResponseProblem'
      operationId: get-api-v3-expenseTempItems-expenseTempItemId
    put:
      summary: Update an ExpenseTempItem by id
      x-mint:
        href: /api-reference/legacy/cleemy-expenses/expenses/update-an-expensetempitem-by-id
      description: Update a temporary expense item by its identifier.
      operationId: put-api-v3-expenseTempItems-expenseTempItemId
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/ExpenseTempItem'
        '400':
          $ref: '#/components/responses/ResponseProblem'
        '401':
          $ref: '#/components/responses/ResponseProblem'
        '403':
          $ref: '#/components/responses/ResponseProblem'
        '404':
          $ref: '#/components/responses/ResponseProblem'
        '500':
          $ref: '#/components/responses/ResponseProblem'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExpenseTempItem'
      tags:
        - ExpenseTempItems
  /api/v3/expenseClaims/creation:
    parameters:
      - $ref: "#/components/parameters/Authorization"
    post:
      summary: Create a new ExpenseClaim
      x-mint:
        href: /api-reference/legacy/cleemy-expenses/expenseclaims/create-a-new-expenseclaim
      tags:
        - ExpenseClaims
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        createdExpenseClaim:
                          type: object
                          properties:
                            id:
                              type: integer
                            nextApprover:
                              type: object
                              properties:
                                firstName:
                                  type: string
                                lastName:
                                  type: string
                x-examples:
                  example-1:
                    createdExpenseClaim:
                      id: 369
                      nextApprover:
                        firstName: Will
                        lastName: Riker
        '400':
          $ref: '#/components/responses/ResponseProblem'
        '401':
          $ref: '#/components/responses/ResponseProblem'
        '403':
          $ref: '#/components/responses/ResponseProblem'
        '500':
          $ref: '#/components/responses/ResponseProblem'
      operationId: get-api-v3-expenseClaims-creation
      description: |-
        When a user wants to declare his expenses, he creates an `ExpenseClaim`.

        An `ExpenseClaim` is created by regrouping one or more `ExpenseTempItems` and converting them into ExpenseClaimItems.

        Once created, an `ExpenseClaim` has to be approved by his manager.

        Multiple `ExpenseClaims` can be created through a single request.
      requestBody:
        content:
          application/json:
            schema:
              type: array
              x-examples:
                example-1:
                  - title: Mars 2016
                    expenseTempItems:
                      - id: 4614
                      - id: 4630
              items:
                type: object
                properties:
                  title:
                    type: string
                    description: 'Human readable name for this ExpenseClaim (eg: "May 2022").'
                  expenseTempItems:
                    type: array
                    minItems: 1
                    description: List of all temporary expenses identifiers that should be included in this expense claim.
                    items:
                      type: object
                      properties:
                        id:
                          type: integer
                      required:
                        - id
                required:
                  - title
                  - expenseTempItems
  /api/v3/expenseClaims:
    parameters:
      - $ref: "#/components/parameters/Authorization"
    get:
      summary: List ExpenseClaims
      x-mint:
        href: /api-reference/legacy/cleemy-expenses/expenseclaims/list-expenseclaims
      tags:
        - ExpenseClaims
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      items:
                        type: array
                        items:
                          $ref: '#/components/schemas/ExpenseClaim'
        '400':
          $ref: '#/components/responses/ResponseProblem'
        '401':
          $ref: '#/components/responses/ResponseProblem'
        '500':
          $ref: '#/components/responses/ResponseProblem'
      operationId: get-api-v3-expenseClaims
      parameters:
        - schema:
            type: array
            items:
              type: integer
          in: query
          name: ownerId
          description: Comma-separated list of user identifiers (int).
        - schema:
            type: string
          in: query
          name: orderBy
          description: '{fieldName},{''asc''||''desc''}. Example: `?orderby=declaredOn,desc`'
        - schema:
            type: string
          in: query
          name: declaredOn
          description: 'Examples: `between,2022-01-01,202201-31`.'
        - $ref: '#/components/parameters/paging'
        - schema:
            type: string
          in: query
          name: statusId
          description: '1: Created; 2: PartiallyApproved; 3: Approved; 4: Controlled; 5: ApprovedAndControlled; 6: PaymentInitiated; 7: Paid; 8: Refused; 9: Cancelled. Examples: `2,3` or `PartiallyApproved,Approved`.'
      description: |-
        Retrieve a list of `ExpenseClaims`.

        The `declaredOn` query parameter can operate comparisons with a given date-time value:
        - `?declaredOn=2021-01-01`: strict equality.
        - `?declaredOn=since,2021-01-01`: greater than or equal.
        - `?declaredOn=until,2021-01-01`: lower than or equal.
        - `?declaredOn=between,2021-01-01,2021-01-31`: comprised between two dates.
  /api/v3/expenseClaimItems:
    parameters:
      - $ref: "#/components/parameters/Authorization"
    get:
      summary: List ExpenseClaimItems
      x-mint:
        href: /api-reference/legacy/cleemy-expenses/expenseclaimitems/list-expense-claim-items
      tags:
        - ExpenseClaimItems
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      items:
                        type: array
                        items:
                          $ref: '#/components/schemas/ExpenseClaimItem'
        '400':
          $ref: '#/components/responses/ResponseProblem'
        '401':
          $ref: '#/components/responses/ResponseProblem'
        '500':
          $ref: '#/components/responses/ResponseProblem'
      operationId: get-api-v3-expenseClaimItems
      parameters:
        - schema:
            type: array
            items:
              type: integer
          in: query
          name: ownerId
          description: Comma-separated list of user identifiers (int).
        - schema:
            type: string
          in: query
          name: orderBy
          description: '{fieldName},{''asc''||''desc''}. Example: `?orderby=purchasedOn,desc`'
        - schema:
            type: string
          in: query
          name: purchasedOn
          description: 'Examples: `between,2022-01-01,202201-31`.'
        - $ref: '#/components/parameters/paging'
      description: |-
        Retrieve a list of `expenseClaimItems`.

        The `purchasedOn` query parameter can operate comparisons with a given date-time value:
        - `?purchasedOn=2021-01-01`: strict equality.
        - `?purchasedOn=since,2021-01-01`: greater than or equal.
        - `?purchasedOn=until,2021-01-01`: lower than or equal.
        - `?purchasedOn=between,2021-01-01,2021-01-31`: comprised between two dates.
  /api/v3/expenseClaimItems/{expenseClaimItemId}:
    parameters:
      - $ref: "#/components/parameters/Authorization"
      - name: expenseClaimItemId
        in: path
        required: true
        description: Unique identifier of the ExpenseClaimItem.
        schema:
          type: integer
    get:
      summary: Get an ExpenseClaimItem by id 
      x-mint:
        href: /api-reference/legacy/cleemy-expenses/expenseclaimitems/get-an-expenseclaimitem-by-id
      description: Retrieve an expense claim item by its identifier.
      tags:
        - ExpenseClaimItems
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/ExpenseClaimItem'
        '400':
          $ref: '#/components/responses/ResponseProblem'
        '401':
          $ref: '#/components/responses/ResponseProblem'
        '404':
          $ref: '#/components/responses/ResponseProblem'
        '500':
          $ref: '#/components/responses/ResponseProblem'
      operationId: get-api-v3-expenseClaimItems-expenseClaimItemId
  /cleemy/services/v3/createExpenseAccountingExport:
    parameters:
      - $ref: "#/components/parameters/Authorization"
      - name: legalEntityId
        in: query
        required: true
        description: ID of the business-establishment for which entry lines will be exported.
        schema:
          type: integer
      - name: accountingDate
        in: query
        required: false
        description: The `accountingDate` parameter is not used here as a filter, but to override the accounting date of the exported entry lines to a specific date.
        schema:
          type: string
          format: date
      - name: approvedOn
        in: query
        required: false
        description: '{comparator},{date-time}'
        schema:
          type: string
      - name: controlledOn
        in: query
        required: false
        description: '{comparator},{date-time}'
        schema:
          type: string
    post:
      summary: Create an export and retrieve export content
      x-mint:
        href: /api-reference/legacy/cleemy-expenses/exports/post-create-expense-accounting-export
      description: |-
        Create a new export and retrieve the export content directly in the response body for a given business-establishment.

        **In the v3 API model, the business-establishment is often called "legal-entity". As a result, the `legalEntityId` query parameter corresponds to the ID of a business-establishment.**

        The response contains all the exported entry lines for the given business-establishment.

        The date query parameters can operate comparisons with a given date-time value. For examples :
          - `?approvedOn=2021-01-01`: strict equality.
          - `?approvedOn=since,2021-01-01`: greater than or equal.
          - `?approvedOn=until,2021-01-01`: lower than or equal.
          - `?approvedOn=between,2021-01-01,2021-01-31`: comprised between two dates.
      
      operationId: post-create-expense-accounting-export
      responses:
        '200':
          description: The export file is successfully generated.
          content:
            application/octet-stream:
              schema:
                type: string
                description: Content of the export file.
              examples:
                exportExample:
                  summary: Sample export file
                  description: Example of an expense accounting export.
                  value: |
                    Accounting date;Journal;Account;Auxilliary;Analytic;Label;Exp. Num;Debit;Credit
                    31/01/2025;Exp;421000;421001;;Exp Richard Jules - 01/25;2186;0,00;267,47
                    31/01/2025;Exp;625600;;CC03;Exp Richard Jules - 01/25;2186;200,00;0,00
                    31/01/2025;Exp;625100;;CC02;Exp Richard Jules - 01/25;2186;67,47;0,00
                    10/02/2025;Exp;421000;421000;;Exp Alibert Chloe - 02/25;2194;0,00;63,43
                    10/02/2025;Exp;467000;;CC04;Exp Alibert Chloe - 02/25;2194;52,86;0,00
                    10/02/2025;Exp;445660;;CC04;Exp Alibert Chloe - 02/25;2194;10,57;0,00
        '400':
          $ref: '#/components/responses/ResponseProblem'
        '401':
          $ref: '#/components/responses/ResponseProblem'
        '403':
          $ref: '#/components/responses/ResponseProblem'
        '500':
          $ref: '#/components/responses/ResponseProblem'
      tags:
        - CreateExpenseAccountingExport
components:
  schemas:
    ExpenseTempItem:
      type: object
      x-examples:
        example-1:
          id: 11022
          purchasedOn: '2016-06-08T00:00:00'
          originalTransaction:
            grossAmount: 45.26
            currencyId: GBP
            currency:
              id: GBP
              symbol: £
            isExpenseAbroad: false
          processedAmounts:
            amount: 57.9
            reimbursedAmount: 57.9
            grossAmount: 57.9
            currencyId: EUR
            currency:
              id: EUR
              name: Euro
              url: 'https://lucca.ilucca.net/api/v3/currencies/EUR'
            netAmount: 57.9
            vatBases:
              - countryVatRateId: 2
                countryVatRate:
                  id: 2
                  name: null
                  url: 'https://lucca.ilucca.net/api/v3/countryvatrates/2'
                vatAmount: 0
                amountExcludingVat: 57.9
                isDeprecatedVat: false
          expenseNatureId: 1
          mileage:
            distance: null
            power: null
            waypoints: null
          quantity: 1
          effectiveQuantity: 3
          attendees:
            internal:
              - id: 338
                displayName: Catteau Bruno
            external:
              - id: 46
                displayName: Test Corp / Test TS
          axisSections:
            - id: 658
              code: RDEV
              name: Recherche & Développement
              axisId: 4
          customFields:
            '1':
              code: 'false'
              name: Non
          merchant: Pub The Wellington
          comment: Exemple dépense
          originalReceipt: null
          receiptPreview: null
          warnings:
            dayOff: false
            isConstrained: false
            showDayOffWarning: false
            isAboveWarningLimit: false
            isAbsoluteLimitOverridden: false
          authorizedActions:
            isCancellable: true
            isEditable: true
          source:
            value: 6
            id: 6
            code: Api
            name: API
          ownerId: 361
          paymentMethod:
            value: 0
            id: 0
            code: User
            name: Collaborateur
          status:
            value: 2
            id: 2
            code: Valid
            name: Valide
      examples: []
      title: The ExpenseTempItem Resource
      description: 'The `ExpenseTempItem`, or "temporary expense" is an expense that has not yet been declared (within an expense report) by its owner (the user who made the expense). Once submitted within an expense report, the expense turns into an `ExpenseClaimItem`.'
      x-tags:
        - ExpenseTempItems
      properties:
        id:
          type: integer
          minimum: 1
          readOnly: true
        purchasedOn:
          type: string
          format: date
          description: Day the expense was made.
        originalTransaction:
          type: object
          required: [grossAmount, currencyId]
          description: Expense amount in original currency.
          properties:
            grossAmount:
              type: number
              multipleOf: 0.01
            currencyId:
              $ref: '#/components/schemas/CurrencyId'
            isExpenseAbroad:
              type: boolean
              default: false
              description: Whether the expense was made in a different country than the owner establishment's.
        processedAmounts:
          type: object
          description: Various amounts in the establishment's currency.
          required: [grossAmount, currencyId]
          properties:
            grossAmount:
              type: number
              multipleOf: 0.01
              description: Original transaction amount converted into the establishment's currency.
            currencyId:
              $ref: '#/components/schemas/CurrencyId'
            currency:
              allOf:
                - $ref: '#/components/schemas/Currency'
                - readOnly: true
            netAmount:
              type: number
              multipleOf: 0.01
              description: The converted amount after the expense policy has been applied.
              readOnly: true
            vatBases:
              type: array
              readOnly: true
              items:
                type: object
                properties:
                  countryVatRateId:
                    type: integer
                    minimum: 1
                  countryVatRate:
                    type: object
                    description: Applicable VAT rate for this amount.
                    properties:
                      id:
                        type: integer
                        minimum: 1
                      name:
                        type: string
                      url:
                        type: string
                        format: uri
                  vatAmount:
                    type: number
                    multipleOf: 0.01
                  amountExcludingVat:
                    type: number
                    multipleOf: 0.01
        expenseNatureId:
          type: integer
          description: 'Nature of the expense: Meals, Train, Taxi, Hotels, Taxi, Mileage... List depends on the app configuration.'
          minimum: 1
        mileage:
          type:
            - object
            - 'null'
          description: Additional information when the expense type is mileage.
          properties:
            distance:
              type: number
              description: Distance where the unit depends on the establishment.
            power:
              type: number
              description: Tax horsepower of the vehicle.
            waypoints:
              type: array
              description: The collection of waypoints including intermediate waypoints.
              items: {}
        quantity:
          type: integer
          description: The quantity when the expense type is 'Quantity'.
          minimum: 1
          default: 1
        effectiveQuantity:
          type: integer
          minimum: 1
          description: Calculated quantity when the expense type is 'Quantity' or 'Invitations' (number of attendees).
          readOnly: true
        attendees:
          type:
            - object
            - 'null'
          description: Additional information when the expense type is 'Invitation'.
          properties:
            internal:
              type: array
              description: 'Attendees who work for the company (ie: Users in the system).'
              items:
                $ref: '#/components/schemas/SimpleUser'
            external:
              type: array
              description: 'External attendees (eg: clients, candidates).'
              items:
                type: object
                description: Id of the custom field.
                properties:
                  id:
                    type: integer
                    minimum: 1
                  displayName:
                    type: string
        axisSections:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/AxisSection'
        customFields:
          description: Values for custom fields.
          type:
            - object
            - 'null'
          additionalProperties:
            type: object
            properties:
              code:
                type: string
                description: Value inputted by the user.
              name:
                type: string
                description: 'Label corresponding to the input value based on the configuration (eg: ''Yes'' for checkbox).'
                readOnly: true
        merchant:
          type:
            - string
            - 'null'
          description: Merchant of the expense.
        comment:
          type:
            - string
            - 'null'
        expenseReceipts:
          type:
            - array
            - 'null'
          description: |-
            The expense receipts (PDF file, image, ...) attached to this expense. Technically, there could be more than one, but in reality, there’s usually just one.

            **Important**: to attach a receipt when creating or updating an expense, you must first upload the file via `POST /lucca-files/api/uploads`, then create an `ExpenseReceipt` via `POST /api/v3/expenseReceipts` (providing the `uploadId`), and finally reference the receipt by its `id` here. Passing the file upload ID directly will result in a `403 Forbidden` error. See the [Attaching receipts guide](/api-reference/legacy/cleemy-expenses/guides/attaching-receipts).
          items:
            $ref: '#/components/schemas/ExpenseReceipt'
        authorizedActions:
          type: object
          description: Authorized actions on the expense for the current user.
          properties:
            isCancellable:
              type: boolean
              description: Expense can be deleted by the current authenticated user.
            isEditable:
              type: boolean
              description: Expense can be edited by the current authenticated user.
          readOnly: true
        sourceId:
          $ref: '#/components/schemas/SourceId'
        source:
          $ref: '#/components/schemas/Enum'
        ownerId:
          type: integer
          description: Unique identifier of the user that made this expense.
        paymentMethodId:
          $ref: '#/components/schemas/PaymentMethodId'
        paymentMethod:
          $ref: '#/components/schemas/Enum'
        statusId:
          $ref: '#/components/schemas/StatusId'
        status:
          $ref: '#/components/schemas/Enum'
        deviceId: 
          type: string
          const: "Web"
      required: [id, purchasedOn, paymentMethodId, expenseNatureId, ownerId, deviceId, quantity, originalTransaction, processedAmounts]
    ExpenseClaim:
      type: object
      title: The ExpenseClaim Resource
      description: |-
        When a user wants to declare his expenses, he creates an `ExpenseClaim`.

        An `ExpenseClaim` is created by regrouping one or more `ExpenseTempItems` and converting them into ExpenseClaimItems.

        Once created, an `ExpenseClaim` has to be approved by his manager.

        Multiple `ExpenseClaims` can be created through a single request.
      x-tags:
        - ExpenseClaims
      properties:
        id:
          type: integer
          minimum: 1
          readOnly: true
        name:
          type: string
          maxLength: 255
          description: 'Name of the expense claim. If empty, it will be generated with the month and year of the last of claim item.'
        declaredOn:
          type: string
          format: date-time
          description: Day the expenseClaim has been declared (Time zone Europe/Paris).
          readOnly: true
        createdOn:
          type: string
          format: date-time
          description: Day the expenseClaim has been created (Time zone Europe/Paris).
          readOnly: true
        modifiedOn:
          type: string
          format: date-time
          description: Day the expenseClaim has been modified (Time zone Europe/Paris).
          readOnly: true
        paymentReceivedOn:
          type: string
          format: date-time
          description: Day the expenseClaim has been paid (Time zone Europe/Paris).
          readOnly: true
        sourceId:
          allOf:
            - $ref: '#/components/schemas/SourceId'
            - readOnly: true
        source:
          allOf:
            - $ref: '#/components/schemas/Enum'
            - readOnly: true
        paymentMethodId:
          allOf:
            - $ref: '#/components/schemas/PaymentMethodId'
            - readOnly: true
        paymentMethod:
          allOf:
            - $ref: '#/components/schemas/Enum'
            - readOnly: true
        statusId:
          allOf:
            - $ref: '#/components/schemas/ClaimStatusId'
            - readOnly: true
        status:
          allOf:
            - $ref: '#/components/schemas/Enum'
            - readOnly: true
        approvalStateId:
          allOf:
            - $ref: '#/components/schemas/ApprovalStateId'
            - readOnly: true
        approvalState:
          allOf:
            - $ref: '#/components/schemas/Enum'
            - readOnly: true
        authorizedActions:
          type: object
          description: Authorized actions on the expenseClaim for the current user.
          properties:
            isCancellable:
              type: boolean
              description: The expenseClaim can be deleted by the current authenticated user.
            isEditable:
              type: boolean
              description: The expenseClaim can be edited by the current authenticated user.
            isApprovable:
              type: boolean
              description: The expenseClaim can be approved by the current authenticated user.
            isControllable:
              type: boolean
              description: The expenseClaim can be controlled by the current authenticated user.
            isUnControllable:
              type: boolean
              description: The current authenticated user can cancel the control of the expenseClaim.
          readOnly: true
        ownerId:
          type: integer
          description: Unique identifier of the user that made this expenseClaim.
          readOnly: true
        owner:
          $ref: '#/components/schemas/Owner'
        authorId:
          type: integer
          description: Unique identifier of the user that created this grouping of expense.
        author:
          $ref: '#/components/schemas/EntityBase'
        legalEntityId:
          type: integer
        legalEntity:
          $ref: '#/components/schemas/EntityBase'
        departmentId:
          type: integer
        department:
          $ref: '#/components/schemas/EntityBase'
        currencyId:
          $ref: '#/components/schemas/CurrencyId'
        currency:
          $ref: '#/components/schemas/Currency'
      required:
        - declaredOn
        - createdOn
        - modifiedOn
    ExpenseClaimItem:
      type: object
      examples: []
      title: The ExpenseClaimItem Resource
      description: 'The `ExpenseClaimItem`, is an expense that has been declared (within an expense report) by its owner (the user who made the expense).'
      x-tags:
        - ExpenseClaimItems
      properties:
        id:
          type: integer
          minimum: 0
          readOnly: true
        expenseClaimId: 
          type: integer
          minimum: 0
          readOnly: true
          description: Id of the expense claim in which the item is contained.     
        lineNumber:
          type: integer
          minimum: 0
          description: Incremental number used to order expense claim items in an expense claim
        isControlled:
          type: boolean
          description: <true> if the item has been controlled 
        purchasedOn:
          type: string
          format: date-time
          description: Day the expense was made. 
        createdOn:
          type: string
          format: date-time
          description: Date-time the item was created. Corresponds to the submition date of the expense claim.  
        modifiedOn:
          type: string
          format: date-time
          description: Date-time the item was last modified.   
        originalTransaction:
          type: object
          description: Expense amount in original currency.
          properties:
            grossAmount:
              type: number
              multipleOf: 0.01
            currencyId:
              $ref: '#/components/schemas/CurrencyId'
            isExpenseAbroad:
              type: boolean
              description: Whether the expense was made in a different country than the owner establishment's.
            currency:
              $ref: '#/components/schemas/Currency'
        processedAmounts:
          type: object
          description: Various amounts in the establishment's currency.
          properties:
            grossAmount:
              type: number
              multipleOf: 0.01
              description: Original transaction amount converted into the establishment's currency.
            currencyId:
              $ref: '#/components/schemas/CurrencyId'
            currency:
              $ref: '#/components/schemas/Currency'
            netAmount:
              type: number
              multipleOf: 0.01
              description: The converted amount after the expense policy has been applied.
            vatBases:
              type: array
              items:
                type: object
                properties:
                  countryVatRateId:
                    type: integer
                    minimum: 1
                  countryVatRate:
                    type: object
                    description: Applicable VAT rate for this amount.
                    properties:
                      id:
                        type: integer
                        minimum: 1
                      name:
                        type: string
                      url:
                        type: string
                        format: uri
                  vatAmount:
                    type: number
                    multipleOf: 0.01
                  amountExcludingVat:
                    type: number
                    multipleOf: 0.01
          readOnly: true
        expenseNatureId:
          type: integer
          description: 'Nature of the expense: Meals, Train, Taxi, Hotels, Taxi, Mileage... List depends on the app configuration.'
          minimum: 0
        mileage:
          type:
            - object
            - 'null'
          description: Additional information when the expense type is mileage.
          properties:
            distance:
              type: number
              description: Distance where the unit depends on the establishment.
            power:
              type: number
              description: Tax horsepower of the vehicle.
            waypoints:
              type: array
              description: The collection of waypoints including intermediate waypoints.
              items: {}
        quantity:
          type: integer
          description: The quantity when the expense type is 'Quantity'.
          minimum: 1
          default: 1
        effectiveQuantity:
          type: integer
          minimum: 1
          description: Calculated quantity when the expense type is 'Quantity' or 'Invitations' (number of attendees).
          readOnly: true
        attendees:
          type:
            - object
            - 'null'
          description: Additional information when the expense type is 'Invitation'.
          properties:
            internal:
              type: array
              description: 'Attendees who work for the company (ie: Users in the system).'
              items:
                $ref: '#/components/schemas/SimpleUser'
            external:
              type: array
              description: 'External attendees (eg: clients, candidates).'
              items:
                type: object
                description: Id of the custom field.
                properties:
                  id:
                    type: integer
                    minimum: 1
                  displayName:
                    type: string
        axisSections:
          type:
            - array
            - 'null'
          description: Axis sections values.
          items:
            $ref: '#/components/schemas/AxisSection'
        customFields:
          description: Values for custom fields.
          type:
            - object
            - 'null'
          additionalProperties:
            type: object
            properties:
              code:
                type: string
                description: Value inputted by the user.
              name:
                type: string
                description: 'Label corresponding to the input value based on the configuration (eg: ''Yes'' for checkbox).'
                readOnly: true
        merchant:
          type:
            - string
            - 'null'
          description: Merchant of the expense.
        comment:
          type:
            - string
            - 'null'
        expenseReceipts:
          type:
            - array
            - 'null'
          description: |-
            The expense receipts (PDF file, image, ...) attached to this expense. Technically, there could be more than one, but in reality, there’s usually just one.

            **Important**: to attach a receipt when creating or updating an expense, you must first upload the file via `POST /lucca-files/api/uploads`, then create an `ExpenseReceipt` via `POST /api/v3/expenseReceipts` (providing the `uploadId`), and finally reference the receipt by its `id` here. Passing the file upload ID directly will result in a `403 Forbidden` error. See the [Attaching receipts guide](/api-reference/legacy/cleemy-expenses/guides/attaching-receipts).
          items:
            $ref: '#/components/schemas/ExpenseReceipt'
        authorizedActions:
          type: object
          description: Authorized actions on the expense for the current user.
          properties:
            isCancellable:
              type: boolean
              description: Expense can be deleted by the current authenticated user.
            isEditable:
              type: boolean
              description: Expense can be edited by the current authenticated user.
          readOnly: true
        sourceId:
          $ref: '#/components/schemas/SourceId'
        source:
          $ref: '#/components/schemas/Enum'
        ownerId:
          type: integer
          description: Unique identifier of the user that made this expense.
        paymentMethodId:
          $ref: '#/components/schemas/PaymentMethodId'
      required:
        - purchasedOn
        - expenseNatureId
    ApprovalStateId:
      title: ApprovalStateId
      type: object
      description: |-
        State of the approval of the expenseClaim.
        - 0: the approval is created.
        - 1: the expenseClaim has been partially approved.
        - 2: the expenseClaim has been approved.
        - 3: the expenseClaim has been refused.
        - 4: the expenseClaim has been cancelled.
      properties:
        id:
          type: number
          enum:
            - 0
            - 1
            - 2
            - 3
            - 4
    ClaimStatusId:
      title: ClaimStatusId
      type: object
      description: |-
        Status of the expenseClaim.
        - 1: the expenseClaim is created.
        - 2: the expenseClaim has been partially approved.
        - 3: the expenseClaim has been approved.
        - 4: the expenseClaim has been controlled.
        - 5: the expenseClaim has been approved and controlled.
        - 6: the payment of the expenseClaim has been initiated.
        - 7: the expenseClaim has been paid.
        - 8: the expenseClaim has been refused.
        - 9: the expenseClaim has been cancelled.
      properties:
        id:
          type: number
          enum:
            - 0
            - 1
            - 2
            - 3
            - 4
            - 5
            - 6
            - 7
            - 8
    Currency:
      title: Currency
      type: object
      properties:
        id:
          $ref: '#/components/schemas/CurrencyId'
        name:
          type: string
          description: 'Label of the currency (eg: Pound sterling).'
        url:
          type: string
          format: uri
      description: ''
    CurrencyId:
      title: CurrencyId
      description: 'ISO code of the currency (eg: ''EUR'', ''USD'', ''GBP'', ...).'
      type: string
    EntityBase:
      title: EntityBase
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        url:
          type: string
    Enum:
      title: Enum
      type: object
      description: ''
      properties:
        id:
          type: number
        name:
          type: string
          readOnly: true
        code:
          type: string
    ExpenseReceipt:
      title: ExpenseReceipt
      type: object
      description: |-
        An expense's receipt. Can be downloaded, either as an original or preview file, by following the `href` link. 
        Please note that a 302 Redirect may be returned, in which case you have to follow the URL returned in the `Location` HTTP header
        while making sure to keep the original request headers (`Authorization` in particular, otherwise you may get a 401 Unauthorized error).

        <Warning>
          Powershell Invoke-WebRequest method strips Authorization headers from 302 redirect requests. You should use the `-PreserveAuthorizationOnRedirect` 
          parameter in order to keep the Authorization headers when following redirects.
        </Warning>
      properties:
        id:
          type: string
          format: uuid
          description: The ID of this expense receipt.
          example: f0d01fd0-5f27-4061-8dca-bee6318b0103
        originalReceipt:
          description: The original file.
          type: object
          properties:
            id:
              type: string
              format: uuid
              description: The ID of the expense receipt file.
              example: cb0aae89-56c9-48db-9052-48981660e0f7
            name:
              type: string
              example: receipt-f0d01fd0-5f27-4061-8dca-bee6318b0103.pdf
            href:
              type: string
              format: uri
              description: |-
                Follow this link to download this expense receipt original file. Please note that a 302 Redirect may be returned, in which case you have to follow the URL returned in the `Location` HTTP header
                while making sure to keep the original request headers (`Authorization` in particular, otherwise you may get a 401 Unauthorized error).

                <Warning>
                  Powershell Invoke-WebRequest method strips Authorization headers from 302 redirect requests. You should use the `-PreserveAuthorizationOnRedirect` 
                  parameter in order to keep the Authorization headers when following redirects.
                </Warning>
              example: https://example.ilucca.net/api/v3/ExpenseReceipts/f0d01fd0-5f27-4061-8dca-bee6318b0103/originalReceiptFile
            extension:
              type: string
              description: Suffix to the name of a file (e.g., .txt, .pdf, .jppg) that indicates its content type or its intended use.
              example: .pdf
        receiptPreview:
          description: Lower resolution (i.e. thumbnail) file of the original expense receipt.
          type: object
          properties:
            id:
              type: string
              format: uuid
              description: The ID of the expense receipt file (same as original).
              example: cb0aae89-56c9-48db-9052-48981660e0f7
            name:
              type: string
              example: receipt-f0d01fd0-5f27-4061-8dca-bee6318b0103-preview.pdf
            href:
              type: string
              format: uri
              description: |-
                Follow this link to download this expense receipt preview image (i.e. thumbnail), even if the original file is not an image (e.g. PDF).

                Image size can be negotiated via the `?imageSize` query parameter. Available sizes are: `Small | Medium | Large | Full` (e.g.: `?imageSize=Small`).

                If the original file is a PDF, then you may request any given page (default is the first) by adding the `?pageNumber` query parameter (takes an integer that starts at 1).

                Please note that a 302 Redirect may be returned, in which case you have to follow the URL returned in the `Location` HTTP header
                while making sure to keep the original request headers (`Authorization` in particular, otherwise you may get a 401 Unauthorized error).

                <Warning>
                  Powershell Invoke-WebRequest method strips Authorization headers from 302 redirect requests. You should use the `-PreserveAuthorizationOnRedirect` 
                  parameter in order to keep the Authorization headers when following redirects.
                </Warning>
              example: https://example.ilucca.net/api/v3/ExpenseReceipts/f0d01fd0-5f27-4061-8dca-bee6318b0103/receiptPreviewFile
            extension:
              type: string
              description: Suffix to the name of a file (e.g., .txt, .pdf, .jppg) that indicates its content type or its intended use.
              example: .pdf
    Owner:
      title: Owner
      type: object
      properties:
        id:
          type: integer
          minimum: 1
        name:
          type: string
        url:
          type: string
          format: uri
        firstName:
          type: string
        lastName:
          type: string
    PaymentMethodId:
      title: PaymentMethodId
      description: |-
        How this expense was made: the owner used his money, an enterprise debit card, or a Cleemy card:
        - 0: User
        - 1: CorporateCard
        - 3: Cleemy Card
      type: integer
      enum:
        - 0
        - 1
        - 3
    SourceId:
      title: SourceId
      type: object
      properties:
        id:
          type: string
      description: |-
        The source describes how the expense was created:
        - 0: Legacy
        - 1: OldImport
        - 2: ImportByCb
        - 3: ImportByNature
        - 4: Anytime
        - 5: BudgetInsight
        - 6: Api
        - 7: Ocr
        - 8: Reconciliation
        - 9: InvoiceAggregator
        - 10: EmailAttachments
        - 11: FtpStatementImport
        - 12: CleemyPayment
    StatusId:
      title: StatusId
      type: object
      description: |-
        Status of the expense.
        - 0: the expense is not valid.
        - 1: the expense has been completed by the system and review is still pending
        - 2: the expense has been completed and reviewed and it can be declared.
      properties:
        id:
          type: number
          enum:
            - 0
            - 1
            - 2
    SimpleUser:
      description: ''
      type: object
      properties:
        id:
          type: number
        name:
          type: string
          minLength: 1
        url:
          type: string
          minLength: 1
        displayName:
          type: string
          minLength: 1
        modifiedOn:
          type: string
          minLength: 1
        lastName:
          type: string
          minLength: 1
        firstName:
          type: string
          minLength: 1
        login:
          type: string
          minLength: 1
        mail:
          type: string
          minLength: 1
        dtContractStart:
          type: string
          minLength: 1
        dtContractEnd: {}
        birthDate:
          type: string
          minLength: 1
        employeeNumber:
          type: string
          minLength: 1
        calendar:
          type: object
          properties:
            id:
              type: number
            url:
              type: string
              minLength: 1
            name:
              type: string
              minLength: 1
          required:
            - id
            - url
            - name
        culture:
          type: object
          properties:
            id:
              type: number
            name:
              type: string
              minLength: 1
            url:
              type: string
              minLength: 1
          required:
            - id
            - name
            - url
        picture:
          type: object
          properties:
            id:
              type: string
              minLength: 1
            url:
              type: string
              minLength: 1
            name:
              type: string
              minLength: 1
          required:
            - id
            - url
            - name
        applicationData:
          type: object
          properties:
            profile_figgo:
              type: object
              properties:
                id:
                  type: number
                name:
                  type: string
                  minLength: 1
                url:
                  type: string
                  minLength: 1
              required:
                - id
                - name
                - url
            profile_utime:
              type: object
              properties:
                id:
                  type: number
                name:
                  type: string
                  minLength: 1
                url:
                  type: string
                  minLength: 1
              required:
                - id
                - name
                - url
          required:
            - profile_figgo
            - profile_utime
        legalEntity:
          type: object
          properties:
            id:
              type: number
            name:
              type: string
              minLength: 1
            url:
              type: string
              minLength: 1
          required:
            - id
            - name
            - url
        department:
          type: object
          properties:
            id:
              type: number
            name:
              type: string
              minLength: 1
            url:
              type: string
              minLength: 1
          required:
            - id
            - name
            - url
        manager:
          type: object
          properties:
            id:
              type: number
            name:
              type: string
              minLength: 1
            url:
              type: string
              minLength: 1
          required:
            - id
            - name
            - url
        rolePrincipal:
          type: object
          properties:
            id:
              type: number
            name:
              type: string
              minLength: 1
            url:
              type: string
              minLength: 1
          required:
            - id
            - name
            - url
        habilitedRoles:
          type: array
          uniqueItems: true
          minItems: 1
          items:
            required:
              - id
              - name
              - url
            properties:
              id:
                type: number
              name:
                type: string
                minLength: 1
              url:
                type: string
                minLength: 1
        userWorkCycles:
          type: array
          uniqueItems: true
          minItems: 1
          items:
            required:
              - Id
              - OwnerID
              - WorkCycleID
              - StartsOn
              - EndsOn
            properties:
              Id:
                type: number
              OwnerID:
                type: number
              WorkCycleID:
                type: number
              StartsOn:
                type: string
                minLength: 1
              EndsOn:
                type: string
                minLength: 1
      required:
        - id
        - name
        - url
        - displayName
        - modifiedOn
        - lastName
        - firstName
        - login
        - mail
        - dtContractStart
        - birthDate
        - employeeNumber
        - calendar
        - culture
        - picture
        - applicationData
        - legalEntity
        - department
        - manager
        - rolePrincipal
        - habilitedRoles
        - userWorkCycles
      x-examples:
        example-1:
          id: 416
          name: John Doe
          url: 'http://lucca.test/api/users/1'
          displayName: Doe John
          modifiedOn: '2015-09-07T10:20:06.583'
          lastName: DOE
          firstName: John
          login: jdoe
          mail: no-reply@lucca.fr
          dtContractStart: '2014-09-01T00:00:00'
          dtContractEnd: null
          birthDate: '1989-12-22T00:00:00'
          employeeNumber: '00057'
          calendar:
            id: 1
            url: 'http://lucca.test/api/v3/publicHolidayCalendars/1'
            name: Jours fériés en France
          culture:
            id: 1036
            name: français (France)
            url: 'http://lucca.test/api/v3/cultures/1036'
          picture:
            id: 74d381db-dd4d-4f64-bc1e-582d806e58a8
            url: 'http://lucca.test/api/v3/files/74d381db-dd4d-4f64-bc1e-582d806e58a8'
            name: jdoe.png
          applicationData:
            profile_figgo:
              id: 1
              name: Cadre (218 jours)
              url: 'https://lucca.local.dev/api/v3/leaveprofiles/1'
            profile_utime:
              id: 1
              name: Lucca
              url: 'https://lucca.local.dev/api/v3/utimeprofile_ede6d6bb22bcb47bf5b839d5f653fc7e41122f0eea37a7786ea9e095537a705c/1'
          legalEntity:
            id: 1
            name: Lucca
            url: 'http://lucca.test/api/v3/legalEntities/1'
          department:
            id: 13
            name: BU Timmi/Lucca
            url: 'http://lucca.test/api/v3/departments/13'
          manager:
            id: 383
            name: Roger Smith
            url: 'http://lucca.test/api/v3/users/383'
          rolePrincipal:
            id: 55
            name: User
            url: 'http://lucca.test/api/v3/roles/55'
          habilitedRoles:
            - id: 59
              name: Employee +
              url: 'http://lucca.test/api/v3/roles/59'
            - id: 63
              name: Analytics access
              url: 'http://lucca.test/api/roles/63'
          userWorkCycles:
            - Id: 288
              OwnerID: 416
              WorkCycleID: 6
              StartsOn: '1900-01-01T00:00:00'
              EndsOn: '2015-03-09T00:00:00'
            - Id: 289
              OwnerID: 416
              WorkCycleID: 9
              StartsOn: '2015-03-10T00:00:00'
              EndsOn: '2015-10-13T00:00:00'
            - Id: 317
              OwnerID: 416
              WorkCycleID: 14
              StartsOn: '2015-10-13T00:00:00'
              EndsOn: '9999-12-31T00:00:00'
      title: User
    AxisSection:
      title: The Axis Section resource
      type: object
      properties:
        id:
          type: integer
          minimum: 1
        code:
          type: string
          readOnly: true
        name:
          type: string
          readOnly: true
        multilingualName:
          type: string
          readOnly: true
        description:
          type: string
          readOnly: true
        ownerId:
          type: integer
          minimum: 1
          readOnly: true
        startOn:
          type: string
          format: date-time
          readOnly: true
        endOn:
          type: string
          format: date-time
          readOnly: true
        active:
          type: boolean
          readOnly: true
        axisId:
          type: integer
          readOnly: true
        parentAxisSections:
          type: array
          items:
            type: object
            description: Axis-section objects
          readOnly: true
        childrenAxisSections:
          type: array
          items:
            type: object
            description: Axis-section objects
          readOnly: true
      description: 'You can [read more about this resource here](/api-reference/legacy/organization/axis-sections/get-started).'  
  responses:
    ResponseProblem:
      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
  parameters:
    paging:
      name: paging
      in: query
      required: true
      schema:
        type: string
        example: '100,0'
      description: '{offset},{limit}. Defaults to 0,1000.'
    Authorization:
      name: Authorization
      required: true
      description: |-
        API key. Value must be formatted like so: `lucca application={api_key}`.
      in: header
      schema:
        type: string
