openapi: 3.1.0
info:
  title: Lucca.Invoices
  version: '1.0'
  description: |
    Welcome on the documentation for the Lucca Invoices 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: Purchases
    description: Purchases.
  - name: Cost-Centers
    description: Cost-Centers.
  - name: Approval
    description: Approval.
  - name: VAT
    description: VAT Rates.
  - name: Booked-Documents
    description: Booked-Documents.
  - name: Suppliers
    description: Suppliers.
  - name: Natures
    description: Natures.
  - name: Invoices
    description: Invoices.
  - name: Inbox
    description: Inbox.
  - name: Documents
    description: Documents.
paths:
  /cleemy-procurement/taxes/api/rates:
    parameters:
      - $ref: "#/components/parameters/Authorization"
    get:
      operationId: get-vat-rates
      x-mint:
        href: /api-reference/legacy/cleemy-invoices/purchases/get-vat-rates
      summary: List V.A.T. rates
      description: List V.A.T. rates.
      tags: [VAT]
      parameters:
        - name: date
          required: true
          in: query
          description: VAT rate may change over time. Date of the day VAT rates were applicable.
          schema:
            type: string
            format: date
            examples: ["2025-01-01"]
        - name: territoryId
          required: true
          in: query
          description: Territory over which the VAT rates apply.
          schema:
            type: string
            examples: ["FR"]
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/vat-rates"
              examples:
                rates:
                  $ref: "#/components/examples/vat-rates.get"
  /cleemy-procurement/api/purchases:
    parameters:
      - $ref: "#/components/parameters/Authorization"
    get:
      operationId: get-purchases
      x-mint:
        href: /api-reference/legacy/cleemy-invoices/purchases/get-purchases
      summary: List Purchases
      description: List purchases.
      tags: [Purchases]
      parameters:
      - $ref: "#/components/parameters/fields.root"
      - $ref: "#/components/parameters/page"
      - $ref: "#/components/parameters/limit"
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                required: [items]
                properties:
                  items:
                    type: array
                    items:
                      $ref: "#/components/schemas/purchase"
                  prev:
                    type: [string, integer, "null"]
                  next:
                    type: [string, integer, "null"]
                  count:
                    type: integer
                    format: int32
                    minimum: 0
              examples:
                purchase:
                  $ref: '#/components/examples/purchases.get'
    post:
      operationId: post-purchase
      x-mint:
        href: /api-reference/legacy/cleemy-invoices/purchases/post-purchase
      summary: Create a Purchase
      description: Create a Purchase.
      tags: [Purchases]
      requestBody:
        description: The purchase to create.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/purchase'
            examples:
              purchase:
                $ref: '#/components/examples/purchase.post'
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/purchase'
              examples:
                purchase:
                  $ref: '#/components/examples/purchase.get'
  /cleemy-procurement/api/purchases/{id}:
    parameters:
      - $ref: "#/components/parameters/Authorization"
      - name: id
        description: ID of the purchase.
        in: path
        required: true
        schema:
          type: integer
          format: int32
    get:
      operationId: get-purchase
      x-mint:
        href: /api-reference/legacy/cleemy-invoices/purchases/get-purchase
      summary: Get Purchase
      description: Retrieve a purchase by its ID.
      tags: [Purchases]
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                unevaluatedProperties: false
                allOf:
                  - $ref: "#/components/schemas/purchase"
              examples:
                purchase:
                  $ref: "#/components/examples/purchase.get"
  /cleemy-procurement/api/purchases/{id}/commitment:
    parameters:
      - $ref: "#/components/parameters/Authorization"
      - name: id
        description: ID of the purchase you want to create a commitment for.
        in: path
        required: true
        schema:
          type: integer
          format: int32
    post:
      operationId: post-purchase-commitment
      x-mint:
        href: /api-reference/legacy/cleemy-invoices/purchases/post-purchase-commitment
      summary: Create a commitment
      description: Create a commitment.
      tags: [Purchases]
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/commitment"
            examples:
              one-time:
                $ref: "#/components/examples/one-time-commitment.post"
              subscription:
                $ref: "#/components/examples/subscription-commitment.post"
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  items:
                    type: array
                    items:
                      $ref: '#/components/schemas/commitment'
              examples:
                commitment:
                  $ref: '#/components/examples/commitment.get'
  /cleemy-procurement/api/commitments/{id}/requests:
    parameters:
      - $ref: "#/components/parameters/Authorization"
      - name: id
        description: ID of the commitment you want to create a request for.
        in: path
        required: true
        schema:
          type: integer
          format: int32
    post:
      operationId: post-commitment-request
      x-mint:
        href: /api-reference/legacy/cleemy-invoices/workflow/post-commitment-request
      summary: Create a commitment request
      description: Trigger the approval workflow for a purchase commitment. Request body is expected to be empty.
      tags: [Approval]
      responses:
        '201':
          description: Commitment request successfuly created.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/commitment-request"
              examples:
                req:
                  $ref: "#/components/examples/commitment-request.get"
  /cleemy-procurement/api/costcenters:
    parameters:
      - $ref: "#/components/parameters/Authorization"
    get:
      operationId: get-cost-centers
      x-mint:
        href: /api-reference/legacy/cleemy-invoices/cost-centers/get-cost-centers
      summary: List Cost-Centers
      description: List cost-centers.
      tags: [Cost-Centers]
      parameters:
        - $ref: "#/components/parameters/fields.root"
        - $ref: "#/components/parameters/page"
        - $ref: "#/components/parameters/limit"
      responses:
        '200':
          description: Successful read of cost-centers
          content:
            application/json:
              schema:
                type: object
                required: [items]
                properties:
                  items:
                    type: array
                    items:
                      $ref: "#/components/schemas/cost-center"
                  prev:
                    type: [string, integer, "null"]
                  next:
                    type: [string, integer, "null"]
                  count:
                    type: integer
                    format: int32
                    minimum: 0
    post:
      operationId: post-cost-center
      x-mint:
        href: /api-reference/legacy/cleemy-invoices/cost-centers/post-cost-center
      summary: Create a Cost-Center
      description: Create a new cost-center.
      tags: [Cost-Centers]
      requestBody:
        description: Cost-center to create.
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/cost-center"
      responses:
        '201':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  items:
                    type: array
                    items:
                      $ref: "#/components/schemas/cost-center"
  /cleemy-procurement/api/costcenters/{id}:
    parameters:
      - $ref: "#/components/parameters/Authorization"
      - name: id
        description: ID of the cost-center.
        in: path
        required: true
        schema:
          type: integer
          format: int32
    get:
      operationId: get-cost-center
      x-mint:
        href: /api-reference/legacy/cleemy-invoices/cost-centers/get-cost-center
      summary: Get Cost-Center
      description: Retrieve a cost-center by its ID.
      tags: [Cost-Centers]
      responses:
        '200':
          description: Successful read of cost-center
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/cost-center"
    put:
      operationId: put-cost-center
      summary: Update Cost-Center
      description: Update a cost-center.
      tags: [Cost-Centers]
      x-mint:
        href: /api-reference/legacy/cleemy-invoices/cost-centers/put-cost-center
      requestBody:
        description: Cost-center to update.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/cost-center'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/cost-center'
  /cleemy-procurement/services/imports/costcenters:
    parameters:
      - $ref: "#/components/parameters/Authorization"
    post:
      operationId: import-cost-centers
      x-mint:
        href: /api-reference/legacy/cleemy-invoices/cost-centers/import-cost-centers
        content: |-
          <Tip>You may want to refer to the [dedicated guide](/api-reference/legacy/cleemy-invoices/guides/import-cost-centers).</Tip>
      summary: Import Cost-Centers
      description: Import a list of cost-centers. Endpoint to use for bulk import of cost-centers.
      tags: [Cost-Centers]
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                mode:
                  $ref: "#/components/schemas/import-mode"
                items:
                  description: "List of cost-centers to import."
                  type: array
                  items:
                    type: object
                    required: [name, code]
                    properties:
                      name:
                        description: "Name of the cost-center."
                        type: string
                      code:
                        description: "Code of the cost-center."
                        type: string
                      ownerId:
                        description: "ID of the user who will be the owner of the cost-center."
                        type: integer
                        format: int32
                      state:
                        description: "State of the cost-center. Disabled: the cost-center is disabled. Enabled: the cost-center is enabled."
                        $ref: "#/components/schemas/cost-center-state"
                      establishmentIds:
                        description: "IDs of the establishments to which the cost-center belongs."
                        type: array
                        items:
                          type: integer
                          format: int32
      responses:
        '200':
          description: Successful cost-centers import.
          content:
            application/json:
              schema:
                type: object
                properties:
                  mode:
                    $ref: "#/components/schemas/import-mode"
                  imported:
                    description: "Number of items imported."
                    type: integer
                    format: int32
                    minimum: 0
                  failedValidation:
                    description: "Number of items failed validation."
                    type: integer
                    format: int3é
                    minimum: 0
                  items:
                    type: array
                    items:
                      type: object
                      properties:
                        result:
                          $ref: "#/components/schemas/cost-center"
                        problem:
                          $ref: "#/components/schemas/problem"
  /cleemy-procurement/api/requests/{id}/cancellations:
    parameters:
      - $ref: "#/components/parameters/Authorization"
      - name: id
        description: ID of the commitment-request.
        in: path
        required: true
        schema:
          type: integer
          format: int32
    post:
      operationId: post-commitment-request-cancellation
      x-mint:
        href: /api-reference/legacy/cleemy-invoices/workflow/post-commitment-request-cancellation
      summary: Cancel a commitment-request
      description: Cancel a commitment-request.
      tags: [Approval]
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                comment:
                  type: string
      responses:
        '200':
          description: OK
  /cleemy-procurement/api/purchases/{id}/closing:
    parameters:
      - $ref: "#/components/parameters/Authorization"
      - name: id
        description: ID of the purchase.
        in: path
        required: true
        schema:
          type: integer
          format: int32
    post:
      operationId: post-purchase-closing
      x-mint:
        href: /api-reference/legacy/cleemy-invoices/purchases/post-purchase-closing
      summary: Close a purchase
      description: Close a purchase
      tags: [Approval]
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                comment:
                  type: string
                date:
                  type: string
                  format: date
      responses:
        '200':
          description: OK
  /cleemy-procurement/api/suppliers:
    parameters:
      - $ref: "#/components/parameters/Authorization"
    get:
      operationId: get-suppliers
      summary: List Suppliers
      description: List suppliers.
      tags: [Suppliers]
      x-mint:
        href: /api-reference/legacy/cleemy-invoices/suppliers/get-suppliers
      parameters:
        - name: state
          description: Filter on supplier state.
          in: query
          required: false
          schema:
            $ref: "#/components/schemas/supplier-state"
        - name: search.terms
          description: Full-text search on supplier name.
          in: query
          required: false
          schema:
            type: string
        - $ref: "#/components/parameters/fields.root"
        - $ref: "#/components/parameters/page"
        - $ref: "#/components/parameters/limit"
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                required: [items]
                properties:
                  items:
                    type: array
                    items:
                      $ref: "#/components/schemas/supplier"
                  prev:
                    type: [string, integer, "null"]
                  next:
                    type: [string, integer, "null"]
                  count:
                    type: integer
                    format: int32
                    minimum: 0
    post:
      operationId: post-supplier
      x-mint:
        href: /api-reference/legacy/cleemy-invoices/suppliers/post-supplier
      summary: Create a Supplier
      description: Create a new supplier.
      tags: [Suppliers]
      requestBody:
        description: Supplier to create.
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/supplier"
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/supplier"
  /cleemy-procurement/api/suppliers/{id}:
    parameters:
      - $ref: "#/components/parameters/Authorization"
      - name: id
        description: ID of the supplier.
        in: path
        required: true
        schema:
          type: integer
          format: int32
    get:
      operationId: get-supplier
      summary: Get Supplier
      description: Retrieve a supplier by its ID.
      tags: [Suppliers]
      x-mint:
        href: /api-reference/legacy/cleemy-invoices/suppliers/get-supplier
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/supplier"
    put:
      operationId: put-supplier
      summary: Update Supplier
      description: Update a supplier.
      tags: [Suppliers]
      x-mint:
        href: /api-reference/legacy/cleemy-invoices/suppliers/put-supplier
      requestBody:
        description: Supplier to update.
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/supplier"
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/supplier"
  /cleemy-procurement/api/natures:
    parameters:
      - $ref: "#/components/parameters/Authorization"
    get:
      operationId: get-natures
      summary: List Natures
      description: List natures.
      tags: [Natures]
      x-mint:
        href: /api-reference/legacy/cleemy-invoices/natures/get-natures
      parameters:
        - $ref: "#/components/parameters/fields.root"
        - $ref: "#/components/parameters/page"
        - $ref: "#/components/parameters/limit"
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                required: [items]
                properties:
                  items:
                    type: array
                    items:
                      $ref: "#/components/schemas/nature"
                  prev:
                    type: [string, integer, "null"]
                  next:
                    type: [string, integer, "null"]
                  count:
                    type: integer
                    format: int32
                    minimum: 0
    post:
      operationId: post-nature
      summary: Create a Nature
      description: Create a new nature.
      tags: [Natures]
      x-mint:
        href: /api-reference/legacy/cleemy-invoices/natures/post-nature
      requestBody:
        description: Nature to create.
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/nature"
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/nature"
  /cleemy-procurement/api/natures/{id}:
    parameters:
      - $ref: "#/components/parameters/Authorization"
      - name: id
        description: ID of the nature.
        in: path
        required: true
        schema:
          type: integer
          format: int32
    get:
      operationId: get-nature
      summary: Get Nature
      description: Retrieve a nature by its ID.
      tags: [Natures]
      x-mint:
        href: /api-reference/legacy/cleemy-invoices/natures/get-nature
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/nature"
    put:
      operationId: put-nature
      summary: Update Nature
      description: Update a nature.
      tags: [Natures]
      x-mint:
        href: /api-reference/legacy/cleemy-invoices/natures/put-nature
      requestBody:
        description: Nature to update.
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/nature"
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/nature"
  /cleemy-procurement/api/invoices/{id}:
    parameters:
      - $ref: "#/components/parameters/Authorization"
      - name: id
        description: ID of the invoice.
        in: path
        required: true
        schema:
          type: integer
          format: int32
    get:
      operationId: get-invoice
      summary: Get Invoice
      description: Retrieve an invoice by its ID.
      tags: [Invoices]
      x-mint:
        href: /api-reference/legacy/cleemy-invoices/invoices/get-invoice
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/invoice"
    put:
      operationId: put-invoice
      summary: Update Invoice
      description: Update an invoice.
      tags: [Invoices]
      x-mint:
        href: /api-reference/legacy/cleemy-invoices/invoices/put-invoice
      requestBody:
        description: Invoice fields to update.
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/invoice-edition"
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/invoice"
  /cleemy-procurement/api/invoices/{id}/confirmations:
    parameters:
      - $ref: "#/components/parameters/Authorization"
      - name: id
        description: ID of the invoice.
        in: path
        required: true
        schema:
          type: integer
          format: int32
    get:
      operationId: get-invoice-confirmations
      summary: List Invoice Confirmations
      description: List confirmations for an invoice.
      tags: [Invoices]
      x-mint:
        href: /api-reference/legacy/cleemy-invoices/invoices/get-invoice-confirmations
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/confirmation"
    post:
      operationId: post-invoice-confirmation
      summary: Confirm an Invoice
      description: Confirm (approve) an invoice.
      tags: [Invoices]
      x-mint:
        href: /api-reference/legacy/cleemy-invoices/invoices/post-invoice-confirmation
      requestBody:
        description: Confirmation to create.
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/confirmation-creation"
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/confirmation"
  /cleemy-procurement/services/inbox:
    parameters:
      - $ref: "#/components/parameters/Authorization"
    get:
      operationId: get-inbox-documents
      summary: List Inbox Documents
      description: List documents waiting to be processed in the inbox.
      tags: [Inbox]
      x-mint:
        href: /api-reference/legacy/cleemy-invoices/inbox/inbox-document/get-inbox-documents
      parameters:
        - name: ocrStatus
          description: Filter on OCR status.
          in: query
          required: false
          style: form
          explode: false
          schema:
            type: array
            items:
              type: string
              enum: [None, Pending, Completed, Failed, Applied]
        - name: authorIds
          description: Filter on author user IDs.
          in: query
          required: false
          style: form
          explode: false
          schema:
            type: array
            items:
              type: integer
              format: int32
        - name: purchaseIds
          description: Filter on purchase IDs.
          in: query
          required: false
          style: form
          explode: false
          schema:
            type: array
            items:
              type: integer
              format: int32
        - name: disputeIds
          description: Filter on dispute IDs.
          in: query
          required: false
          style: form
          explode: false
          schema:
            type: array
            items:
              type: integer
              format: int32
        - name: operations
          description: Filter on user operations (roles).
          in: query
          required: false
          style: form
          explode: false
          schema:
            type: array
            items:
              type: string
              enum: [Buyer, PurchasingManager, Accountant, Admin, Payer, PurchaseReader, InvoicingManager]
        - name: establishment.ids
          description: Filter on establishment IDs.
          in: query
          required: false
          style: form
          explode: false
          schema:
            type: array
            items:
              type: integer
              format: int32
        - name: establishment.includeNull
          description: Include documents with no establishment.
          in: query
          required: false
          schema:
            type: boolean
        - name: sort
          description: |-
            Sort order. Prefix with `-` for descending. Comma-separated for multiple properties.
          in: query
          required: false
          allowEmptyValue: true
          schema:
            type: ["null", "string"]
        - $ref: "#/components/parameters/fields.root"
        - $ref: "#/components/parameters/page"
        - name: limit
          description: Page size (max 100).
          in: query
          schema:
            type: integer
            minimum: 0
            maximum: 100
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                required: [items]
                properties:
                  items:
                    type: array
                    items:
                      $ref: "#/components/schemas/inbox-document"
                  prev:
                    type: ["string", "integer", "null"]
                  next:
                    type: ["string", "integer", "null"]
                  count:
                    type: integer
                    format: int32
                    minimum: 0
  /cleemy-procurement/services/inbox-documents/{id}:
    parameters:
      - $ref: "#/components/parameters/Authorization"
      - name: id
        description: ID of the inbox document.
        in: path
        required: true
        schema:
          type: integer
          format: int32
    put:
      operationId: put-inbox-document
      summary: Update Inbox Document
      description: Update an inbox document and optionally attach or create a purchase.
      tags: [Inbox]
      x-mint:
        href: /api-reference/legacy/cleemy-invoices/inbox/inbox-document/put-inbox-document
      requestBody:
        description: Inbox document data to update.
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/inbox-document-edition"
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/inbox-document"
  /cleemy-procurement/services/inbox-documents/{id}/book:
    parameters:
      - $ref: "#/components/parameters/Authorization"
      - name: id
        description: ID of the inbox document.
        in: path
        required: true
        schema:
          type: integer
          format: int32
    post:
      operationId: post-inbox-document-booking
      summary: Book an Inbox Document
      description: Book (validate) a document from the inbox. No request body is needed.
      tags: [Inbox]
      x-mint:
        href: /api-reference/legacy/cleemy-invoices/inbox/inbox-document/post-inbox-document-booking
      responses:
        '200':
          description: OK
  /cleemy-procurement/api/documents/{id}:
    parameters:
      - $ref: "#/components/parameters/Authorization"
      - name: id
        description: ID of the document.
        in: path
        required: true
        schema:
          type: integer
          format: int32
    get:
      operationId: get-document
      summary: Get Document
      description: Retrieve a document by its ID.
      tags: [Documents]
      x-mint:
        href: /api-reference/legacy/cleemy-invoices/documents/get-document
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/document"
    put:
      operationId: put-document
      summary: Update Document
      description: |-
        Update a document's information (e.g. accounting fields, amounts, supplier details) before booking it.

        **Warning**: This is a `PUT` request — the entire resource must be provided. Any field omitted from the payload may be reset to its default value.
      tags: [Documents]
      x-mint:
        href: /api-reference/legacy/cleemy-invoices/documents/put-document
      requestBody:
        description: Document to update.
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/document"
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/document"
    delete:
      operationId: delete-document
      summary: Delete Document
      description: Delete a document.
      tags: [Documents]
      x-mint:
        href: /api-reference/legacy/cleemy-invoices/documents/delete-document
      responses:
        '204':
          description: No Content
  /cleemy-procurement/api/booked-documents:
    parameters:
      - $ref: "#/components/parameters/Authorization"
    get:
      operationId: get-booked-documents
      x-mint:
        href: /api-reference/legacy/cleemy-invoices/booked-documents/get-booked-documents
      summary: List booked-documents
      description: List booked-documents (i.e. invoices and credit notes).
      tags: [Booked-Documents]
      parameters:
        - name: invoice.conformityStates
          description: Filter on invoices conformity state.
          in: query
          required: false
          explode: false
          style: form
          schema:
            type: array
            items:
              $ref: "#/components/schemas/invoice-conformity-state"
        - name: creditNote.conformityStates
          description: Filter on credit notes conformity state.
          in: query
          required: false
          style: form
          explode: false
          schema:
            type: array
            items:
              $ref: "#/components/schemas/credit-note-conformity-state"
        - name: createdAt.from
          description: Only return documents created after given date.
          in: query
          required: false
          schema:
            type: string
            format: date
        - name: createdAt.to
          description: Only return documents created before given date.
          in: query
          required: false
          schema:
            type: string
            format: date
        - $ref: "#/components/parameters/fields.root"
        - $ref: "#/components/parameters/page"
        - $ref: "#/components/parameters/limit"
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                required: [items]
                properties:
                  items:
                    type: array
                    items:
                      $ref: "#/components/schemas/booked-document"
                  prev:
                    type: [string, integer, "null"]
                  next:
                    type: [string, integer, "null"]
                  count:
                    type: integer
                    format: int32
                    minimum: 0
              examples:
                booked-documents:
                  $ref: "#/components/examples/booked-documents.get"
components:
  examples:
    purchases.get:
      summary: GET purchases response example.
      description: GET purchases response example.
      value:
        items:
          - id: 6655
            type: Subscription
            commitment:
              id: 6233
              type: SubscriptionCommitment
              owner:
                id: 416
                href: https://example.ilucca.net/api/v3/users/416
                name: John Doe
                firstName: John
                lastName: Doe
                pictureHref: https://example.ilucca.net/directory/api/employees/416/picture
              purchase:
                id: 6655
                href: "/cleemy-procurement/api/purchases/6655"
                name: AWS S3
                type: Subscription
              attachments:
                - id: 14810
                  file:
                    id: a6dcc9e5-d251-4d3a-86a2-74d9b452b643
                    href: "/cleemy-procurement/api/files/a6dcc9e5-d251-4d3a-86a2-74d9b452b643"
                    name: mintlify.png
                    displayHref: "/cleemy-procurement/api/files/a6dcc9e5-d251-4d3a-86a2-74d9b452b643/display"
                  createdAt: '2024-09-24T10:02:02.4476765+00:00'
                  pages:
                    displayHrefTemplate: "/cleemy-procurement/api/files/a6dcc9e5-d251-4d3a-86a2-74d9b452b643/display/pages/{pageNumber}"
                    count: 1
              comment: |-
                Renewal of our AWS S3 subscription.
              paymentMethod: SingleUseCard
              state: Provisioned
              startDate: '2024-09-24'
              firstInvoiceDate: '2024-09-24'
              invoicingFrequency:
                value: 12
                unit: Month
              subscriptionDuration:
                value: 12
                unit: Month
              subscriptionEndDate: '2025-09-23'
              contractualEndDate: null
              periodsCount: 1
              amountIncludingTaxesPerPeriod:
                base:
                  excludingTaxes:
                    value: 3239.57
                    currency: EUR
                  taxes: []
                  includingTaxes:
                    value: 3239.57
                    currency: EUR
                counter:
                  excludingTaxes:
                    value: 3239.57
                    currency: EUR
                  taxes: []
                  includingTaxes:
                    value: 3239.57
                    currency: EUR
                rate: 1
              amountIncludingTaxes:
                base:
                  excludingTaxes:
                    value: 3239.57
                    currency: EUR
                  taxes: []
                  includingTaxes:
                    value: 3239.57
                    currency: EUR
                counter:
                  excludingTaxes:
                    value: 3239.57
                    currency: EUR
                  taxes: []
                  includingTaxes:
                    value: 3239.57
                    currency: EUR
                rate: 1
              createdAt: '2024-09-24T10:02:01.9244011+00:00'
              author:
                name: John Doe
                firstName: John
                lastName: Doe
                pictureHref: https://example.ilucca.net/directory/api/employees/416/picture
                id: 416
                href: https://example.ilucca.net/api/v3/users/416
              modifiedAt: '2024-09-24T13:52:40.3558953+00:00'
              modifier:
                name: Matt Bawss
                firstName: Matt
                lastName: Bawss
                pictureHref: https://example.ilucca.net/directory/api/employees/979/picture
                id: 979
                href: https://example.ilucca.net/api/v3/users/979
            createdAt: '2024-09-24T10:02:01.7596447+00:00'
            modifiedAt: '2024-10-30T10:57:03.4349936+00:00'
            author:
              name: John Doe
              firstName: John
              lastName: Doe
              pictureHref: https://example.ilucca.net/directory/api/employees/416/picture
              id: 416
              href: https://example.ilucca.net/api/v3/users/416
            modifier:
              name: Gérôme Durand
              firstName: Gérôme
              lastName: Durand
              pictureHref: https://example.ilucca.net/directory/api/employees/1383/picture
              id: 1383
              href: https://example.ilucca.net/api/v3/users/1383
            owner:
              name: John Doe
              firstName: John
              lastName: Doe
              pictureHref: https://example.ilucca.net/directory/api/employees/416/picture
              id: 416
              href: https://example.ilucca.net/api/v3/users/416
            nature:
              name: Abonnement SAAS
              id: 1
              href: "/cleemy-procurement/api/natures/1"
            costCenter:
              name: 406_Product Ops
              code: 406_Product Ops
              id: 41
              href: "/cleemy-procurement/api/costcenters/41"
            establishment:
              name: Lucca Marseille
              id: 13
              href: https://example.ilucca.net/organization/structure/api/establishments/13
            department:
              name: Product Department
              id: 57
              href: https://example.ilucca.net/organization/structure/api/departments/57
            supplier:
              id: 952
              type: Concrete
              href: "/cleemy-procurement/api/suppliers/952"
              name: Amazon
              territory:
                name: United States of America
                id: US
                href: https://example.ilucca.net/organization/structure/api/countries?code=US
              flag: Unflagged
            availableAmount:
              base:
                value: 0
                currency: EUR
              counter:
                value: 0
                currency: EUR
              rate: 1
            billedAmount:
              base:
                value: 3214.66
                currency: EUR
              counter:
                value: 3214.66
                currency: EUR
              rate: 1
            committedAmount:
              base:
                value: 3214.66
                currency: EUR
              counter:
                value: 3214.66
                currency: EUR
              rate: 1
            confirmedAmount:
              base:
                value: 3214.66
                currency: EUR
              counter:
                value: 3214.66
                currency: EUR
              rate: 1
            requestedAmount:
              base:
                value: 3214.66
                currency: EUR
              counter:
                value: 3214.66
                currency: EUR
              rate: 1
            aggregatedStates:
              creditNotes:
                expected: 0
                toReview: 0
                partial: 0
                confirmed: 0
                pendingRetraction: 0
                removed: 0
                bypassed: 0
              invoices:
                expected: 0
                toReview: 0
                pendingBreakdown: 0
                confirmed: 0
                litigation: 0
                discarded: 0
                removed: 0
                bypassed: 1
              invoicesPayments:
                toPay: 0
                underReview: 0
                emitting: 0
                paid: 1
                onHold: 0
              creditNotesPayments:
                available: 0
                consumed: 0
                unavailable: 0
            axisSections: []
            title: AWS S3
            state: Closed
    purchase.post:
      summary: POST purchase request body example.
      description: POST purchase request body example.
      value:
        ownerId: 35
        natureId: 1
        costCenterId: 3
        establishmentId: 1
        departmentId: 14
        supplier:
          id: 6
        title: Purchase entry test
        axisSectionIds:
        - 361
    vat-rates.get:
      summary: GET VAT rate response example.
      description: GET VAT rate response example.
      value:
        - id: 1
          percentage: 0.2
          rateType:
            id: 45
            name: "Normal"
            territoryId: "FR"
            recoveryRules:
              - costFamilyId: 1
                coefficient: 0
              - costFamilyId: 2
                coefficient: 0
              - costFamilyId: 7
                coefficient: 0
    purchase.get:
      summary: GET purchase response example.
      description: GET purchase response example.
      value:
        id: 6655
        type: Subscription
        commitment:
          id: 6233
          type: SubscriptionCommitment
          owner:
            id: 416
            href: https://example.ilucca.net/api/v3/users/416
            name: John Doe
            firstName: John
            lastName: Doe
            pictureHref: https://example.ilucca.net/directory/api/employees/416/picture
          purchase:
            id: 6655
            href: "/cleemy-procurement/api/purchases/6655"
            name: AWS S3
            type: Subscription
          attachments:
            - id: 14810
              file:
                id: a6dcc9e5-d251-4d3a-86a2-74d9b452b643
                href: "/cleemy-procurement/api/files/a6dcc9e5-d251-4d3a-86a2-74d9b452b643"
                name: mintlify.png
                displayHref: "/cleemy-procurement/api/files/a6dcc9e5-d251-4d3a-86a2-74d9b452b643/display"
              createdAt: '2024-09-24T10:02:02.4476765+00:00'
              pages:
                displayHrefTemplate: "/cleemy-procurement/api/files/a6dcc9e5-d251-4d3a-86a2-74d9b452b643/display/pages/{pageNumber}"
                count: 1
          comment: |-
            Renewal of our AWS S3 subscription.
          paymentMethod: SingleUseCard
          state: Provisioned
          startDate: '2024-09-24'
          firstInvoiceDate: '2024-09-24'
          invoicingFrequency:
            value: 12
            unit: Month
          subscriptionDuration:
            value: 12
            unit: Month
          subscriptionEndDate: '2025-09-23'
          contractualEndDate: null
          periodsCount: 1
          amountIncludingTaxesPerPeriod:
            base:
              excludingTaxes:
                value: 3239.57
                currency: EUR
              taxes: []
              includingTaxes:
                value: 3239.57
                currency: EUR
            counter:
              excludingTaxes:
                value: 3239.57
                currency: EUR
              taxes: []
              includingTaxes:
                value: 3239.57
                currency: EUR
            rate: 1
          amountIncludingTaxes:
            base:
              excludingTaxes:
                value: 3239.57
                currency: EUR
              taxes: []
              includingTaxes:
                value: 3239.57
                currency: EUR
            counter:
              excludingTaxes:
                value: 3239.57
                currency: EUR
              taxes: []
              includingTaxes:
                value: 3239.57
                currency: EUR
            rate: 1
          createdAt: '2024-09-24T10:02:01.9244011+00:00'
          author:
            name: John Doe
            firstName: John
            lastName: Doe
            pictureHref: https://example.ilucca.net/directory/api/employees/416/picture
            id: 416
            href: https://example.ilucca.net/api/v3/users/416
          modifiedAt: '2024-09-24T13:52:40.3558953+00:00'
          modifier:
            name: Matt Bawss
            firstName: Matt
            lastName: Bawss
            pictureHref: https://example.ilucca.net/directory/api/employees/979/picture
            id: 979
            href: https://example.ilucca.net/api/v3/users/979
        createdAt: '2024-09-24T10:02:01.7596447+00:00'
        modifiedAt: '2024-10-30T10:57:03.4349936+00:00'
        author:
          name: John Doe
          firstName: John
          lastName: Doe
          pictureHref: https://example.ilucca.net/directory/api/employees/416/picture
          id: 416
          href: https://example.ilucca.net/api/v3/users/416
        modifier:
          name: Gérôme Durand
          firstName: Gérôme
          lastName: Durand
          pictureHref: https://example.ilucca.net/directory/api/employees/1383/picture
          id: 1383
          href: https://example.ilucca.net/api/v3/users/1383
        owner:
          name: John Doe
          firstName: John
          lastName: Doe
          pictureHref: https://example.ilucca.net/directory/api/employees/416/picture
          id: 416
          href: https://example.ilucca.net/api/v3/users/416
        nature:
          name: Abonnement SAAS
          id: 1
          href: "/cleemy-procurement/api/natures/1"
        costCenter:
          name: 406_Product Ops
          code: 406_Product Ops
          id: 41
          href: "/cleemy-procurement/api/costcenters/41"
        establishment:
          name: Lucca Marseille
          id: 13
          href: https://example.ilucca.net/organization/structure/api/establishments/13
        department:
          name: Product Department
          id: 57
          href: https://example.ilucca.net/organization/structure/api/departments/57
        supplier:
          id: 952
          type: Concrete
          href: "/cleemy-procurement/api/suppliers/952"
          name: Amazon
          territory:
            name: United States of America
            id: US
            href: https://example.ilucca.net/organization/structure/api/countries?code=US
          flag: Unflagged
        availableAmount:
          base:
            value: 0
            currency: EUR
          counter:
            value: 0
            currency: EUR
          rate: 1
        billedAmount:
          base:
            value: 3214.66
            currency: EUR
          counter:
            value: 3214.66
            currency: EUR
          rate: 1
        committedAmount:
          base:
            value: 3214.66
            currency: EUR
          counter:
            value: 3214.66
            currency: EUR
          rate: 1
        confirmedAmount:
          base:
            value: 3214.66
            currency: EUR
          counter:
            value: 3214.66
            currency: EUR
          rate: 1
        requestedAmount:
          base:
            value: 3214.66
            currency: EUR
          counter:
            value: 3214.66
            currency: EUR
          rate: 1
        aggregatedStates:
          creditNotes:
            expected: 0
            toReview: 0
            partial: 0
            confirmed: 0
            pendingRetraction: 0
            removed: 0
            bypassed: 0
          invoices:
            expected: 0
            toReview: 0
            pendingBreakdown: 0
            confirmed: 0
            litigation: 0
            discarded: 0
            removed: 0
            bypassed: 1
          invoicesPayments:
            toPay: 0
            underReview: 0
            emitting: 0
            paid: 1
            onHold: 0
          creditNotesPayments:
            available: 0
            consumed: 0
            unavailable: 0
        axisSections: []
        title: AWS S3
        state: Closed
    one-time-commitment.post:
      summary: POST commitment request example.
      description: POST commitment request example.
      value:
        costDate: "2025-04-14"
        invoiceDate: "2025-04-14"
        amountIncludingTaxes:
            excludingTaxes:
                value: 120
                currency: EUR
            taxes: [] 
        type: OneTimeCommitment
        attachmentIds: []
        state: Created
        comment: Comment
        paymentMethod: null
    subscription-commitment.post:
      summary: POST Subscription commitment request example.
      description: POST Subscription commitment request example.
      value:
        startDate: "2025-04-14"
        firstInvoiceDate: "2025-04-14"
        invoicingFrequency:
           value: 1
           unit: "Month"
        subscriptionDuration":
           value: 12
           unit: "Month"
        contractualObligation": null
        terminationNotice": null
        amountIncludingTaxesPerPeriod":
           excludingTaxes:
               value: 1000
               currency: "EUR"
           taxes: []
        type: "SubscriptionCommitment"
        attachmentIds: []
        state: "Created"
        comment: "Comment"
        paymentMethod: null
        createdAt: '2024-09-24T10:02:01.9244011+00:00'
        author:
          name: John Doe
          firstName: John
          lastName: Doe
          pictureHref: https://example.ilucca.net/directory/api/employees/416/picture
          id: 416
          href: https://example.ilucca.net/api/v3/users/416
        modifiedAt: '2024-09-24T13:52:40.3558953+00:00'
        modifier:
          name: Matt Bawss
          firstName: Matt
          lastName: Bawss
          pictureHref: https://example.ilucca.net/directory/api/employees/979/picture
          id: 979
          href: https://example.ilucca.net/api/v3/users/979        
    commitment.get:
      summary: GET commitment response example.
      description: GET commitment response example.
      value:
        id: 54635
        costDate: "2025-04-14"
        invoiceDate: "2025-04-14"
        amountIncludingTaxes:
            excludingTaxes:
                value: 120
                currency: EUR
            taxes: [] 
        type: OneTimeCommitment
        attachmentIds: []
        state: Created
        comment: Comment
        paymentMethod: null
        createdAt: '2024-09-24T10:02:01.9244011+00:00'
        author:
          name: John Doe
          firstName: John
          lastName: Doe
          pictureHref: https://example.ilucca.net/directory/api/employees/416/picture
          id: 416
          href: https://example.ilucca.net/api/v3/users/416
        modifiedAt: '2024-09-24T13:52:40.3558953+00:00'
        modifier:
          name: Matt Bawss
          firstName: Matt
          lastName: Bawss
          pictureHref: https://example.ilucca.net/directory/api/employees/979/picture
          id: 979
          href: https://example.ilucca.net/api/v3/users/979
    commitment-request.get:
      summary: GET commitment-request response example.
      description: GET commitment-request response example.
      value:
        id: 0
        owner:
          name: John Doe
          firstName: John
          lastName: Doe
          pictureHref: https://example.ilucca.net/directory/api/employees/416/picture
          id: 416
          href: https://example.ilucca.net/api/v3/users/416
        assignee:
          name: John Doe
          firstName: John
          lastName: Doe
          pictureHref: https://example.ilucca.net/directory/api/employees/416/picture
          id: 416
          href: https://example.ilucca.net/api/v3/users/416
        businessObject:
          id: 54635
          costDate: "2025-04-14"
          invoiceDate: "2025-04-14"
          amountIncludingTaxes:
              excludingTaxes:
                  value: 120
                  currency: EUR
              taxes: [] 
          type: OneTimeCommitment
          attachmentIds: []
          state: Created
          comment: Comment
          paymentMethod: null
          createdAt: '2024-09-24T10:02:01.9244011+00:00'
          author:
            name: John Doe
            firstName: John
            lastName: Doe
            pictureHref: https://example.ilucca.net/directory/api/employees/416/picture
            id: 416
            href: https://example.ilucca.net/api/v3/users/416
          modifiedAt: '2024-09-24T13:52:40.3558953+00:00'
          modifier:
            name: Matt Bawss
            firstName: Matt
            lastName: Bawss
            pictureHref: https://example.ilucca.net/directory/api/employees/979/picture
            id: 979
            href: https://example.ilucca.net/api/v3/users/979
        stepId: 1
        workflowId: "qsd5q1c2xv"
        templateId: 1
        state: "Pending"
        createdAt: "2025-07-01T13:27:11.485Z"
        modifiedAt: "2025-07-01T13:27:11.485Z"
        author:
          name: John Doe
          firstName: John
          lastName: Doe
          pictureHref: https://example.ilucca.net/directory/api/employees/416/picture
          id: 416
          href: https://example.ilucca.net/api/v3/users/416
        modifier:
          name: John Doe
          firstName: John
          lastName: Doe
          pictureHref: https://example.ilucca.net/directory/api/employees/416/picture
          id: 416
          href: https://example.ilucca.net/api/v3/users/416
    booked-documents.get:
      summary: GET booked-documents response example
      value:
        items:
          - id: 132
            type: Invoice
            purchase:
              name: Team building
              type: OneTime
              id: 283
              href: "/cleemy-procurement/api/purchases/283"
            expectedAmount:
              base:
                value: 250.00
                currency: EUR
              counter:
                value: 250.00
                currency: EUR
              rate: 1
            costAmount:
              base:
                value: 250.00
                currency: EUR
              counter:
                value: 250.00
                currency: EUR
              rate: 1
            documentDate: '2021-11-18'
            documentNumber: '669'
            amountIncludingTaxes:
              base:
                excludingTaxes:
                  value: 250.00
                  currency: EUR
                taxes:
                - rateTypeId: 1
                  value: 25
                  currency: EUR
                includingTaxes:
                  value: 275.00
                  currency: EUR
              counter:
                excludingTaxes:
                  value: 250.00
                  currency: EUR
                taxes:
                - rateTypeId: 1
                  value: 25
                  currency: EUR
                includingTaxes:
                  value: 275.03
                  currency: EUR
              rate: 1
            attachments:
              - id: 223
                file:
                  name: facture_6698734.pdf
                  displayHref: "/cleemy-procurement/api/files/f0208989-edd3-4d09-b0ec-f97b24caa49e/display"
                  id: f0208989-edd3-4d09-b0ec-f97b24caa49e
                  href: "/cleemy-procurement/api/files/f0208989-edd3-4d09-b0ec-f97b24caa49e"
                createdAt: '2021-11-19T11:02:17.7052636+00:00'
                pages:
                  displayHrefTemplate: "/cleemy-procurement/api/files/f0208989-edd3-4d09-b0ec-f97b24caa49e/display/pages/{pageNumber}"
                  count: 2
            dueDate: '2021-12-18'
            paymentDetails:
              paymentMethod: BankTransfer
            paymentDate: '2021-12-16'
            conformityState: Confirmed
            paymentState: Paid
            completion: Complete
            flag: Unflagged
            commentsCount: 0
            createdAt: '2021-11-19T11:02:17.8042102+00:00'
            author:
              name: Matt Bawss
              firstName: Matt
              lastName: Bawss
              pictureHref: https://example.ilucca.net/directory/api/employees/13/picture
              id: 13
              href: https://example.ilucca.net/api/v3/users/13
            modifiedAt: '2022-06-22T15:42:25.2392513+00:00'
            modifier:
              name: Matt Bawss
              firstName: Matt
              lastName: Bawss
              pictureHref: https://example.ilucca.net/directory/api/employees/13/picture
              id: 13
              href: https://example.ilucca.net/api/v3/users/13
        next: "!004rsiRZqz|Pw"
        prev: "~00AhtpyGpz|42"
        count: 24
  schemas:
    vat-rates:
      title: VAT rates
      description: VAT rates
      type: array
      items:
        type: object
        properties:
          id:
            type: integer
            format: int32
          percentage:
            type: number
            format: double
          rateType:
            type: object
            properties:
              id:
                type: integer
                format: int32
              name:
                type: [string, "null"]
              territoryId:
                type: [string, "null"]
              recoveryRules:
                type: array
                items:
                  type: [object, "null"]
                  properties:
                    costFamilyId:
                      type: integer
                      format: int32
                    coefficient:
                      type: integer
                      format: double
    problem:
      title: Problem-detail
      type: object
      properties:
        type:
          type: [string, "null"]
        title:
          type: [string, "null"]
        status:
          type: [integer, "null"]
        detail:
          type: [string, "null"]
        instance:
          type: [string, "null"]
    import-mode:
      title: Import Mode (enum)
      description: "AllOrNothing: all items are imported or none. SkipInvalidItems: items are imported if valid, skipped if not."
      type: string
      enum: [AllOrNothing, SkipInvalidItems]
    axis-section-reference:
      title: Reference to an axis-section
      description: "Reference to an axis-section."
      type: object
      required: [id]
      properties:
        id:
          type: integer
          format: int32
        href:
          type: string
          format: uri
          readOnly: true
          description: |-
            **Read-only.** Relative link to this resource.
        name:
          description: |-
            **Read-only.** Name of the axis-section.
          type: string
          readOnly: true
        code:
          description: |-
            **Read-only.** Code of the axis-section.
          type: string
          readOnly: true
        axisId:
          description: |-
            **Read-only.** ID of the axis to which the axis-section belongs.
          type: integer
          format: int32
          readOnly: true
    user-reference:
      title: Reference to a user
      description: "Reference to a user."
      type: object
      required: []
      properties:
        id:
          type: integer
          format: int32
        href:
          type: string
          format: uri
          readOnly: true
        name:
          type: string
          readOnly: true
        firstName:
          type: string
          readOnly: true
        lastName:
          type: string
          readOnly: true
        pictureHref:
          description: |-
            **Read-only.** URL to this user picture image file.
          type: [string, "null"]
          format: uri
          readOnly: true
    establishment-reference:
      title: Reference to an establishment
      description: "Reference to an establishment."
      type: object
      required: []
      properties:
        id:
          type: integer
          format: int32
        name:
          type: string
          readOnly: true
        href:
          type: string
          format: uri
          readOnly: true
    cost-center-reference:
      title: Reference to a cost-center
      description: "Reference to a cost-center."
      type: object
      required: []
      properties:
        id:
          type: integer
          format: int32
        name:
          description: |-
            **Read-only.** Name of the cost-center.
          type: string
          readOnly: true
        code:
          description: |-
            **Read-only.** Code of the cost-center.
          type: string
          readOnly: true
        href:
          type: string
          readOnly: true
    cost-center-state:
      title: Cost-Center State (enum)
      description: "Disabled: the cost-center is disabled. Enabled: the cost-center is enabled."
      type: string
      enum: [Disabled, Enabled]
      default: Disabled
    cost-center:
      title: cost-center
      description: "Cost-center."
      type: object
      required: [name, code]
      properties:
        id:
          type: integer
          format: int32
          readOnly: true
        name:
          type: string
        code:
          type: string
        ownerId:
          description: "ID of the user who will be the owner of the cost-center."
          type: integer
          format: int32
          writeOnly: true
        owner:
          allOf:
            - $ref: "#/components/schemas/user-reference"
            - readOnly: true
              description: |-
                **Read-only.** Owner of the cost-center.
        state:
          $ref: "#/components/schemas/cost-center-state"
        establishmentIds:
          description: |-
            **Write-only.** IDs of the establishments to which the cost-center belongs."
          writeOnly: true
          type: array
          items:
            type: integer
            format: int32
        establishments:
          description: |-
            **Read-only.** Establishments to which the cost-center belongs.
          readOnly: true
          type: array
          items:
            $ref: "#/components/schemas/establishment-reference"
    department-reference:
      title: Reference to a department
      description: "Reference to a department."
      type: object
      required: []
      properties:
        id:
          type: integer
          format: int32
        name:
          type: string
          readOnly: true
        href:
          type: string
          format: uri
          readOnly: true
    territory-reference:
      title: Reference to a territory
      description: "Reference to a territory."
      type: object
      required: []
      properties:
        id:
          type: integer
          format: int32
        name:
          type: string
          readOnly: true
        href:
          type: string
          format: uri
          readOnly: true
    time-unit:
      title: Unit of Time (enum)
      description: "Day: day. Week: week. Month: month. Year: year."
      type: string
      enum: [Day, Week, Month, Year]
    currency:
      title: currency
      description: ISO-4217 currency code.
      type: string
      minLength: 3
      enum: [
        Invalid, ALL, DZD, ARS, AUD, BSD, BHD, BDT, AMD,
        BBD, BMD, BTN, BOB, BWP, BZD, SBD, BND, MMK, BIF,
        KHR, CAD, CVE, KYD, LKR, CLP, CNY, COP, KMF, CRC,
        HRK, CUP, CZK, DKK, DOP, SVC, ETB, ERN, FKP, FJD,
        DJF, GMD, GIP, GTQ, GNF, GYD, HTG, HNL, HKD, HUF,
        ISK, INR, IDR, IRR, IQD, ILS, JMD, JPY, KZT, JOD,
        KES, KPW, KRW, KWD, KGS, LAK, LBP, LSL, LVL, LRD,
        LYD, LTL, MOP, MWK, MYR, MVR, MRO, MUR, MXN, MNT,
        MDL, MAD, OMR, NAD, NPR, ANG, AWG, VUV, NZD, NIO,
        NGN, NOK, PKR, PAB, PGK, PYG, PEN, PHP, QAR, RUB,
        RWF, SHP, STD, SAR, SCR, SLL, SGD, VND, SOS, ZAR,
        SSP, SZL, SEK, CHF, SYP, THB, TOP, TTD, AED, TND,
        UGX, MKD, EGP, GBP, TZS, USD, UYU, UZS, WST, YER,
        ZMK, TWD, UYW, VES, MRU, STN, CUC, ZWL, BYN, TMT,
        GHS, VEF, SDG, UYI, RSD, MZN, AZN, RON, CHE, CHW,
        TRY, XAF, XCD, XOF, XPF, XBA, XBB, XBC, XBD, XAU,
        XDR, XAG, XPT, XTS, XPD, XUA, ZMW, SRD, MGA, COU,
        AFN, TJS, AOA, BYR, BGN, CDF, BAM, EUR, MXV, UAH,
        GEL, BOV, PLN, BRL, CLF, XSU, USN, XXX
      ]
    amount:
      title: amount
      description: Represents an amount of money.
      type: object
      properties:
        value:
          type: number
          format: double
        currency:
          $ref: '#/components/schemas/currency'
    taxed-amount:
      title: taxed-amount
      description: Represents an amount of money with VAT taxes.
      type: object
      properties:
        excludingTaxes:
          $ref: '#/components/schemas/amount'
        taxes:
          type: array
          items:
            type: object
            required: []
            properties:
              rateTypeId:
                type: integer
                format: int32
              value:
                type: number
                format: double
              currency:
                $ref: '#/components/schemas/currency'
        includingTaxes:
          $ref: '#/components/schemas/amount'
    dual-currency-taxed-amount:
      title: Dual currency taxed amount
      description: Represents an amount of money with VAT taxes in two different currencies.
      type: object
      properties:
        base:
          $ref: '#/components/schemas/taxed-amount'
        counter:
          $ref: '#/components/schemas/taxed-amount'
        rate:
          type: number
          format: double
    dual-currency-amount:
      title: dual-currency-amount
      description: Represents an amount of money in two different currencies.
      type: object
      properties:
        base:
          $ref: '#/components/schemas/amount'
        counter:
          $ref: '#/components/schemas/amount'
        rate:
          type: number
          format: double
    payment-method:
      title: Method of Payment (enum)
      description: "BankTransfer: bank transfer. PhysicalCard: physical card. Check: check. DirectDebit: direct debit. SingleUseCard: single use card."
      type: string
      enum: [BankTransfer, PhysicalCard, Check, DirectDebit, SingleUseCard]
    file:
      title: file
      description: Reference to a file.
      type: object
      required: []
      properties:
        id:
          type: string
          format: uuid
        href:
          type: string
        name:
          type: string
        displayHref:
          type: string
    attachment:
      title: attachment
      description: File attached to this object.
      type: object
      required: []
      properties:
        id:
          type: integer
          format: int32
        file:
          $ref: '#/components/schemas/file'
        createdAt:
          type: string
          format: date-time
        pages:
          type: object
          properties:
            displayHrefTemplate:
              type: string
            count:
              type: integer
              format: int32
    purchase-reference:
      title: Reference to a purchase
      description: "Reference to a purchase."
      type: object
      required: []
      properties:
        id:
          type: integer
          format: int32
        href:
          type: string
          readOnly: true
        name:
          type: string
          readOnly: true
        type:
          allOf:
            - $ref: '#/components/schemas/purchase-type'
            - readOnly: true
              description: |-
                **Read-only.** Type of the purchase.
    commitment-state:
      title: State of Commitment (enum)
      description: "Created: the commitment is created. UnderReview: the commitment's approval is pending'. Provisioned: the commitment is approved. Denied: the commitment is denied. Cancelled: the commitment is cancelled."
      type: string
      enum: [Created, UnderReview, Provisioned, Denied, Cancelled]
    subscription-commitment:
      title: Subscription Commitment
      description: "Commitment for a subscription."
      type: object
      required: []
      properties:
        id:
          description: "ID of the commitment."
          type: integer
          format: int32
          readOnly: true
        type:
          description: "Type of the commitment."
          type: string
          const: SubscriptionCommitment
        owner:
          description: "Owner of the commitment."
          allOf:
            - $ref: '#/components/schemas/user-reference'
            - description: "User ID who is the owner of the commitment."
        purchase:
          description: "Purchase of the commitment."
          allOf:
            - $ref: '#/components/schemas/purchase-reference'
            - description: "Purchase of the subscription commitment."
              readOnly: true
        attachments:
          description: "Attachments of the commitment."
          type: array
          minItems: 1
          maxItems: 3
          items:
            $ref: '#/components/schemas/attachment'
        comment:
          description: "Comment of the commitment."
          type: [string, "null"]
        paymentMethod:
          description: "Method of payment of the commitment."
          anyOf:
            - $ref: "#/components/schemas/payment-method"
            - type: "null"
        state:
          description: "State of the commitment."
          $ref: "#/components/schemas/commitment-state"
        startDate:
          description: "Start date of the subscription."
          type: string
          format: date
        firstInvoiceDate:
          description: "Date of the first invoice."
          type: string
          format: date
        invoicingFrequency:
          description: "Invoicing frequency of the subscription."
          type: object
          required: []
          properties:
            value:
              type: integer
              format: int32
            unit:
              $ref: "#/components/schemas/time-unit"
        subscriptionDuration:
          description: "Duration of the subscription."
          type: object
          required: []
          properties:
            value:
              type: integer
              format: int32
            unit:
              $ref: "#/components/schemas/time-unit"
        contractualObligation:
          description: "Contractual obligation of the subscription."
          type: object
          required: []
          properties:
            value:
              type: integer
              format: int32
            unit:
              $ref: "#/components/schemas/time-unit"
        terminationNotice:
          description: "Termination notice of the subscription."
          type: object
          required: []
          properties:
            value:
              type: integer
              format: int32
            unit:
              $ref: "#/components/schemas/time-unit"
        amountIncludingTaxesPerPeriod:
          allOf:
            - $ref: "#/components/schemas/dual-currency-taxed-amount"
            - description: "Amount including taxes per period."
        amountIncludingTaxes:
          allOf:
            - $ref: "#/components/schemas/dual-currency-taxed-amount"
            - description: "Amount including taxes."
        subscriptionEndDate:
          description: "End date of the subscription."
          type: string
          format: date
        periodsCount:
          description: "Number of periods."
          type: integer
          format: int32
        contractualEndDate:
          description: "End date of the contractual obligation."
          type: [string, "null"]
          format: date
        createdAt:
          description: "Date of creation of the commitment. Read-only."
          type: string
          format: date-time
          readOnly: true
        author:
          allOf:
            - $ref: '#/components/schemas/user-reference'
            - description: |-
                **Read-only.** User ID who is the author of the commitment.
              readOnly: true
        modifiedAt:
          description: |-
            **Read-only.** Date of last modification of the commitment.
          type: string
          format: date-time
          readOnly: true
        modifier:
          allOf:
            - $ref: '#/components/schemas/user-reference'
            - description: |-
                **Read-only.** User ID who is the modifier of the commitment.
              readOnly: true
    commitment:
      title: commitment
      description: |-
        Represents a purchase commitment. Can be one of two types: `Subscription` or `OneTime`.

        A "subscription" typed commitment represents a purchase commitment that will be paid in installments over a given period, whereas a "one-time" commitment will be paid in full once.
      anyOf:
        - $ref: "#/components/schemas/subscription-commitment"
        - $ref: "#/components/schemas/one-time-commitment"
      discriminator:
        propertyName: type
    one-time-commitment:
      title: One-Time Commitment
      description: "Commitment for a one-time purchase."
      type: object
      required: []
      properties:
        id:
          type: integer
          format: int32
          readOnly: true
        type:
          type: string
          const: OneTimeCommitment
        purchase:
          allOf:
            - $ref: '#/components/schemas/purchase-reference'
            - description: "Purchase of the one-time commitment."
              readOnly: true
        owner:
          allOf:
            - $ref: '#/components/schemas/user-reference'
            - readOnly: true
        attachmentIds:
          writeOnly: true
          type: array
          items:
            type: integer
        attachments:
          readOnly: true
          type: array
          minItems: 1
          maxItems: 3
          items:
            $ref: '#/components/schemas/attachment'
        comment:
          type: [string, "null"]
        paymentMethod:
          anyOf:
            - $ref: "#/components/schemas/payment-method"
            - type: "null"
        state:
          $ref: "#/components/schemas/commitment-state"
        amountIncludingTaxes:
          $ref: '#/components/schemas/dual-currency-taxed-amount'
        costDate:
          type: string
          format: date
        invoiceDate:
          type: string
          format: date
        createdAt:
          type: string
          format: date-time
          readOnly: true
        author:
          allOf:
            - $ref: '#/components/schemas/user-reference'
            - readOnly: true
        modifiedAt:
          type: string
          format: date-time
          readOnly: true
        modifier:
          allOf:
            - $ref: '#/components/schemas/user-reference'
            - readOnly: true
    draft-supplier:
      title: Supplier (Draft)
      description: Draft supplier.
      type: object
      required: [name, territoryId]
      properties:
        type:
          type: string
          const: Draft
          default: Draft
          readOnly: true
        name:
          type: string
        territoryId:
          description: "ID of the territory to which the supplier belongs."
          type: string
          writeOnly: true
        territory:
          allOf:
            - $ref: '#/components/schemas/territory-reference'
            - readOnly: true
              description: |-
                **Read-only.** Territory to which the supplier belongs.
    concrete-supplier:
      title: Supplier (Concrete)
      description: Non-draft supplier.
      type: object
      required: [id]
      properties:
        id:
          type: integer
          format: int32
        type:
          type: string
          const: Concrete
          readOnly: true
        href:
          type: string
          readOnly: true
        name:
          type: string
          readOnly: true
        flag:
          type: string
          enum: [Unflagged, Flagged]
          readOnly: true
    purchase-type:
      title: purchase-type
      description: Type of purchase.
      type: string
      enum: [Subscription, OneTime]
    purchase:
      title: Purchase
      description: "Purchase."
      type: object
      required: []
      properties:
        id:
          type: integer
          format: int32
          readOnly: true
        type:
          allOf:
            - $ref: '#/components/schemas/purchase-type'
            - readOnly: true
        title:
          description: "Title of the purchase."
          type: string
        state:
          type: string
          enum: [Created, Processing, Ongoing, Denied, Closed, Cancelled]
          readOnly: true
        commitment:
          allOf:
            - $ref: "#/components/schemas/commitment"
            - description: |-
                **Read-only.** Commitment of the purchase.
                readOnly: true
        ownerId:
          description: "ID of the user who is the owner of the purchase."
          type: integer
          format: int32
          writeOnly: true
        owner:
          allOf:
            - $ref: '#/components/schemas/user-reference'
            - readOnly: true
              description: "Owner of the purchase."
        natureId:
          description: "ID of the nature to which the purchase belongs."
          type: integer
          format: int32
          writeOnly: true
        nature:
          description: "Nature of the purchase."
          type: object
          readOnly: true
          required: []
          properties:
            id:
              type: integer
              format: int32
            name:
              type: string
              readOnly: true
            href:
              type: string
              readOnly: true
        costCenterId:
          description: "ID of the cost-center to which the purchase belongs."
          type: integer
          format: int32
          writeOnly: true
        costCenter:
          allOf:
            - $ref: '#/components/schemas/cost-center-reference'
            - readOnly: true
              description: |-
                **Read-only.** Cost-center to which the purchase belongs.
        establishmentId:
          description: "ID of the establishment to which the purchase belongs."
          type: integer
          format: int32
          writeOnly: true
        establishment:
          allOf:
            - $ref: '#/components/schemas/establishment-reference'
            - readOnly: true
              description: |-
                **Read-only.** Establishment to which the purchase belongs.
        departmentId:
          description: "ID of the department to which the purchase belongs."
          type: integer
          format: int32
          writeOnly: true
        department:
          allOf:
            - $ref: '#/components/schemas/department-reference'
            - readOnly: true
              description: |-
                **Read-only.** Department to which the purchase belongs.
        supplier:
          description: "Supplier of the purchase."
          anyOf:
            - $ref: '#/components/schemas/draft-supplier'
            - $ref: '#/components/schemas/concrete-supplier'
          discriminator:
            propertyName: type
            mapping:
              Draft: '#/components/schemas/draft-supplier'
              Concrete: '#/components/schemas/concrete-supplier'
        availableAmount:
          allOf:
            - $ref: '#/components/schemas/dual-currency-amount'
            - readOnly: true
              description: |-
                **Read-only.** Available amount of the purchase.
        billedAmount:
          allOf:
            - $ref: '#/components/schemas/dual-currency-amount'
            - readOnly: true
              description: |-
                **Read-only.** Billed amount of the purchase.
        committedAmount:
          allOf:
            - $ref: '#/components/schemas/dual-currency-amount'
            - readOnly: true
              description: |-
                **Read-only.** Committed amount of the purchase.
        confirmedAmount:
          allOf:
            - $ref: '#/components/schemas/dual-currency-amount'
            - readOnly: true
              description: |-
                **Read-only.** Confirmed amount of the purchase.
        requestedAmount:
          allOf:
            - $ref: '#/components/schemas/dual-currency-amount'
            - readOnly: true
              description: |-
                **Read-only.** Requested amount of the purchase.
        aggregatedStates:
          description: |-
            **Read-only.** Aggregated states of the purchase.
          readOnly: true
          type: object
          properties:
            creditNotes:
              description: "Aggregated states of the credit notes of the purchase."
              type: object
              required: []
              properties:
                expected:
                  description: "Number of expected credit notes."
                  type: integer
                  format: int32
                toReview:
                  description: "Number of credit notes to review."
                  type: integer
                  format: int32
                partial:
                  description: "Number of partial credit notes."
                  type: integer
                  format: int32
                confirmed:
                  description: "Number of confirmed credit notes."
                  type: integer
                  format: int32
                pendingRetraction:
                  description: "Number of pending retraction credit notes."
                  type: integer
                  format: int32
                removed:
                  description: "Number of removed credit notes."
                  type: integer
                  format: int32
                bypassed:
                  description: "Number of bypassed credit notes."
                  type: integer
                  format: int32
            invoices:
              description: |-
                **Read-only.** Aggregated states of the invoices of the purchase.
              readOnly: true
              type: object
              required: []
              properties:
                expected:
                  description: "Number of expected invoices."
                  type: integer
                  format: int32
                toReview:
                  description: "Number of invoices to review."
                  type: integer
                  format: int32
                pendingBreakdown:
                  description: "Number of invoices pending breakdown."
                  type: integer
                  format: int32
                confirmed:
                  description: "Number of confirmed invoices."
                  type: integer
                  format: int32
                litigation:
                  description: "Number of invoices in litigation."
                  type: integer
                  format: int32
                discarded:
                  description: "Number of discarded invoices."
                  type: integer
                  format: int32
                removed:
                  description: "Number of removed invoices."
                  type: integer
                  format: int32
                bypassed:
                  description: "Number of bypassed invoices."
                  type: integer
                  format: int32
            invoicesPayments:
              description: |-
                **Read-only.** Aggregated states of the invoices payments of the purchase.
              type: object
              readOnly: true
              required: []
              properties:
                toPay:
                  description: "Number of invoices to pay."
                  type: integer
                  format: int32
                underReview:
                  description: "Number of invoices under review."
                  type: integer
                  format: int32
                emitting:
                  description: "Number of invoices emitting."
                  type: integer
                  format: int32
                paid:
                  description: "Number of paid invoices."
                  type: integer
                  format: int32
                onHold:
                  description: "Number of invoices on hold."
                  type: integer
                  format: int32
            creditNotesPayments:
              description: |-
                **Read-only.** Aggregated states of the credit notes payments of the purchase.
              type: object
              required: []
              properties:
                available:
                  description: "Number of available credit notes payments."
                  type: integer
                  format: int32
                consumed:
                  description: "Number of consumed credit notes payments."
                  type: integer
                  format: int32
                unavailable:
                  description: "Number of unavailable credit notes payments."
                  type: integer
                  format: int32
        axisSectionIds:
          description: |-
            **Write-only.** IDs of the axis-sections to which the purchase belongs.
          type: array
          items:
            type: integer
            format: int32
          writeOnly: true
        axisSections:
          description: |-
            **Read-only.** Axis-sections to which the purchase belongs.
          type: array
          readOnly: true
          items:
            $ref: '#/components/schemas/axis-section-reference'
        createdAt:
          description: |-
            **Read-only.** Date of creation of the purchase
          type: string
          format: date-time
          readOnly: true
        author:
          description: |-
            **Read-only.** User ID who is the author of the purchase.
          allOf:
            - $ref: '#/components/schemas/user-reference'
            - readOnly: true
        modifiedAt:
          description: |-
            **Read-only.** Date of last modification of the purchase.
          type: string
          format: date-time
          readOnly: true
        modifier:
          description: |-
            **Read-only.** User ID who is the modifier of the purchase.
          allOf:
            - $ref: '#/components/schemas/user-reference'
            - readOnly: true
    commitment-request:
      title: commitment-request
      description: Approval request (workflow) for a purchase commitment.
      type: object
      required: []
      properties:
        id:
          type: integer
          format: int32
        owner:
          allOf:
            - $ref: "#/components/schemas/user-reference"
            - readOnly:  true
        assignee:
          allOf:
            - $ref: "#/components/schemas/user-reference"
            - readOnly:  true
        businessObject:
          allOf:
            - $ref: '#/components/schemas/commitment'
            - readOnly: true
        stepId:
          type: integer
          format: int32
          readOnly: true
        workflowId:
          type: string
          readOnly: true
        templateId:
          type: integer
          format: int32
          readOnly: true
        state:
          type: string
          enum: [Pending, Cancelled, Denied, Approved]
          readOnly: true
        createdAt:
          type: string
          format: date-time
          readOnly: true
        modifiedAt:
          type: string
          format: date-time
          readOnly: true
        author:
          allOf:
            - $ref: "#/components/schemas/user-reference"
            - readOnly: true
        modifier:
          allOf:
            - $ref: "#/components/schemas/user-reference"
            - readOnly: true
    invoice-conformity-state:
      type: string
      enum: [ToReview, PendingBreakdown, Confirmed, Litigation, Discarded, Removed, Bypassed]
    invoice-payment-state:
      type: string
      enum: [None, ToPay, UnderReview, Emitting, Paid, OnHold, Rejected, Cancelled]
    credit-note-conformity-state:
      title: credit-note-confirmity-state
      type: string
      enum: [ToReview, Partial, Confirmed, Removed, Bypassed]
    credit-note-payment-state:
      type: string
      enum: [Available, Consumed, Unavailable]
    document-breakdown-reference:
      title: Reference to a document-breakdown.
      type: object
      required: []
      properties:
        id:
          type: integer
          format: int32
          minimum: 1
        href:
          type: string
        name:
          type: string
    booked-document-context:
      title: Booked document context
      type: object
      required: []
      properties:
        purchase:
          $ref: "#/components/schemas/purchase-reference"
        expectedDocumentId:
          type: integer
          format: int3
          minimum: 1
        originalAmount:
          $ref: "#/components/schemas/amount"
        data:
          type: [object, "null"]
    invoice:
      title: invoice
      type: object
      required: []
      properties:
        id:
          type: integer
          format: int32
          readOnly: true
        type:
          type: string
          const: Invoice
          readOnly: true
        purchase:
          $ref: "#/components/schemas/purchase-reference"
        expectedAmount:
          $ref: "#/components/schemas/dual-currency-amount"
        costAmount:
          $ref: "#/components/schemas/dual-currency-amount"
        context:
          $ref: "#/components/schemas/booked-document-context"
        documentDate:
          type: string
          format: date
        documentNumber:
          type: string
        amountIncludingTaxes:
          $ref: "#/components/schemas/dual-currency-taxed-amount"
        documentBreakdown:
          $ref: "#/components/schemas/document-breakdown-reference"
        attachments:
          type: array
          minItems: 1
          maxItems: 3
          items:
            $ref: "#/components/schemas/attachment"
        dueDate:
          type: string
          format: date
        paymentDetails:
          type: object
          properties:
            paymentMethod:
              $ref: "#/components/schemas/payment-method"
            bankAccount:
              type: object
              properties:
                iban:
                  type: string
                bic:
                  type: string
        conformityState:
          $ref: "#/components/schemas/invoice-conformity-state"
        paymentState:
          $ref: "#/components/schemas/invoice-payment-state"
        paymentDate:
          type: [string, 'null']
          format: date
        completion:
          type: string
          enum: [ToReview, Partial, Disputed, Complete]
        flag:
          type: string
          enum: [Unflagged, Flagged]
        accountingLabel:
          type: [string, "null"]
        comment:
          type: [string, "null"]
        commentsCount:
          type: integer
          format: int32
          minimum: 0
        createdAt:
          type: string
          format: date-time
          readOnly: true
        author:
          allOf:
            - $ref: "#/components/schemas/user-reference"
            - readOnly: true
        modifiedAt:
          type: string
          format: date-time
          readOnly: true
        modifier:
          allOf:
            - $ref: "#/components/schemas/user-reference"
            - readOnly: true
    credit-note:
      title: credit-note
      type: object
      required: []
      properties:
        id:
          type: integer
          format: int32
          readOnly: true
        type:
          type: string
          const: CreditNote
          readOnly: true
        purchase:
          $ref: "#/components/schemas/purchase-reference"
        expectedAmount:
          $ref: "#/components/schemas/dual-currency-amount"
        costAmount:
          $ref: "#/components/schemas/dual-currency-amount"
        context:
          $ref: "#/components/schemas/booked-document-context"
        documentDate:
          type: string
          format: date
        documentNumber:
          type: string
        amountIncludingTaxes:
          $ref: "#/components/schemas/dual-currency-taxed-amount"
        documentBreakdown:
          $ref: "#/components/schemas/document-breakdown-reference"
        attachments:
          type: array
          minItems: 1
          maxItems: 3
          items:
            $ref: "#/components/schemas/attachment"
        conformityState:
          $ref: "#/components/schemas/credit-note-conformity-state"
        paymentState:
          $ref: "#/components/schemas/credit-note-payment-state"
        paymentDate:
          type: [string, 'null']
          format: date
        flag:
          type: string
          enum: [Unflagged, Flagged]
        accountingLabel:
          type: [string, "null"]
        comment:
          type: [string, "null"]
        commentsCount:
          type: integer
          format: int32
          minimum: 0
        createdAt:
          type: string
          format: date-time
          readOnly: true
        author:
          allOf:
            - $ref: "#/components/schemas/user-reference"
            - readOnly: true
        modifiedAt:
          type: string
          format: date-time
          readOnly: true
        modifier:
          allOf:
            - $ref: "#/components/schemas/user-reference"
            - readOnly: true
    booked-document:
      oneOf:
        - $ref: "#/components/schemas/credit-note"
        - $ref: "#/components/schemas/invoice"
      discriminator:
        propertyName: type
    supplier-state:
      title: Supplier State (enum)
      type: string
      enum: [Active, Archived]
    supplier:
      title: supplier
      description: A supplier.
      type: object
      properties:
        id:
          type: integer
          format: int32
          readOnly: true
        name:
          type: string
        state:
          $ref: "#/components/schemas/supplier-state"
        territory:
          allOf:
            - $ref: "#/components/schemas/territory-reference"
            - readOnly: true
              description: "**Read-only.** Territory of the supplier."
        territoryId:
          description: "**Write-only.** ID of the territory."
          type: string
          writeOnly: true
        legalRegistration:
          type: object
          properties:
            identifier:
              type: [string, "null"]
              description: Legal registration number (e.g. SIRET).
            vatNumber:
              type: [string, "null"]
              description: Intra-community VAT number.
        contacts:
          type: array
          items:
            type: object
            properties:
              firstName:
                type: [string, "null"]
              lastName:
                type: [string, "null"]
              email:
                type: [string, "null"]
                format: email
              phone:
                type: [string, "null"]
        paymentTerm:
          description: Default payment term for this supplier.
          type: [object, "null"]
          properties:
            value:
              type: integer
              format: int32
            unit:
              $ref: "#/components/schemas/time-unit"
        bankAccount:
          type: [object, "null"]
          properties:
            iban:
              type: [string, "null"]
            bic:
              type: [string, "null"]
        preferredNature:
          description: "**Read-only.** Preferred nature for this supplier."
          readOnly: true
          type: [object, "null"]
          properties:
            id:
              type: integer
              format: int32
            name:
              type: string
            href:
              type: string
        preferredNatureId:
          description: "**Write-only.** ID of the preferred nature."
          type: [integer, "null"]
          format: int32
          writeOnly: true
        preferredPaymentMethod:
          anyOf:
            - $ref: "#/components/schemas/payment-method"
            - type: "null"
        preferredCostCenter:
          description: "**Read-only.** Preferred cost-center for this supplier."
          readOnly: true
          allOf:
            - $ref: "#/components/schemas/cost-center-reference"
        preferredCostCenterId:
          description: "**Write-only.** ID of the preferred cost-center."
          type: [integer, "null"]
          format: int32
          writeOnly: true
        establishments:
          description: "**Read-only.** Establishments associated with this supplier."
          readOnly: true
          type: array
          items:
            $ref: "#/components/schemas/establishment-reference"
        flag:
          type: string
          enum: [Unflagged, Flagged]
          readOnly: true
    nature:
      title: nature
      description: A purchase nature (category).
      type: object
      properties:
        id:
          type: integer
          format: int32
          readOnly: true
        name:
          type: string
        costFamily:
          description: "**Read-only.** Cost family of this nature."
          readOnly: true
          type: [object, "null"]
          properties:
            id:
              type: integer
              format: int32
            name:
              type: string
        costFamilyId:
          description: "**Write-only.** ID of the cost family."
          type: [integer, "null"]
          format: int32
          writeOnly: true
        state:
          type: string
          enum: [Enabled, Disabled]
        accountingPlans:
          description: Accounting plans for this nature.
          type: array
          items:
            type: object
            properties:
              id:
                type: integer
                format: int32
              chargeAccount:
                type: [string, "null"]
    invoice-edition:
      title: Invoice Edition
      description: Editable fields of an invoice.
      type: object
      properties:
        dueDate:
          type: string
          format: date
        paymentDate:
          type: [string, "null"]
          format: date
        paymentDetails:
          type: [object, "null"]
          properties:
            paymentMethod:
              $ref: "#/components/schemas/payment-method"
            bankAccount:
              type: [object, "null"]
              properties:
                iban:
                  type: [string, "null"]
                bic:
                  type: [string, "null"]
        documentDate:
          type: string
          format: date
        documentNumber:
          type: string
        accountingLabel:
          type: [string, "null"]
        comment:
          type: [string, "null"]
        intraCommunityTaxes:
          type: boolean
    confirmation:
      title: confirmation
      description: A confirmation (approval) of a booked document (invoice or credit note).
      type: object
      properties:
        id:
          type: integer
          format: int32
          readOnly: true
        strategy:
          type: string
          readOnly: true
        createdAt:
          type: string
          format: date-time
          readOnly: true
        author:
          allOf:
            - $ref: "#/components/schemas/user-reference"
            - readOnly: true
    confirmation-creation:
      title: Confirmation Creation
      description: Body for creating a confirmation.
      type: object
      properties:
        strategy:
          type: string
          description: "Confirmation strategy to use. Retrieve available strategies via the confirmation-strategies endpoint."
    inbox-document:
      title: inbox-document
      description: A document in the inbox, pending processing.
      type: object
      properties:
        id:
          type: integer
          format: int32
          readOnly: true
        document:
          $ref: "#/components/schemas/document"
        source:
          description: Source of the document (e.g. email, upload).
          type: object
          properties:
            type:
              type: string
        action:
          description: Available action on this inbox document.
          type: [object, "null"]
        createdAt:
          type: string
          format: date-time
          readOnly: true
        modifiedAt:
          type: string
          format: date-time
          readOnly: true
        author:
          allOf:
            - $ref: "#/components/schemas/user-reference"
            - readOnly: true
        modifier:
          allOf:
            - $ref: "#/components/schemas/user-reference"
            - readOnly: true
    inbox-document-edition:
      title: inbox-document-edition
      description: Payload for updating an inbox document.
      type: object
      properties:
        document:
          type: object
          description: Document fields to update.
          properties:
            ownerId:
              type: integer
              format: int32
              description: ID of the owner user.
            type:
              description: "Type of document: Invoice or CreditNote."
              type: string
              enum: [Invoice, CreditNote]
            context:
              type: [object, "null"]
              description: Context data for the document.
              properties:
                purchase:
                  $ref: "#/components/schemas/purchase-reference"
            documentDate:
              type: [string, "null"]
              format: date
            documentNumber:
              type: [string, "null"]
            amountIncludingTaxes:
              $ref: "#/components/schemas/taxed-amount"
            accountingLabel:
              type: [string, "null"]
            comment:
              type: [string, "null"]
            intraCommunityTaxes:
              type: boolean
            dueDate:
              type: [string, "null"]
              format: date
            paymentDetails:
              type: [object, "null"]
              properties:
                paymentMethod:
                  $ref: "#/components/schemas/payment-method"
                bankAccount:
                  type: [object, "null"]
                  properties:
                    iban:
                      type: [string, "null"]
                    bic:
                      type: [string, "null"]
        action:
          description: Optional action to perform (attach or create a purchase).
          type: [object, "null"]
          oneOf:
            - title: AttachPurchase
              type: object
              properties:
                type:
                  type: string
                  enum: [AttachPurchase]
                purchaseId:
                  type: integer
                  format: int32
                paymentId:
                  type: [integer, "null"]
                  format: int32
                installmentId:
                  type: [integer, "null"]
                  format: int32
                disputeId:
                  type: [integer, "null"]
                  format: int32
                autoConfirmation:
                  type: boolean
            - title: CreatePurchase
              type: object
              properties:
                type:
                  type: string
                  enum: [CreatePurchase]
                title:
                  type: [string, "null"]
                ownerId:
                  type: integer
                  format: int32
                establishmentId:
                  type: [integer, "null"]
                  format: int32
                departmentId:
                  type: [integer, "null"]
                  format: int32
                natureId:
                  type: [integer, "null"]
                  format: int32
                costCenterId:
                  type: [integer, "null"]
                  format: int32
                paymentId:
                  type: [integer, "null"]
                  format: int32
                autoConfirmation:
                  type: boolean
    document:
      title: document
      description: An invoice document (before booking).
      type: object
      properties:
        id:
          type: integer
          format: int32
          readOnly: true
        owner:
          allOf:
            - $ref: "#/components/schemas/user-reference"
            - readOnly: true
        type:
          description: "Type of document: Invoice or CreditNote."
          type: string
          enum: [Invoice, CreditNote]
        context:
          type: [object, "null"]
          description: Context data for the document.
          properties:
            purchase:
              $ref: "#/components/schemas/purchase-reference"
        documentBreakdown:
          $ref: "#/components/schemas/document-breakdown-reference"
        documentDate:
          type: [string, "null"]
          format: date
        documentNumber:
          type: [string, "null"]
        amountIncludingTaxes:
          $ref: "#/components/schemas/taxed-amount"
        accountingLabel:
          type: [string, "null"]
        comment:
          type: [string, "null"]
        intraCommunityTaxes:
          type: boolean
        attachments:
          type: array
          items:
            $ref: "#/components/schemas/attachment"
        ocrStatus:
          description: "Status of OCR processing."
          type: string
          enum: [Pending, Processing, Processed, Failed, NotApplicable]
          readOnly: true
        dueDate:
          type: [string, "null"]
          format: date
        paymentDetails:
          type: [object, "null"]
          properties:
            paymentMethod:
              $ref: "#/components/schemas/payment-method"
            bankAccount:
              type: [object, "null"]
              properties:
                iban:
                  type: [string, "null"]
                bic:
                  type: [string, "null"]
        createdAt:
          type: string
          format: date-time
          readOnly: true
        modifiedAt:
          type: string
          format: date-time
          readOnly: true
        author:
          allOf:
            - $ref: "#/components/schemas/user-reference"
            - readOnly: true
        modifier:
          allOf:
            - $ref: "#/components/schemas/user-reference"
            - readOnly: true
  parameters:
    Authorization:
      name: Authorization
      required: true
      description: |-
        API key. Value must be formatted like so: `lucca application={api_key}`.
      in: header
      schema:
        type: string
    fields.root:
      name: fields.root
      description: Include root collection fields (paging).
      in: query
      style: form
      explode: false
      schema:
        type: array
        items:
          type: string
          enum: [prev, next, count]
    page:
      name: page
      in: query
      description: Page selection.
      schema:
        oneOf:
          - title: token
            description: Page tokens can be retrieved by adding ?fields.root=next,prev on your GET collections requests.
            type: string
          - title: index
            description: Index of the page.
            type: integer
            format: int32
            minimum: 0
    limit:
      name: limit
      in: query
      description: Page size.
      schema:
        type: integer
        minimum: 0
        maximum: 1000
