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

# Create an export and retrieve export content

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



## OpenAPI

````yaml /openapi-specs/cleemy-expenses-v3.yaml post /cleemy/services/v3/createExpenseAccountingExport
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://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: 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:
  /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:
      tags:
        - CreateExpenseAccountingExport
      summary: Create an export and retrieve export content
      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'
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:
    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

````