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

# Fetch invoice by provider ID

> This endpoint allows fetching an invoice by its provider ID (e.g. ERP processor id from invoice_sync).



## OpenAPI

````yaml /api-reference/openapi.yaml get /v1/invoices/by-provider-id/{providerId}
openapi: 3.1.0
info:
  title: API Reference
  version: '1.0'
  description: Aira API Reference
  x-logo:
    url: https://static.useaira.com/images/airalogo.svg
    backgroundColor: '#FFFFFF'
    altText: Aira Logo
servers:
  - url: https://api.useaira.com
    description: API base URL
security:
  - ApiKey: []
paths:
  /v1/invoices/by-provider-id/{providerId}:
    get:
      tags:
        - Invoices
      summary: Fetch invoice by provider ID
      description: >-
        This endpoint allows fetching an invoice by its provider ID (e.g. ERP
        processor id from invoice_sync).
      parameters:
        - schema:
            type: string
          in: path
          name: providerId
          required: true
      responses:
        '200':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  invoice:
                    type: object
                    properties:
                      id:
                        type: string
                        format: uuid
                      idempotencyKey:
                        type: string
                      customerId:
                        type: string
                        format: uuid
                      paymentAccountId:
                        type: string
                        format: uuid
                      contractId:
                        type: string
                        nullable: true
                        format: uuid
                      issuingAccount:
                        type: object
                        properties:
                          tradeName:
                            type: string
                            nullable: true
                          businessName:
                            type: string
                          emails:
                            type: array
                            items:
                              type: string
                              format: email
                          taxId:
                            type: string
                          taxIdType:
                            type: string
                            enum:
                              - cnpj
                              - cpf
                          zipCode:
                            type: string
                            nullable: true
                          street:
                            type: string
                            nullable: true
                          number:
                            type: string
                            nullable: true
                          neighborhood:
                            type: string
                            nullable: true
                          city:
                            type: string
                            nullable: true
                          state:
                            type: string
                            enum:
                              - AC
                              - AL
                              - AP
                              - AM
                              - BA
                              - CE
                              - DF
                              - ES
                              - GO
                              - MA
                              - MT
                              - MS
                              - MG
                              - PA
                              - PB
                              - PR
                              - PE
                              - PI
                              - RJ
                              - RN
                              - RS
                              - RO
                              - RR
                              - SC
                              - SP
                              - SE
                              - TO
                              - null
                            nullable: true
                          country:
                            type: string
                            enum:
                              - Brasil
                              - null
                            nullable: true
                          complement:
                            type: string
                            nullable: true
                        required:
                          - tradeName
                          - businessName
                          - emails
                          - taxId
                          - taxIdType
                          - zipCode
                          - street
                          - number
                          - neighborhood
                          - city
                          - state
                          - country
                          - complement
                        additionalProperties: false
                      billingAccount:
                        type: object
                        properties:
                          tradeName:
                            type: string
                            nullable: true
                          businessName:
                            type: string
                          emails:
                            type: array
                            items:
                              type: string
                              format: email
                          taxId:
                            type: string
                          taxIdType:
                            type: string
                            enum:
                              - cnpj
                              - cpf
                          zipCode:
                            type: string
                            nullable: true
                          street:
                            type: string
                            nullable: true
                          number:
                            type: string
                            nullable: true
                          neighborhood:
                            type: string
                            nullable: true
                          city:
                            type: string
                            nullable: true
                          state:
                            type: string
                            enum:
                              - AC
                              - AL
                              - AP
                              - AM
                              - BA
                              - CE
                              - DF
                              - ES
                              - GO
                              - MA
                              - MT
                              - MS
                              - MG
                              - PA
                              - PB
                              - PR
                              - PE
                              - PI
                              - RJ
                              - RN
                              - RS
                              - RO
                              - RR
                              - SC
                              - SP
                              - SE
                              - TO
                              - null
                            nullable: true
                          country:
                            type: string
                            enum:
                              - Brasil
                              - null
                            nullable: true
                          complement:
                            type: string
                            nullable: true
                        required:
                          - tradeName
                          - businessName
                          - emails
                          - taxId
                          - taxIdType
                          - zipCode
                          - street
                          - number
                          - neighborhood
                          - city
                          - state
                          - country
                          - complement
                        additionalProperties: false
                      invoiceAllocationStrategy:
                        type: string
                        enum:
                          - single
                          - percent_split
                      lastCalculatedAt:
                        type: string
                        format: date-time
                        nullable: true
                      invoiceNumber:
                        type: string
                      invoiceDate:
                        type: string
                        format: date
                      memo:
                        type: string
                        nullable: true
                      subtotalAmount:
                        type: number
                      adjustmentAmount:
                        type: number
                      totalAmount:
                        type: number
                      discountAmount:
                        type: number
                      status:
                        type: string
                        enum:
                          - open
                          - in_review
                          - issued
                          - synced
                          - pending
                          - paid
                          - overdue
                          - canceled
                          - failed
                      isLocked:
                        type: boolean
                      failureReason:
                        type: string
                        enum:
                          - erp_provider_not_supported
                          - omie_settings_not_found
                          - no_contract_found_in_omie_for_contract_number
                          - contract_sync_not_found
                          - contract_without_processor_id
                          - senior_contract_without_processor_id
                          - omie_mapping_basis_invalid
                          - unexpected_error_on_invoice_sync
                          - omie_service_mapping_not_found
                          - omie_service_mappings_not_found_on_omie
                          - omie_service_mapping_invalid
                          - invoice_not_found
                          - invoice_has_no_contract
                          - unknown
                          - payment_invoice_not_found
                          - invoice_account_not_found
                          - payment_account_not_found
                          - insufficient_payment_amount
                          - failed_to_upload_bank_slip
                          - payment_unknown
                          - null
                        nullable: true
                      source:
                        type: string
                        enum:
                          - contract
                          - one_off
                          - import
                      autoIssue:
                        type: boolean
                      amountDue:
                        type: number
                        nullable: true
                      dueDate:
                        type: string
                        format: date
                        nullable: true
                      lineItemGroups:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: string
                              format: uuid
                            idempotencyKey:
                              type: string
                            customerId:
                              type: string
                              format: uuid
                            productId:
                              type: string
                              format: uuid
                            planId:
                              type: string
                              nullable: true
                              format: uuid
                            planInstanceId:
                              type: string
                              nullable: true
                              format: uuid
                            name:
                              type: string
                            startDate:
                              type: string
                              format: date
                            endDate:
                              type: string
                              format: date
                            subtotalAmount:
                              type: number
                            adjustmentAmount:
                              type: number
                            totalAmount:
                              type: number
                            discountAmount:
                              type: number
                            lineItems:
                              type: array
                              items:
                                type: object
                                properties:
                                  id:
                                    type: string
                                    format: uuid
                                  idempotencyKey:
                                    type: string
                                  customerId:
                                    type: string
                                    format: uuid
                                  productId:
                                    type: string
                                    format: uuid
                                  itemId:
                                    type: string
                                    nullable: true
                                    format: uuid
                                  resourceId:
                                    type: string
                                    nullable: true
                                    format: uuid
                                  lineItemGroupId:
                                    type: string
                                    nullable: true
                                    format: uuid
                                  name:
                                    type: string
                                  scope:
                                    type: string
                                    enum:
                                      - credit_purchase
                                      - contract_minimum_amount
                                      - plan_minimum_amount
                                      - plan_fixed_amount
                                      - metric
                                      - additional_charge
                                      - one_off
                                      - tax_gross_up
                                  startDate:
                                    type: string
                                    format: date
                                  endDate:
                                    type: string
                                    format: date
                                  totalUsage:
                                    type: number
                                    nullable: true
                                  usageFormat:
                                    type: string
                                    enum:
                                      - unit
                                      - currency
                                      - null
                                    nullable: true
                                  subtotalAmount:
                                    type: number
                                  adjustmentAmount:
                                    type: number
                                  totalAmount:
                                    type: number
                                  discountAmount:
                                    type: number
                                  metadata:
                                    anyOf:
                                      - type: object
                                        properties:
                                          type:
                                            type: string
                                            enum:
                                              - metric
                                          billingModel:
                                            type: string
                                            enum:
                                              - in_full
                                              - proration
                                          priceTierDivision:
                                            type: string
                                            enum:
                                              - unique_tier
                                              - progressive
                                        required:
                                          - type
                                          - billingModel
                                          - priceTierDivision
                                      - type: object
                                        properties:
                                          type:
                                            type: string
                                            enum:
                                              - contract_minimum_amount
                                          minimumAmount:
                                            type: number
                                          minimumAmountApplied:
                                            type: number
                                        required:
                                          - type
                                          - minimumAmount
                                          - minimumAmountApplied
                                      - type: object
                                        properties:
                                          type:
                                            type: string
                                            enum:
                                              - plan_minimum_amount
                                          minimumAmount:
                                            type: number
                                          minimumAmountApplied:
                                            type: number
                                        required:
                                          - type
                                          - minimumAmount
                                          - minimumAmountApplied
                                      - type: 'null'
                                  subLineItems:
                                    type: array
                                    items:
                                      type: object
                                      properties:
                                        id:
                                          type: string
                                          format: uuid
                                        type:
                                          type: string
                                          enum:
                                            - fixed_price
                                            - minimum_amount
                                            - price_tier_flat
                                            - price_tier_unit
                                            - price_tier_package
                                            - price_tier_basis_points
                                            - proration
                                            - unit_price
                                        name:
                                          type: string
                                        description:
                                          type: string
                                          nullable: true
                                        usage:
                                          type: number
                                          nullable: true
                                        amount:
                                          type: number
                                        metadata:
                                          anyOf:
                                            - type: object
                                              properties:
                                                type:
                                                  type: string
                                                  enum:
                                                    - fixed_price
                                                fixedPrice:
                                                  type: number
                                              required:
                                                - type
                                                - fixedPrice
                                            - type: object
                                              properties:
                                                type:
                                                  type: string
                                                  enum:
                                                    - minimum_amount
                                                minimumAmount:
                                                  type: number
                                                minimumAmountApplied:
                                                  type: number
                                              required:
                                                - type
                                                - minimumAmount
                                                - minimumAmountApplied
                                            - type: object
                                              properties:
                                                type:
                                                  type: string
                                                  enum:
                                                    - price_tier_flat
                                                from:
                                                  type: number
                                                to:
                                                  type: number
                                                  nullable: true
                                                fixedPrice:
                                                  type: string
                                              required:
                                                - type
                                                - from
                                                - to
                                                - fixedPrice
                                            - type: object
                                              properties:
                                                type:
                                                  type: string
                                                  enum:
                                                    - price_tier_unit
                                                from:
                                                  type: number
                                                to:
                                                  type: number
                                                  nullable: true
                                                price:
                                                  type: string
                                                fixedPrice:
                                                  type: string
                                                  nullable: true
                                              required:
                                                - type
                                                - from
                                                - to
                                                - price
                                                - fixedPrice
                                            - type: object
                                              properties:
                                                type:
                                                  type: string
                                                  enum:
                                                    - price_tier_package
                                                from:
                                                  type: number
                                                to:
                                                  type: number
                                                  nullable: true
                                                packageSize:
                                                  type: number
                                                price:
                                                  type: string
                                                fixedPrice:
                                                  type: string
                                                  nullable: true
                                              required:
                                                - type
                                                - from
                                                - to
                                                - packageSize
                                                - price
                                                - fixedPrice
                                            - type: object
                                              properties:
                                                type:
                                                  type: string
                                                  enum:
                                                    - price_tier_basis_points
                                                from:
                                                  type: number
                                                to:
                                                  type: number
                                                  nullable: true
                                                basisPoints:
                                                  type: number
                                                fixedPrice:
                                                  type: string
                                                  nullable: true
                                              required:
                                                - type
                                                - from
                                                - to
                                                - basisPoints
                                                - fixedPrice
                                            - type: object
                                              properties:
                                                type:
                                                  type: string
                                                  enum:
                                                    - proration
                                                intervalSize:
                                                  type: number
                                                amount:
                                                  type: string
                                                usage:
                                                  type: number
                                                intervalStart:
                                                  type: string
                                                  format: date
                                                intervalEnd:
                                                  type: string
                                                  format: date
                                              required:
                                                - type
                                                - intervalSize
                                                - amount
                                                - usage
                                                - intervalStart
                                                - intervalEnd
                                            - type: object
                                              properties:
                                                type:
                                                  type: string
                                                  enum:
                                                    - unit_price
                                                price:
                                                  type: string
                                              required:
                                                - type
                                                - price
                                      required:
                                        - id
                                        - type
                                        - name
                                        - description
                                        - usage
                                        - amount
                                        - metadata
                                      additionalProperties: false
                                  adjustments:
                                    type: array
                                    items:
                                      type: object
                                      properties:
                                        id:
                                          type: string
                                          format: uuid
                                        name:
                                          type: string
                                        type:
                                          type: string
                                          enum:
                                            - monetary_discount
                                            - allocation_offset
                                        amount:
                                          type: number
                                      required:
                                        - id
                                        - name
                                        - type
                                        - amount
                                      additionalProperties: false
                                required:
                                  - id
                                  - idempotencyKey
                                  - customerId
                                  - productId
                                  - resourceId
                                  - lineItemGroupId
                                  - name
                                  - scope
                                  - startDate
                                  - endDate
                                  - totalUsage
                                  - usageFormat
                                  - subtotalAmount
                                  - adjustmentAmount
                                  - totalAmount
                                  - discountAmount
                                  - metadata
                                  - subLineItems
                                  - adjustments
                                additionalProperties: false
                          required:
                            - id
                            - idempotencyKey
                            - customerId
                            - productId
                            - planId
                            - planInstanceId
                            - name
                            - startDate
                            - endDate
                            - subtotalAmount
                            - adjustmentAmount
                            - totalAmount
                            - discountAmount
                            - lineItems
                          additionalProperties: false
                      standaloneLineItems:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: string
                              format: uuid
                            idempotencyKey:
                              type: string
                            customerId:
                              type: string
                              format: uuid
                            productId:
                              type: string
                              format: uuid
                            itemId:
                              type: string
                              nullable: true
                              format: uuid
                            resourceId:
                              type: string
                              nullable: true
                              format: uuid
                            lineItemGroupId:
                              type: string
                              nullable: true
                              format: uuid
                            name:
                              type: string
                            scope:
                              type: string
                              enum:
                                - credit_purchase
                                - contract_minimum_amount
                                - plan_minimum_amount
                                - plan_fixed_amount
                                - metric
                                - additional_charge
                                - one_off
                                - tax_gross_up
                            startDate:
                              type: string
                              format: date
                            endDate:
                              type: string
                              format: date
                            totalUsage:
                              type: number
                              nullable: true
                            usageFormat:
                              type: string
                              enum:
                                - unit
                                - currency
                                - null
                              nullable: true
                            subtotalAmount:
                              type: number
                            adjustmentAmount:
                              type: number
                            totalAmount:
                              type: number
                            discountAmount:
                              type: number
                            metadata:
                              anyOf:
                                - type: object
                                  properties:
                                    type:
                                      type: string
                                      enum:
                                        - metric
                                    billingModel:
                                      type: string
                                      enum:
                                        - in_full
                                        - proration
                                    priceTierDivision:
                                      type: string
                                      enum:
                                        - unique_tier
                                        - progressive
                                  required:
                                    - type
                                    - billingModel
                                    - priceTierDivision
                                - type: object
                                  properties:
                                    type:
                                      type: string
                                      enum:
                                        - contract_minimum_amount
                                    minimumAmount:
                                      type: number
                                    minimumAmountApplied:
                                      type: number
                                  required:
                                    - type
                                    - minimumAmount
                                    - minimumAmountApplied
                                - type: object
                                  properties:
                                    type:
                                      type: string
                                      enum:
                                        - plan_minimum_amount
                                    minimumAmount:
                                      type: number
                                    minimumAmountApplied:
                                      type: number
                                  required:
                                    - type
                                    - minimumAmount
                                    - minimumAmountApplied
                                - type: 'null'
                            subLineItems:
                              type: array
                              items:
                                type: object
                                properties:
                                  id:
                                    type: string
                                    format: uuid
                                  type:
                                    type: string
                                    enum:
                                      - fixed_price
                                      - minimum_amount
                                      - price_tier_flat
                                      - price_tier_unit
                                      - price_tier_package
                                      - price_tier_basis_points
                                      - proration
                                      - unit_price
                                  name:
                                    type: string
                                  description:
                                    type: string
                                    nullable: true
                                  usage:
                                    type: number
                                    nullable: true
                                  amount:
                                    type: number
                                  metadata:
                                    anyOf:
                                      - type: object
                                        properties:
                                          type:
                                            type: string
                                            enum:
                                              - fixed_price
                                          fixedPrice:
                                            type: number
                                        required:
                                          - type
                                          - fixedPrice
                                      - type: object
                                        properties:
                                          type:
                                            type: string
                                            enum:
                                              - minimum_amount
                                          minimumAmount:
                                            type: number
                                          minimumAmountApplied:
                                            type: number
                                        required:
                                          - type
                                          - minimumAmount
                                          - minimumAmountApplied
                                      - type: object
                                        properties:
                                          type:
                                            type: string
                                            enum:
                                              - price_tier_flat
                                          from:
                                            type: number
                                          to:
                                            type: number
                                            nullable: true
                                          fixedPrice:
                                            type: string
                                        required:
                                          - type
                                          - from
                                          - to
                                          - fixedPrice
                                      - type: object
                                        properties:
                                          type:
                                            type: string
                                            enum:
                                              - price_tier_unit
                                          from:
                                            type: number
                                          to:
                                            type: number
                                            nullable: true
                                          price:
                                            type: string
                                          fixedPrice:
                                            type: string
                                            nullable: true
                                        required:
                                          - type
                                          - from
                                          - to
                                          - price
                                          - fixedPrice
                                      - type: object
                                        properties:
                                          type:
                                            type: string
                                            enum:
                                              - price_tier_package
                                          from:
                                            type: number
                                          to:
                                            type: number
                                            nullable: true
                                          packageSize:
                                            type: number
                                          price:
                                            type: string
                                          fixedPrice:
                                            type: string
                                            nullable: true
                                        required:
                                          - type
                                          - from
                                          - to
                                          - packageSize
                                          - price
                                          - fixedPrice
                                      - type: object
                                        properties:
                                          type:
                                            type: string
                                            enum:
                                              - price_tier_basis_points
                                          from:
                                            type: number
                                          to:
                                            type: number
                                            nullable: true
                                          basisPoints:
                                            type: number
                                          fixedPrice:
                                            type: string
                                            nullable: true
                                        required:
                                          - type
                                          - from
                                          - to
                                          - basisPoints
                                          - fixedPrice
                                      - type: object
                                        properties:
                                          type:
                                            type: string
                                            enum:
                                              - proration
                                          intervalSize:
                                            type: number
                                          amount:
                                            type: string
                                          usage:
                                            type: number
                                          intervalStart:
                                            type: string
                                            format: date
                                          intervalEnd:
                                            type: string
                                            format: date
                                        required:
                                          - type
                                          - intervalSize
                                          - amount
                                          - usage
                                          - intervalStart
                                          - intervalEnd
                                      - type: object
                                        properties:
                                          type:
                                            type: string
                                            enum:
                                              - unit_price
                                          price:
                                            type: string
                                        required:
                                          - type
                                          - price
                                required:
                                  - id
                                  - type
                                  - name
                                  - description
                                  - usage
                                  - amount
                                  - metadata
                                additionalProperties: false
                            adjustments:
                              type: array
                              items:
                                type: object
                                properties:
                                  id:
                                    type: string
                                    format: uuid
                                  name:
                                    type: string
                                  type:
                                    type: string
                                    enum:
                                      - monetary_discount
                                      - allocation_offset
                                  amount:
                                    type: number
                                required:
                                  - id
                                  - name
                                  - type
                                  - amount
                                additionalProperties: false
                          required:
                            - id
                            - idempotencyKey
                            - customerId
                            - productId
                            - resourceId
                            - lineItemGroupId
                            - name
                            - scope
                            - startDate
                            - endDate
                            - totalUsage
                            - usageFormat
                            - subtotalAmount
                            - adjustmentAmount
                            - totalAmount
                            - discountAmount
                            - metadata
                            - subLineItems
                            - adjustments
                          additionalProperties: false
                    required:
                      - id
                      - idempotencyKey
                      - customerId
                      - paymentAccountId
                      - contractId
                      - issuingAccount
                      - billingAccount
                      - invoiceAllocationStrategy
                      - lastCalculatedAt
                      - invoiceNumber
                      - invoiceDate
                      - memo
                      - subtotalAmount
                      - adjustmentAmount
                      - totalAmount
                      - discountAmount
                      - status
                      - isLocked
                      - failureReason
                      - source
                      - autoIssue
                      - amountDue
                      - dueDate
                      - lineItemGroups
                      - standaloneLineItems
                    additionalProperties: false
                  payments:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                        amount:
                          type: number
                        dueDate:
                          type: string
                          format: date
                          nullable: true
                        paymentMethod:
                          type: string
                          enum:
                            - bolepix
                            - bank_slip
                            - pix
                        status:
                          type: string
                          enum:
                            - created
                            - pending
                            - paid
                            - failed
                            - canceled
                            - expired
                      required:
                        - id
                        - amount
                        - dueDate
                        - paymentMethod
                        - status
                      additionalProperties: false
                  statusHistory:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          format: uuid
                        previousStatus:
                          type: string
                          enum:
                            - open
                            - in_review
                            - issued
                            - synced
                            - pending
                            - paid
                            - overdue
                            - canceled
                            - failed
                            - null
                          nullable: true
                        newStatus:
                          type: string
                          enum:
                            - open
                            - in_review
                            - issued
                            - synced
                            - pending
                            - paid
                            - overdue
                            - canceled
                            - failed
                        reason:
                          type: string
                          enum:
                            - invoice_created
                            - billing_cycle_closed
                            - billing_cycle_canceled
                            - invoice_auto_issued
                            - retroactive_invoice_issued
                            - manually_issued
                            - contract_canceled
                            - manually_canceled
                            - manually_paid
                            - contract_allocation_removed
                            - erp_sync_failed
                            - payment_initiated
                            - erp_sync_success
                            - payment_failed
                            - payment_paid
                            - due_date_passed
                            - invoice_reopened
                            - invoice_created_after_reopening
                            - manually_canceled_via_api
                            - manually_marked_as_in_review_via_api
                        occurredAt:
                          type: string
                          format: date-time
                        metadata:
                          type: object
                          nullable: true
                          additionalProperties: true
                      required:
                        - id
                        - previousStatus
                        - newStatus
                        - reason
                        - occurredAt
                        - metadata
                      additionalProperties: false
                  customer:
                    type: object
                    description: Schema representing a customer.
                    properties:
                      id:
                        description: The unique identifier of the customer in our system.
                        type: string
                        format: uuid
                      externalId:
                        description: >-
                          An optional external identifier of the customer from
                          the external system, used throughout the system to
                          identify the customer.
                        type: string
                        pattern: ^[a-zA-Z0-9_-]+$
                        example: 705faf65-9c8b-4053-8c0b-2021281ce83f
                      name:
                        description: The name of the customer.
                        type: string
                        example: Acme Inc.
                      invoicePrefix:
                        description: >-
                          The prefix of the customer's invoices. This is
                          generated by the system and cannot be updated.
                        type: string
                        example: ACMEI
                      type:
                        description: Customer type in organizations hierarchy.
                        type: string
                        enum:
                          - individual
                          - organization
                          - subsidiary
                        example: individual
                      parentCustomerId:
                        description: Parent customer ID when customer is a subsidiary.
                        type:
                          - 'null'
                          - string
                        format: uuid
                      archivedAt:
                        description: Archive timestamp for customers that were archived.
                        type:
                          - 'null'
                          - string
                        format: date-time
                      customFields:
                        type: object
                        description: >-
                          Custom fields that can be associated with the entity.
                          The fields must be previously created in the system
                          before they can be used.
                        additionalProperties:
                          anyOf:
                            - type: string
                            - type: array
                              items:
                                type: string
                        default: {}
                        example:
                          customField1: value1
                          customField2:
                            - value2
                            - value3
                    required:
                      - id
                      - externalId
                      - name
                      - type
                    additionalProperties: false
                  contract:
                    type: object
                    description: Schema representing a contract summary.
                    properties:
                      id:
                        description: The unique identifier of the contract in our system.
                        type: string
                        format: uuid
                      startDate:
                        description: The start date of the contract.
                        type: string
                        format: date
                      endDate:
                        description: >-
                          The end date of the contract. Null if the contract has
                          no end date.
                        type:
                          - 'null'
                          - string
                        format: date
                      status:
                        description: The current status of the contract.
                        type: string
                        enum:
                          - active
                          - canceled
                          - completed
                          - draft
                      customFields:
                        type: object
                        description: >-
                          Custom fields that can be associated with the entity.
                          The fields must be previously created in the system
                          before they can be used.
                        additionalProperties:
                          anyOf:
                            - type: string
                            - type: array
                              items:
                                type: string
                        default: {}
                        example:
                          customField1: value1
                          customField2:
                            - value2
                            - value3
                    required:
                      - id
                      - startDate
                      - endDate
                      - status
                    additionalProperties: false
                  artifacts:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                        artifactType:
                          type: string
                          pattern: '^(default|custom):'
                          description: Type in format default:* or custom:*
                        fileExtension:
                          type: string
                          enum:
                            - pdf
                            - csv
                            - xlsx
                            - xlsm
                            - xml
                            - zip
                        generatedAt:
                          type: string
                          format: date-time
                      required:
                        - id
                        - artifactType
                        - fileExtension
                        - generatedAt
                      additionalProperties: false
                required:
                  - invoice
                  - payments
                  - statusHistory
                  - customer
                  - contract
                  - artifacts
                additionalProperties: false
        '404':
          description: Error object returned to the client when a resource is not found.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: A human-readable description of the error
components:
  securitySchemes:
    ApiKey:
      type: apiKey
      description: API Key Authentication.
      name: X-API-KEY
      in: header

````