openapi: 3.0.1
info:
  title: B2Brouter API
  description: The B2Brouter API allows you to send and receive electronic documents.
  version: 1.0.0
  contact:
    name: Service Delivery Team
    email: servicedelivery@b2brouter.net
servers:
  - url: https://app-staging.b2brouter.net
    description: Test server
  - url: https://app.b2brouter.net
    description: Production server
tags:
  - name: Accounts
    description: Related to accounts
  - name: Bank Accounts
    description: Related to bank accounts
  - name: Code lists
    description: Related our defined code lists
  - name: Companies
    description: Related to companies
  - name: Contacts
    description: Related to contacts (clients and providers)
  - name: eAccounting
    description: Related to eAccounting
  - name: Events
    description: Related to events
  - name: Invoices
    description: Related to invoices
  - name: Ledgers
    description: Related to ledgers (sets of tax reports)
  - name: Lookup
    description: Related to lookup capacities of recipients
  - name: Orders
    description: Related to orders
  - name: Tax Reports
    description: Related tax reports
  - name: Tax Report Settings
    description: Related to tax report settings
  - name: Transports
    description: Related to transport configurations
  - name: Validation
    description: Related to validations
paths:
  /accounts:
    get:
      operationId: get-accounts
      tags:
        - Accounts
      summary: List accounts
      description: This endpoint list all accounts associated with the group.
      parameters:
        - $ref: '#/components/parameters/offset'
        - $ref: '#/components/parameters/limit'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  accounts:
                    type: array
                    items:
                      allOf:
                        - $ref: '#/components/schemas/Account'
                        - $ref: '#/components/schemas/TransactionsEdocsync'
                  total_count:
                    type: integer
                    example: 1
                  offset:
                    type: integer
                    example: 0
                  limit:
                    type: integer
                    example: 25
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '442':
          $ref: '#/components/responses/UnprocessableEntity'
      security:
        - api_key: []
    post:
      operationId: create-account
      tags:
        - Accounts
      summary: Create an account
      description: This endpoint creates a new account associated with the group.
      requestBody:
        description: The account object in format JSON to create
        content:
          application/json:
            schema:
              type: object
              required:
                - account
              properties:
                account:
                  allOf:
                    - $ref: '#/components/schemas/Account'
                    - $ref: '#/components/schemas/TransactionsEdocsync'
                    - required:
                        - name
                        - postalcode
                        - email
                        - address
                        - city
                        - province
                        - phone
                        - tin_value
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  account:
                    $ref: '#/components/schemas/Account'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '442':
          $ref: '#/components/responses/UnprocessableEntity'
      security:
        - api_key: []
  /accounts/{account}:
    get:
      operationId: get-account
      tags:
        - Accounts
      summary: Retrieve an account
      parameters:
        - $ref: '#/components/parameters/account'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  account:
                    allOf:
                      - $ref: '#/components/schemas/Account'
                      - $ref: '#/components/schemas/TransactionsEdocsync'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '442':
          $ref: '#/components/responses/UnprocessableEntity'
      security:
        - api_key: []
    put:
      operationId: put-account
      tags:
        - Accounts
      summary: Update an account
      description: |
        This endpoint updates an account associated with a group.
        Note*: The TIN can not be updated.
      parameters:
        - $ref: '#/components/parameters/account'
      requestBody:
        description: The account object in format JSON to update
        content:
          application/json:
            schema:
              type: object
              required:
                - account
              properties:
                account:
                  $ref: '#/components/schemas/Account'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  account:
                    allOf:
                      - $ref: '#/components/schemas/Account'
                      - $ref: '#/components/schemas/TransactionsEdocsync'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '442':
          $ref: '#/components/responses/UnprocessableEntity'
      security:
        - api_key: []
    delete:
      operationId: delete-account
      tags:
        - Accounts
      summary: Delete/archive an account
      description: This endpoint deletes an account associated with a group. If the account has associated documents, it will be archived.
      parameters:
        - $ref: '#/components/parameters/account'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  account:
                    properties:
                      id:
                        type: integer
                        example: 12345
                        description: ID of the account
                      deleted:
                        type: boolean
                        example: true
                        description: Indicates if the account was deleted
                      archived:
                        type: boolean
                        example: false
                        description: Indicates if the account was archived instead of deleted
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '442':
          $ref: '#/components/responses/UnprocessableEntity'
      security:
        - api_key: []
  /accounts/{account}/unarchive:
    post:
      operationId: unarchive-account
      tags:
        - Accounts
      summary: Unarchive an account
      description: This endpoint unachives an account associated with a group.
      parameters:
        - $ref: '#/components/parameters/account'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  account:
                    properties:
                      id:
                        type: integer
                        example: 12345
                        description: ID of the account
                      unarchived:
                        type: boolean
                        example: true
                        description: Indicates if the account was unarchived
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '442':
          $ref: '#/components/responses/UnprocessableEntity'
      security:
        - api_key: []
  /accounts/{account}/bank_accounts:
    get:
      operationId: get-bank-accounts
      tags:
        - Bank Accounts
      summary: List bank accounts
      description: Returns an array of the bank accounts of the account.
      parameters:
        - $ref: '#/components/parameters/account'
        - $ref: '#/components/parameters/offset'
        - $ref: '#/components/parameters/limit'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  bank_accounts:
                    type: array
                    items:
                      $ref: '#/components/schemas/BankAccount'
                  total_count:
                    type: integer
                    example: 1
                  offset:
                    type: integer
                    example: 0
                  limit:
                    type: integer
                    example: 10
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '442':
          $ref: '#/components/responses/UnprocessableEntity'
      security:
        - api_key: []
    post:
      operationId: create-bank-account
      tags:
        - Bank Accounts
      summary: Create a bank account
      description: Creates a new bank account.
      parameters:
        - $ref: '#/components/parameters/account'
      requestBody:
        description: Bank account object in format JSON to create
        content:
          application/json:
            schema:
              type: object
              required:
                - bank_account
              properties:
                bank_account:
                  $ref: '#/components/schemas/BankAccount'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  bank_account:
                    $ref: '#/components/schemas/BankAccount'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
      security:
        - api_key: []
  /accounts/{account}/bank_accounts/{id}:
    get:
      operationId: get-bank-account
      tags:
        - Bank Accounts
      summary: Get a bank account
      description: Returns a bank account associated with an account
      parameters:
        - $ref: '#/components/parameters/account'
        - $ref: '#/components/parameters/bank_account_id'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  bank_account:
                    $ref: '#/components/schemas/BankAccount'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
      security:
        - api_key: []
    put:
      operationId: put-bank-account
      tags:
        - Bank Accounts
      summary: Update a bank account
      description: Updates a bank account associated with an account.
      parameters:
        - $ref: '#/components/parameters/account'
        - $ref: '#/components/parameters/bank_account_id'
      requestBody:
        description: The bank account object in format JSON to update
        content:
          application/json:
            schema:
              type: object
              required:
                - bank_account
              properties:
                bank_account:
                  $ref: '#/components/schemas/BankAccount'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  bank_account:
                    $ref: '#/components/schemas/BankAccount'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
      security:
        - api_key: []
    delete:
      operationId: delete-bank-account
      tags:
        - Bank Accounts
      summary: Delete a bank account
      description: Deletes an existing bank account associated with an account.
      parameters:
        - $ref: '#/components/parameters/account'
        - $ref: '#/components/parameters/bank_account_id'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  bank_account:
                    properties:
                      id:
                        type: integer
                        example: 12
                        description: Bank account ID
                      deleted:
                        type: boolean
                        example: true
                        description: Indicates if the bank account was deleted
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
      security:
        - api_key: []
  /accounts/{account}/eaccounting/connected_accounts:
    get:
      operationId: get-connected-accounts
      tags:
        - eAccounting
      summary: List connected accounts
      description: This endpoint list all connected client accounts associated through eAccounting connection with your account.
      parameters:
        - $ref: '#/components/parameters/account'
        - $ref: '#/components/parameters/offset'
        - $ref: '#/components/parameters/limit'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  accounts:
                    type: array
                    items:
                      $ref: '#/components/schemas/Account'
                  total_count:
                    type: integer
                    example: 1
                  offset:
                    type: integer
                    example: 0
                  limit:
                    type: integer
                    example: 25
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '442':
          $ref: '#/components/responses/UnprocessableEntity'
      security:
        - api_key: []
  /accounts/{account}/tax_report_settings:
    get:
      operationId: get-tax-report-settings
      tags:
        - Tax Report Settings
      summary: List tax report settings
      description: This endpoint list all tax report settings this account has configured.
      parameters:
        - $ref: '#/components/parameters/account'
        - $ref: '#/components/parameters/offset'
        - $ref: '#/components/parameters/limit'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  tax_report_settings:
                    type: array
                    items:
                      anyOf:
                        - $ref: '#/components/schemas/TbaiTaxReportSetting'
                        - $ref: '#/components/schemas/SdiTaxReportSetting'
                  total_count:
                    type: integer
                    example: 1
                  offset:
                    type: integer
                    example: 0
                  limit:
                    type: integer
                    example: 25
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '442':
          $ref: '#/components/responses/UnprocessableEntity'
      security:
        - api_key: []
    post:
      operationId: create-tax-report-setting
      tags:
        - Tax Report Settings
      summary: Create a tax report setting
      description: This endpoint creates a new tax report setting associated with the group.
      parameters:
        - $ref: '#/components/parameters/account'
      requestBody:
        description: The tax report setting object in format JSON to create
        content:
          application/json:
            schema:
              type: object
              required:
                - tax_report_setting
              properties:
                tax_report_setting:
                  oneOf:
                    - allOf:
                        - $ref: '#/components/schemas/VerifactuTaxReportSetting'
                        - required:
                            - code
                            - reason_vat_exempt
                            - special_regime_key
                            - reason_no_subject
                            - credit_note_code
                    - allOf:
                        - $ref: '#/components/schemas/TbaiTaxReportSetting'
                        - required:
                            - code
                            - delegation
                            - reason_vat_exempt
                            - special_regime_key
                            - reason_no_subject
                            - credit_note_code
                            - type_operation
                    - allOf:
                        - $ref: '#/components/schemas/SdiTaxReportSetting'
                        - required:
                            - code
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  tax_report_setting:
                    anyOf:
                      - $ref: '#/components/schemas/VerifactuTaxReportSetting'
                      - $ref: '#/components/schemas/TbaiTaxReportSetting'
                      - $ref: '#/components/schemas/SdiTaxReportSetting'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '442':
          $ref: '#/components/responses/UnprocessableEntity'
      security:
        - api_key: []
  /accounts/{account}/tax_report_settings/{code}:
    get:
      operationId: get-tax-report-setting
      tags:
        - Tax Report Settings
      summary: Retrieve a tax report setting
      parameters:
        - $ref: '#/components/parameters/account'
        - $ref: '#/components/parameters/tax_authority_code'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  tax_report_setting:
                    anyOf:
                      - $ref: '#/components/schemas/VerifactuTaxReportSetting'
                      - $ref: '#/components/schemas/TbaiTaxReportSetting'
                      - $ref: '#/components/schemas/SdiTaxReportSetting'
                      - $ref: '#/components/schemas/LhdnTaxReportSetting'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '442':
          $ref: '#/components/responses/UnprocessableEntity'
      security:
        - api_key: []
    put:
      operationId: put-tax-report-setting
      tags:
        - Tax Report Settings
      summary: Update a tax report setting
      description: |
        This endpoint updates a tax report setting associated with an account.
      parameters:
        - $ref: '#/components/parameters/account'
        - $ref: '#/components/parameters/tax_authority_code'
      requestBody:
        description: The tax report setting object in format JSON to update
        content:
          application/json:
            schema:
              type: object
              required:
                - tax_report_setting
              properties:
                tax_report_setting:
                  anyOf:
                    - $ref: '#/components/schemas/VerifactuTaxReportSetting'
                    - $ref: '#/components/schemas/TbaiTaxReportSetting'
                    - $ref: '#/components/schemas/SdiTaxReportSetting'
                    - $ref: '#/components/schemas/LhdnTaxReportSetting'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  tax_report_setting:
                    oneOf:
                      - $ref: '#/components/schemas/VerifactuTaxReportSetting'
                      - $ref: '#/components/schemas/TbaiTaxReportSetting'
                      - $ref: '#/components/schemas/SdiTaxReportSetting'
                      - $ref: '#/components/schemas/LhdnTaxReportSetting'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '442':
          $ref: '#/components/responses/UnprocessableEntity'
      security:
        - api_key: []
    delete:
      operationId: delete-tax-report-setting
      tags:
        - Tax Report Settings
      summary: Delete a tax report setting
      description: This endpoint deletes a tax report setting associated with an account.
      parameters:
        - $ref: '#/components/parameters/account'
        - $ref: '#/components/parameters/tax_authority_code'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  tax_report_setting:
                    properties:
                      code:
                        type: string
                        example: tbai
                        description: Code of the tax report setting
                      deleted:
                        type: boolean
                        example: true
                        description: Indicates if the tax report setting was deleted
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '442':
          $ref: '#/components/responses/UnprocessableEntity'
      security:
        - api_key: []
  /projects.{format}:
    get:
      operationId: get-companies
      tags:
        - Companies
      summary: List companies
      deprecated: true
      description: Returns all the projects/companies to which the user has access to.
      parameters:
        - $ref: '#/components/parameters/format'
        - $ref: '#/components/parameters/offset'
        - $ref: '#/components/parameters/limit'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  projects:
                    type: array
                    items:
                      $ref: '#/components/schemas/Project'
                  total_count:
                    type: integer
                    example: 1
                  offset:
                    type: integer
                    example: 0
                  limit:
                    type: integer
                    example: 25
            application/xml:
              schema:
                type: object
                properties:
                  projects:
                    type: array
                    items:
                      $ref: '#/components/schemas/Project'
                  total_count:
                    type: integer
                    example: 1
                    xml:
                      attribute: true
                  offset:
                    type: integer
                    example: 0
                    xml:
                      attribute: true
                  limit:
                    type: integer
                    example: 25
                    xml:
                      attribute: true
              example: |
                <?xml version="1.0" encoding="UTF-8"?>
                <projects total_count="1" offset="0" limit="25" type="array">
                    <project>
                        <id>9324</id>
                        <name>B2Brouter Global, S.L.</name>
                        <identifier>b2brouter-grlobal</identifier>
                        <company_name>B2Brouter Global, S.L.</company_name>
                        <company_taxcode>ESB63276174</company_taxcode>
                        <description/>
                        <status>1</status>
                        <created_on>2015-05-04T08:56:57Z</created_on>
                        <updated_on>2015-05-04T08:56:57Z</updated_on>
                    </project>
                </projects>
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
        '406':
          description: Not Acceptable
      security:
        - api_key: []
      x-code-samples:
        - lang: PowerShell
          label: cURL
          source: curl https://app-staging.b2brouter.net/projects.json?key=api_key
  /projects/{account}/my_company.{format}:
    get:
      operationId: get-company
      tags:
        - Companies
      summary: Show company
      deprecated: true
      description: Return the information about your company.
      parameters:
        - $ref: '#/components/parameters/format'
        - $ref: '#/components/parameters/account'
      responses:
        '200':
          description: Returns your company
          content:
            application/json:
              schema:
                type: object
                properties:
                  my_company:
                    $ref: '#/components/schemas/Company'
            application/xml:
              schema:
                type: object
                properties:
                  my_company:
                    $ref: '#/components/schemas/Company'
              example: |
                <?xml version="1.0" encoding="UTF-8"?>
                <my_company>
                    <taxcode>ESB63276174</taxcode>
                    <name>B2Brouter Global, S.L.</name>
                    <email>support@b2brouter.net</email>
                    <phone>902504831</phone>
                    <address>Avinguda Diagonal, 433, 1 1</address>
                    <city>Barcelona</city>
                    <postalcode>08036</postalcode>
                    <province>Barcelona</province>
                    <country>es</country>
                    <website>www.b2brouter.net</website>
                    <transport_type_code>es.efact</transport_type_code>
                    <document_type_code>xml.facturae.3.2</document_type_code>
                    <currency>EUR</currency>
                    <company_identifier/>
                    <project_identifier>b2brouter-global</project_identifier>
                    <edi_code/>
                    <logo>/companies/logo/b2brouter-global</logo>
                    <issued_invoice_notifications>support@b2brouter.net</issued_invoice_notifications>
                    <refused_invoice_notifications/>
                    <invoice_error_sending_notifications/>
                    <received_invoice_notifications/>
                    <received_order_notifications/>
                    <sii_imported_notifications/>
                    <sii_sent_notifications/>
                    <sii_state_changes_notifications/>
                    <sii_duplicates_notifications/>
                    <connector>SFTP</connector>
                    <plan>enterprise</plan>
                </my_company>
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
        '404':
          description: Project not found
      x-code-samples:
        - lang: PowerShell
          label: cURL
          source: |
            curl https://app-staging.b2brouter.net/projects/xxxx/my_company.json?key=xxxx
      security:
        - api_key: []
  /invoices/{id}.{format}:
    get:
      operationId: get-invoice
      tags:
        - Invoices
      summary: Get an invoice
      description: Returns information about a specific invoice, it can be an **issued invoice** or a **received invoice**.
      parameters:
        - $ref: '#/components/parameters/invoice_id'
        - $ref: '#/components/parameters/format'
        - $ref: '#/components/parameters/include'
        - $ref: '#/components/parameters/disposition'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  invoice:
                    $ref: '#/components/schemas/Invoice'
            application/xml:
              schema:
                type: object
                properties:
                  invoice:
                    $ref: '#/components/schemas/Invoice'
              example: |
                <?xml version="1.0" encoding="UTF-8"?>
                <invoice>
                    <id>3429830</id>
                    <type>IssuedInvoice</type>
                    <number>40</number>
                    <to_net/>
                    <to_net_id/>
                    <from_net/>
                    <from_net_id/>
                    <project id="14" name="B2Brouter Global, S.L."/>
                    <company id="8" name="B2Brouter Global, S.L." taxcode="ESB63276174"/>
                    <client id="326144" name="test GB NINO" taxcode="" address="" address2="" postalcode="3221" city="" province="" country="gb"/>
                    <state>allegedly_paid</state>
                    <date>2020-11-25</date>
                    <due_date>2020-11-30</due_date>
                    <ponumber/>
                    <file_reference/>
                    <payment_method_info>Bank card</payment_method_info>
                    <discount_text>Compensation for subscription not enjoyed</discount_text>
                    <discount_percent>33.33</discount_percent>
                    <discount_amount>100.0</discount_amount>
                    <subtotal>200.0</subtotal>
                    <taxes type="array">
                        <tax>
                            <name>IVA Exempt</name>
                            <base>200.0</base>
                            <amount>0.0</amount>
                        </tax>
                    </taxes>
                    <total>200.0</total>
                    <currency>GBP</currency>
                    <attachments type="array"></attachments>
                    <created_at>2020-11-25T09:03:47Z</created_at>
                    <updated_at>2020-11-25T09:03:47Z</updated_at>
                    <state_updated_at>2020-11-25T09:03:47Z</state_updated_at>
                </invoice>
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
        '404':
          description: Invoice not found
      x-code-samples:
        - lang: PowerShell
          label: cURL
          source: |
            curl https://app-staging.b2brouter.net/invoices/13123.json?key=xxxx

            curl https://app-staging.b2brouter.net/invoices/1.pdf

            curl https://app-staging.b2brouter.net/invoices/1.facturae32

            curl https://app-staging.b2brouter.net/invoices/1.json?include=lines

            curl https://app-staging.b2brouter.net/invoices/1.json?include=detailed_lines
      security:
        - api_key: []
    put:
      operationId: put-invoice
      tags:
        - Invoices
      summary: Update an invoice
      description: Update a specific invoice.
      parameters:
        - $ref: '#/components/parameters/format'
        - $ref: '#/components/parameters/invoice_id'
      requestBody:
        description: The Invoice object in format JSON to update
        content:
          application/json:
            schema:
              type: object
              properties:
                invoice:
                  $ref: '#/components/schemas/InvoiceUpdate'
      responses:
        '204':
          description: Successful update
        '400':
          description: Invalid status value
        '422':
          description: Unprocessable Entity
      security:
        - api_key: []
      x-code-samples:
        - lang: PowerShell
          label: cURL
          source: |
            //example 1

            curl -v -H "Content-Type: application/json" -X PUT --data
            "@388.json" -H "X-B2B-API-Key: xxxx"
            https://app.b2brouter.net/invoices/388.json

            // updates the state

            curl --location --request PUT 'https://app.b2brouter.net/invoices/388.json'
            --header 'X-B2B-API-Key: xxxxxx'
            --header 'Content-Type: application/json'
            --data-raw '{
                "invoice": {
                    "state": "accepted"
                  }
            }'
    delete:
      operationId: delete-invoice
      tags:
        - Invoices
      summary: Delete an invoice
      description: Delete a specific invoice.
      parameters:
        - $ref: '#/components/parameters/format'
        - $ref: '#/components/parameters/invoice_id'
      responses:
        '204':
          description: Invoice deleted
        '404':
          description: Invoice not found
        '422':
          description: Unprocessable Entity
      x-code-samples:
        - lang: Curl
          source: |
            curl -X DELETE https://app-staging.b2brouter.net/invoices/31231234.json?key=xxxx
      security:
        - api_key: []
  /invoices/{id}/as/{document_type_code}:
    get:
      operationId: get-invoice-with-document-type
      tags:
        - Invoices
      summary: Get an invoice with a specific document type
      description: |
        Returns the specified invoice with the indicated document type.<br> It can be an **issued invoice** or a **received invoice**.
      parameters:
        - $ref: '#/components/parameters/invoice_id'
        - $ref: '#/components/parameters/document_type_code'
      responses:
        '200':
          description: Successful operation
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
        '404':
          description: Invoice not found
      x-code-samples:
        - lang: PowerShell
          label: cURL
          source: |
            curl https://app-staging.b2brouter.net/invoices/1/as/pdf.invoice

            curl https://app-staging.b2brouter.net/invoices/1/as/xml.facturae.3.2
      security:
        - api_key: []
  /projects/{account}/invoices.{format}:
    get:
      operationId: get-invoices
      tags:
        - Invoices
      summary: List of issued invoices
      description: Returns a paginated list of the submitted invoices of the company
      parameters:
        - $ref: '#/components/parameters/account'
        - $ref: '#/components/parameters/format'
        - $ref: '#/components/parameters/offset'
        - $ref: '#/components/parameters/limit'
        - $ref: '#/components/parameters/ack'
        - $ref: '#/components/parameters/date_from'
        - $ref: '#/components/parameters/date_to'
        - $ref: '#/components/parameters/due_date_from'
        - $ref: '#/components/parameters/due_date_to'
        - $ref: '#/components/parameters/number'
        - $ref: '#/components/parameters/state_updated_at_from'
        - $ref: '#/components/parameters/taxcode'
        - $ref: '#/components/parameters/new'
        - $ref: '#/components/parameters/sending'
        - $ref: '#/components/parameters/error'
        - $ref: '#/components/parameters/discarded'
        - $ref: '#/components/parameters/sent'
        - $ref: '#/components/parameters/refused'
        - $ref: '#/components/parameters/closed'
        - $ref: '#/components/parameters/registered'
        - $ref: '#/components/parameters/accepted'
        - $ref: '#/components/parameters/allegedly_paid'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  invoices:
                    type: array
                    items:
                      $ref: '#/components/schemas/InvoiceReduced'
                  total_count:
                    type: integer
                    example: 1
                  offset:
                    type: integer
                    example: 0
                  limit:
                    type: integer
                    example: 25
            application/xml:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/InvoiceReduced'
                  total_count:
                    type: integer
                    example: 1
                    xml:
                      attribute: true
                  offset:
                    type: integer
                    example: 0
                    xml:
                      attribute: true
                  limit:
                    type: integer
                    example: 25
                    xml:
                      attribute: true
                xml:
                  name: invoices
              example: |
                <?xml version="1.0" encoding="UTF-8"?>
                <invoices total_count="40" offset="0" limit="25" type="array">
                    <invoice>
                      <id>3429830</id>
                      <number>40</number>
                      <file_reference/>
                      <date>2020-11-25</date>
                      <due_date>2020-11-30</due_date>
                      <project id="14" name="B2Brouter Global, S.L."/>
                      <client id="326144" name="test GB NINO" taxcode=""/>
                      <state>allegedly_paid</state>
                      <total>200.0</total>
                      <currency>GBP</currency>
                      <created_at>2020-11-25T09:03:47Z</created_at>
                      <updated_at>2020-11-25T09:03:47Z</updated_at>
                      <state_updated_at>2020-11-25T09:03:47Z</state_updated_at>
                      <to_net_id/>
                  </invoice>
                  ...
                </invoices>
      security:
        - api_key: []
      x-code-samples:
        - lang: PowerShell
          label: cURL
          source: |
            //gets the first 25 invoices
            curl https://app-staging.b2brouter.net/projects/b2brouter/invoices.json

            //gets the first 100 invoices
            curl https://app-staging.b2brouter.net/projects/b2brouter/invoices.json?limit=100

            //gets 10 invoices starting on the 30th
            curl https://app-staging.b2brouter.net/projects/b2brouter/invoices.json?offset=30&limit=10

            //only registered or accepted invoices
            curl https://app-staging.b2brouter.net/projects/b2brouter/invoices.json?registered=1&accepted=1

            //between dates
            curl https://app-staging.b2brouter.net/projects/b2brouter/invoices.json?date_from=2015-01-01&date_to=2015-06-26
    post:
      operationId: create-invoice
      tags:
        - Invoices
      summary: Create an invoice
      description: Create an invoice
      parameters:
        - $ref: '#/components/parameters/account'
        - $ref: '#/components/parameters/format'
      requestBody:
        description: The Invoice object in format JSON to create
        content:
          application/json:
            schema:
              type: object
              required:
                - invoice
              properties:
                send_after_import:
                  $ref: '#/components/schemas/SendAfterImport'
                invoice:
                  type: object
                  allOf:
                    - $ref: '#/components/schemas/Invoice'
                    - type: object
                      properties:
                        state:
                          description: |
                            State of the invoice.
                            To switch the state of an invoice, use the `/invoices/{id}/mark_as.{format}` endpoint instead.
                          deprecated: true
                          allOf:
                            - $ref: '#/components/schemas/StateInput'
      responses:
        '201':
          description: Successful operation
        '400':
          description: Invalid status value
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
        '422':
          description: Unprocessable Entity
      security:
        - api_key: []
  /projects/{account}/received.{format}:
    get:
      operationId: get-received-invoice
      tags:
        - Invoices
      summary: List of received invoices
      description: Returns a paginated list of your received invoices.
      parameters:
        - $ref: '#/components/parameters/account'
        - $ref: '#/components/parameters/format'
        - $ref: '#/components/parameters/offset'
        - $ref: '#/components/parameters/limit'
        - $ref: '#/components/parameters/ack'
        - $ref: '#/components/parameters/date_from'
        - $ref: '#/components/parameters/date_to'
        - $ref: '#/components/parameters/due_date_from'
        - $ref: '#/components/parameters/due_date_to'
        - $ref: '#/components/parameters/number'
        - $ref: '#/components/parameters/state_updated_at_from'
        - $ref: '#/components/parameters/taxcode'
        - $ref: '#/components/parameters/received_invoice_new'
        - $ref: '#/components/parameters/received_invoice_received'
        - $ref: '#/components/parameters/received_invoice_error'
        - $ref: '#/components/parameters/received_invoice_discarded'
        - $ref: '#/components/parameters/received_invoice_paid'
        - $ref: '#/components/parameters/received_invoice_refused'
        - $ref: '#/components/parameters/received_invoice_invalid'
        - $ref: '#/components/parameters/received_invoice_ocr_failed'
        - $ref: '#/components/parameters/received_invoice_accepted'
        - $ref: '#/components/parameters/received_invoice_exclude_offices'
        - $ref: '#/components/parameters/from_net'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  invoices:
                    type: array
                    items:
                      $ref: '#/components/schemas/InvoiceReduced'
                  total_count:
                    type: integer
                    example: 1
                  offset:
                    type: integer
                    example: 0
                  limit:
                    type: integer
                    example: 25
            application/xml:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/InvoiceReduced'
                  total_count:
                    type: integer
                    example: 1
                    xml:
                      attribute: true
                  offset:
                    type: integer
                    example: 0
                    xml:
                      attribute: true
                  limit:
                    type: integer
                    example: 25
                    xml:
                      attribute: true
                xml:
                  name: invoices
              example: |
                <?xml version="1.0" encoding="UTF-8"?>
                <invoices total_count="40" offset="0" limit="25" type="array">
                    <invoice>
                      <id>3429830</id>
                      <number>40</number>
                      <file_reference/>
                      <date>2020-11-25</date>
                      <due_date>2020-11-30</due_date>
                      <project id="14" name="B2Brouter Global, S.L."/>
                      <client id="326144" name="test GB NINO" taxcode=""/>
                      <state>allegedly_paid</state>
                      <total>200.0</total>
                      <currency>GBP</currency>
                      <created_at>2020-11-25T09:03:47Z</created_at>
                      <updated_at>2020-11-25T09:03:47Z</updated_at>
                      <state_updated_at>2020-11-25T09:03:47Z</state_updated_at>
                      <to_net_id/>
                  </invoice>
                  ...
                </invoices>
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
      security:
        - api_key: []
      x-code-samples:
        - lang: PowerShell
          label: cURL
          source: |
            curl https://app-staging.b2brouter.net/projects/b2brouter/received.json
  /projects/{account}/issued_self_invoices.{format}:
    get:
      operationId: get-issued-self-invoices
      tags:
        - Invoices
      summary: List of issued self-invoices
      description: Returns a paginated list of the submitted self-invoices of the company
      parameters:
        - $ref: '#/components/parameters/account'
        - $ref: '#/components/parameters/format'
        - $ref: '#/components/parameters/offset'
        - $ref: '#/components/parameters/limit'
        - $ref: '#/components/parameters/ack'
        - $ref: '#/components/parameters/date_from'
        - $ref: '#/components/parameters/date_to'
        - $ref: '#/components/parameters/due_date_from'
        - $ref: '#/components/parameters/due_date_to'
        - $ref: '#/components/parameters/number'
        - $ref: '#/components/parameters/state_updated_at_from'
        - $ref: '#/components/parameters/taxcode'
        - $ref: '#/components/parameters/new'
        - $ref: '#/components/parameters/error'
        - $ref: '#/components/parameters/refused'
        - $ref: '#/components/parameters/registered'
        - $ref: '#/components/parameters/accepted'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  invoices:
                    type: array
                    items:
                      $ref: '#/components/schemas/InvoiceReduced'
                  total_count:
                    type: integer
                    example: 1
                  offset:
                    type: integer
                    example: 0
                  limit:
                    type: integer
                    example: 25
            application/xml:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/InvoiceReduced'
                  total_count:
                    type: integer
                    example: 1
                    xml:
                      attribute: true
                  offset:
                    type: integer
                    example: 0
                    xml:
                      attribute: true
                  limit:
                    type: integer
                    example: 25
                    xml:
                      attribute: true
                xml:
                  name: invoices
              example: |
                <?xml version="1.0" encoding="UTF-8"?>
                <invoices total_count="40" offset="0" limit="25" type="array">
                    <invoice>
                      <id>3429830</id>
                      <number>40</number>
                      <file_reference/>
                      <date>2020-11-25</date>
                      <due_date>2020-11-30</due_date>
                      <project id="14" name="B2Brouter Global, S.L."/>
                      <client id="326144" name="test GB NINO" taxcode=""/>
                      <state>allegedly_paid</state>
                      <total>200.0</total>
                      <currency>GBP</currency>
                      <created_at>2020-11-25T09:03:47Z</created_at>
                      <updated_at>2020-11-25T09:03:47Z</updated_at>
                      <state_updated_at>2020-11-25T09:03:47Z</state_updated_at>
                      <to_net_id/>
                  </invoice>
                  ...
                </invoices>
      security:
        - api_key: []
  /projects/{account}/issued_simplified_invoices.{format}:
    get:
      operationId: get-issued-simplified-invoices
      tags:
        - Invoices
      summary: List of issued simplified invoices
      description: Returns a paginated list of the submitted simplified invoices of the company
      parameters:
        - $ref: '#/components/parameters/account'
        - $ref: '#/components/parameters/format'
        - $ref: '#/components/parameters/offset'
        - $ref: '#/components/parameters/limit'
        - $ref: '#/components/parameters/date_from'
        - $ref: '#/components/parameters/date_to'
        - $ref: '#/components/parameters/number'
        - $ref: '#/components/parameters/new'
        - $ref: '#/components/parameters/error'
        - $ref: '#/components/parameters/sent'
        - $ref: '#/components/parameters/closed'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  invoices:
                    type: array
                    items:
                      $ref: '#/components/schemas/InvoiceReduced'
                  total_count:
                    type: integer
                    example: 1
                  offset:
                    type: integer
                    example: 0
                  limit:
                    type: integer
                    example: 25
            application/xml:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/InvoiceReduced'
                  total_count:
                    type: integer
                    example: 1
                    xml:
                      attribute: true
                  offset:
                    type: integer
                    example: 0
                    xml:
                      attribute: true
                  limit:
                    type: integer
                    example: 25
                    xml:
                      attribute: true
                xml:
                  name: invoices
              example: |
                <?xml version="1.0" encoding="UTF-8"?>
                <invoices total_count="40" offset="0" limit="25" type="array">
                    <invoice>
                      <id>3429830</id>
                      <number>40</number>
                      <file_reference/>
                      <date>2020-11-25</date>
                      <due_date>2020-11-30</due_date>
                      <project id="14" name="B2Brouter Global, S.L."/>
                      <state>sent</state>
                      <total>200.0</total>
                      <currency>GBP</currency>
                      <created_at>2020-11-25T09:03:47Z</created_at>
                      <updated_at>2020-11-25T09:03:47Z</updated_at>
                      <state_updated_at>2025-04-28T12:46:28Z</state_updated_at>
                      <to_net_id/>
                    </invoice>
                  ...
                </invoices>
      security:
        - api_key: []
  /projects/{account}/invoices/import.{format}:
    post:
      operationId: import-invoice
      tags:
        - Invoices
      summary: Import an invoice from a file
      description: Import an invoice from a supported file.
      parameters:
        - $ref: '#/components/parameters/account'
        - $ref: '#/components/parameters/format'
        - $ref: '#/components/parameters/send_after_import'
        - $ref: '#/components/parameters/issued'
      requestBody:
        description: The invoice file to import
        content:
          application/octet-stream:
            schema:
              type: string
              format: binary
      responses:
        '201':
          description: Invoice has been created
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
        '406':
          description: Not Acceptable
      security:
        - api_key: []
      x-code-samples:
        - lang: PowerShell
          label: cURL
          source: null
  /invoices/{id}/mark_as.{format}:
    post:
      operationId: mark-as-invoice
      tags:
        - Invoices
      summary: Switch invoice state
      description: Switch the state of an existing invoice.
      parameters:
        - $ref: '#/components/parameters/format'
        - $ref: '#/components/parameters/invoice_id'
      requestBody:
        description: Attributes to update the state of the invoice
        content:
          application/json:
            schema:
              type: object
              required:
                - state
              properties:
                state:
                  $ref: '#/components/schemas/StateInput'
                commit:
                  $ref: '#/components/schemas/InvoiceMarkAsCommit'
                reason:
                  $ref: '#/components/schemas/InvoiceMarkAsReason'
      responses:
        '204':
          description: ' State successfully switched'
        '401':
          description: ' Unauthorized'
        '404':
          description: ' Invoice not found'
        '422':
          description: ' Unprocessable Entity'
          content:
            application/json:
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      $ref: '#/components/schemas/ErrorItem'
      security:
        - api_key: []
      x-code-samples:
        - lang: PowerShell
          label: cURL
          source: |
            curl --location --request PUT 'https://app.b2brouter.net/invoices/388/mark_as.json'
            --header 'X-B2B-API-Key: xxxxxx'
            --header 'Content-Type: application/json'
            --data-raw '{
                  "state": "accepted"
                  "commit": "with_mail"
                  "reason": "Write here the reason of the state change, if you want."
                }'
  /invoices/{id}/add_attachment.{format}:
    post:
      operationId: add-attachment-invoice
      tags:
        - Invoices
      summary: Add attachment
      description: Adds an attachment to an existing invoice. Do not confuse with add_attachments method (note plural)
      parameters:
        - $ref: '#/components/parameters/invoice_id'
        - $ref: '#/components/parameters/format'
        - $ref: '#/components/parameters/filename'
        - $ref: '#/components/parameters/use_as_pdf_view'
      requestBody:
        description: The attachment to add to the invoice
        content:
          application/octet-stream:
            schema:
              type: string
              format: binary
      responses:
        '204':
          description: Attachment successfully added
      security:
        - api_key: []
      x-readme:
        samples-languages:
          - curl
        code-samples:
          - language: curl
            name: cURL - binary example
            code: |
              curl -X 'POST' \
              'https://app-staging.b2brouter.net/invoices/12345/add_attachment.json?filename=attachment.pdf' \
              -H 'X-B2B-API-Key: xxxxxxxxxx' \
              -H 'accept: */*' \
              -H 'Content-Type: application/octet-stream' \
              --data-binary '@attachment.pdf'
  /invoices/{id}/add_attachments.{format}:
    post:
      operationId: add-attachments-invoice
      tags:
        - Invoices
      summary: Add attachments
      description: Adds attachments to an existing invoice. Expects a multipart POST request, attachments must be compressed in a zip file.
      parameters:
        - $ref: '#/components/parameters/invoice_id'
        - $ref: '#/components/parameters/format'
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                attachments:
                  description: A zip file containing the attachments to add to the invoice.
      responses:
        '201':
          description: Attachments successfully added
          content:
            application/json:
              schema:
                type: object
                properties:
                  saved_attachments:
                    type: array
                    items:
                      $ref: '#/components/schemas/Attachment'
                  errors:
                    type: array
                    items: {}
            application/xml:
              schema:
                type: object
                properties:
                  saved_attachments:
                    type: array
                    items:
                      $ref: '#/components/schemas/Attachment'
                  errors:
                    type: array
                    items:
                      $ref: '#/components/schemas/Message'
        '422':
          description: Errors adding attachments
          content:
            application/json:
              schema:
                type: object
                properties:
                  saved_attachments:
                    type: array
                    items: {}
                  errors:
                    type: array
                    items:
                      $ref: '#/components/schemas/ErrorMessage'
      security:
        - api_key: []
      x-readme:
        samples-languages:
          - curl
        code-samples:
          - language: curl
            name: cURL - binary example
            code: |
              curl -X 'POST' \
              'https://app-staging.b2brouter.net/invoices/12345/add_attachments.json' \
              -H 'accept: application/json' \
              -H 'X-B2B-API-Key: xxxxxxxxxx' \
              -H 'Content-Type: multipart/form-data' \
              -F 'attachments=@attachments.zip'
  /invoices/{id}/generate_tax_report.{format}:
    post:
      operationId: generate-tax-report-from-invoice
      tags:
        - Invoices
      summary: Generate a tax report from an Invoice
      description: |-
        Generates the tax report for an existing invoice. Depending on the Tax Authority and the settings of your account, the tax report might be automatically send after issuing an invoice. Thus, it might not be necessary to explicitly call this method if you issue your invoices via B2Brouter.
        Note that you will have to check the status of the tax report we send in your behalf in order to be able to take the necessary actions in case any error or warning is issued by the Tax Authority. Because of the asynchronous nature of the tax report sending process, there is no guarantee that when you check the status of the tax reports it will already have the response of the Tax Authority. It usually takes a few seconds to complete the transaction. You will know that the transaction is complete if the response of the check of the status of the tax report has an status **registered** or **error**. We recommend you retry the status check until you get a final state on your tax report.
      parameters:
        - $ref: '#/components/parameters/invoice_id'
        - $ref: '#/components/parameters/format'
      responses:
        '201':
          description: Tax report successfully created
          content:
            application/json:
              schema:
                type: object
                properties:
                  tax_report:
                    $ref: '#/components/schemas/TaxReportGenerated'
      security:
        - api_key: []
  /invoices/send_invoice/{id}.{format}:
    post:
      operationId: send-invoice
      tags:
        - Invoices
      summary: Send invoice
      description: Send the invoice
      parameters:
        - $ref: '#/components/parameters/invoice_id'
        - $ref: '#/components/parameters/format'
      responses:
        '200':
          description: Successful operation
        '422':
          description: Unprocessable Entity
          content:
            application/xml:
              example: |
                <?xml version="1.0" encoding="UTF-8"?>
                <errors type="array">
                    <error>Cannot resend invoices in state Reported as paid</error>
                </errors>
      security:
        - api_key: []
      x-code-samples:
        - lang: PowerShell
          label: cURL
          source: curl -X POST htps://app-staging.b2brouter.net/invoices/send_invoice/6542.json
  /invoices/{id}/ack.{format}:
    post:
      operationId: ack-invoice
      tags:
        - Invoices
      summary: Mark an invoice as acknowledged
      description: Mark an invoice as acknowledged. This will prevent the invoice from being listed when  getting the list of issued or received invoices, unless when param ack=true is given.
      parameters:
        - $ref: '#/components/parameters/invoice_id'
        - $ref: '#/components/parameters/format'
      responses:
        '204':
          description: Successful operation
      security:
        - api_key: []
      x-code-samples:
        - lang: PowerShell
          label: cURL
          source: curl -X POST htps://app-staging.b2brouter.net/invoices/6542/ack.json
  /orders/{id}.{format}:
    get:
      operationId: get-order
      tags:
        - Orders
      summary: Get an order
      description: Returns information about a specific order.
      parameters:
        - $ref: '#/components/parameters/order_id'
        - $ref: '#/components/parameters/order_format'
        - $ref: '#/components/parameters/include'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Order'
            application/xml:
              schema:
                $ref: '#/components/schemas/Order'
              example: |
                <?xml version="1.0" encoding="UTF-8"?>
                <order>
                  <id>3429830</id>
                  ...
                </order>
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
        '404':
          description: Order not found
      x-code-samples:
        - lang: PowerShell
          label: cURL
          source: |
            curl https://app-staging.b2brouter.net/orders/13123.json?key=xxxx

            curl https://app-staging.b2brouter.net/orders/1.pdf

            curl https://app-staging.b2brouter.net/orders/1.facturae32

            curl https://app-staging.b2brouter.net/orders/1.json?include=lines

            curl https://app-staging.b2brouter.net/orders/1.json?include=detailed_lines
      security:
        - api_key: []
  /projects/{account}/orders.{format}:
    get:
      operationId: get-orders
      tags:
        - Orders
      summary: List of orders
      description: Returns a paginated list of the submitted orders of the company
      parameters:
        - $ref: '#/components/parameters/account'
        - $ref: '#/components/parameters/format'
        - $ref: '#/components/parameters/offset'
        - $ref: '#/components/parameters/limit'
        - $ref: '#/components/parameters/order_number'
        - $ref: '#/components/parameters/order_filename'
        - $ref: '#/components/parameters/order_delivery_location_id'
        - $ref: '#/components/parameters/order_client'
        - $ref: '#/components/parameters/order_sel_data'
        - $ref: '#/components/parameters/order_date_from'
        - $ref: '#/components/parameters/order_date_to'
        - $ref: '#/components/parameters/order_country'
        - $ref: '#/components/parameters/order_delivery_confirmed'
        - $ref: '#/components/parameters/order_closed'
        - $ref: '#/components/parameters/order_accepted'
        - $ref: '#/components/parameters/order_refused'
        - $ref: '#/components/parameters/order_received'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  orders:
                    type: array
                    items:
                      $ref: '#/components/schemas/Order'
            application/xml:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/Order'
                xml:
                  name: orders
              example: |
                <?xml version="1.0" encoding="UTF-8"?>
                <orders total_count="40" offset="0" limit="25" type="array">
                  <order>
                    <id>3429830</id>
                    ...
                  </order>
                  ...
                </orders>
      security:
        - api_key: []
      x-code-samples:
        - lang: PowerShell
          label: cURL
          source: |
            //gets the first 25 orders
            curl https://app-staging.b2brouter.net/projects/b2brouter/orders.json

            //gets the first 100 orders
            curl https://app-staging.b2brouter.net/projects/b2brouter/orders.json?limit=100

            //gets 10 orders starting on the 30th
            curl https://app-staging.b2brouter.net/projects/b2brouter/orders.json?offset=30&limit=10

            //between dates
            curl https://app-staging.b2brouter.net/projects/b2brouter/orders.json?date_from=2015-01-01&date_to=2015-06-26
  /orders/{id}/mark_as.{format}:
    post:
      operationId: mark-as-order
      tags:
        - Orders
      summary: Switch order state
      description: Switch the state of an existing order.
      parameters:
        - $ref: '#/components/parameters/format'
        - $ref: '#/components/parameters/order_id'
      requestBody:
        description: Attributes to update the state of the order
        content:
          application/json:
            schema:
              type: object
              required:
                - state
              properties:
                state:
                  $ref: '#/components/schemas/OrderState'
      responses:
        '204':
          description: ' State successfully switched'
        '401':
          description: ' Unauthorized'
        '404':
          description: ' Order not found'
        '422':
          description: ' Unprocessable Entity'
          content:
            application/json:
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      $ref: '#/components/schemas/ErrorItem'
      security:
        - api_key: []
      x-code-samples:
        - lang: PowerShell
          label: cURL
          source: |
            curl --location --request PUT 'https://app.b2brouter.net/orders/388/mark_as.json'
            --header 'X-B2B-API-Key: xxxxxx'
            --header 'Content-Type: application/json'
            --data-raw '{
                  "state": "accepted"
                }'
  /clients/{id}.{format}:
    get:
      operationId: get-contact
      tags:
        - Contacts
      summary: Get a contact (client/provider)
      description: Returns a client entity
      parameters:
        - $ref: '#/components/parameters/client_id'
        - $ref: '#/components/parameters/format'
      responses:
        '200':
          description: Returns a client
          content:
            application/json:
              schema:
                type: object
                properties:
                  client:
                    $ref: '#/components/schemas/ClientWithRequiredAttributes'
            application/xml:
              schema:
                $ref: '#/components/schemas/ClientWithRequiredAttributes'
              example: |
                <?xml version="1.0" encoding="UTF-8"?>
                <client>
                    <id>1</id>
                    <taxcode>ESA13585625</taxcode>
                    <name>Client1</name>
                    <email>mail@client1.com</email>
                    <website>www.client1.com</website>
                    <address>Street ... </address>
                    <address2/>
                    <postalcode>08080</postalcode>
                    <city>Barcelona</city>
                    <province>Barcelona</province>
                    <country>es</country>
                    <language>en</language>
                    <currency>EUR</currency>
                    <transport_type_code>es.efact</transport_type_code>
                    <document_type_code>xml.facturae.3.2</document_type_code>
                    <iban>ES9600001233333333333333</iban>
                    <bic/>
                    <payment_method/>
                    <payment_method_text/>
                    <terms>---</terms>
                    <sepa_type>CORE</sepa_type>
                    <company_identifier/>
                    <edi_code></edi_code>
                    <integration_code>client_erpcode12345</integration_code>
                    <created_at>2017-09-25T14:49:45Z</created_at>
                    <updated_at>2018-07-19T10:46:52Z</updated_at>
                    <phone/>
                </client>
        '404':
          description: Client not found
      security:
        - api_key: []
    put:
      operationId: put-contact
      tags:
        - Contacts
      summary: Update a contact
      parameters:
        - $ref: '#/components/parameters/client_id'
        - $ref: '#/components/parameters/format'
      requestBody:
        description: The Contact object in format JSON to update
        content:
          application/json:
            schema:
              type: object
              properties:
                client:
                  oneOf:
                    - $ref: '#/components/schemas/Client'
      responses:
        '201':
          description: Contact updated input
        '422':
          description: The customer has not been updated due to validation errors (the payload of the response contains the error message)
          content:
            application/xml:
              example: |
                <?xml version="1.0" encoding="UTF-8"?>
                <errors type="array">
                  <error>VAT Id Number has already been taken</error>
                  <error>Language can't be blank</error>
                </errors>
      security:
        - api_key: []
    delete:
      operationId: delete-contact
      tags:
        - Contacts
      summary: Delete a contact
      parameters:
        - $ref: '#/components/parameters/client_id'
        - $ref: '#/components/parameters/format'
      responses:
        '204':
          description: Contact has been deleted
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
        '404':
          description: Contact not found
      x-code-samples:
        - lang: PowerShell
          label: cURL
          source: |
            curl -X DELETE https://app-staging.b2brouter.net/clients/31231234.json?key=xxxx
      security:
        - api_key: []
  /projects/{account}/clients.{format}:
    get:
      operationId: get-contacts
      tags:
        - Contacts
      summary: List contacts
      description: Returns an array of the contacts of the specify project.
      parameters:
        - $ref: '#/components/parameters/account'
        - $ref: '#/components/parameters/format'
        - $ref: '#/components/parameters/offset'
        - $ref: '#/components/parameters/limit'
        - $ref: '#/components/parameters/client_name'
        - $ref: '#/components/parameters/client_is_client'
        - $ref: '#/components/parameters/client_is_provider'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  clients:
                    type: array
                    items:
                      $ref: '#/components/schemas/ClientReduced'
                  total_count:
                    type: integer
                    example: 1
                  offset:
                    type: integer
                    example: 0
                  limit:
                    type: integer
                    example: 25
            application/xml:
              schema:
                type: object
                properties:
                  clients:
                    type: array
                    items:
                      $ref: '#/components/schemas/ClientReduced'
                  total_count:
                    type: integer
                    example: 1
                    xml:
                      attribute: true
                  offset:
                    type: integer
                    example: 0
                    xml:
                      attribute: true
                  limit:
                    type: integer
                    example: 25
                    xml:
                      attribute: true
                xml:
                  name: clients
              example: |
                <?xml version="1.0" encoding="UTF-8"?>
                <clients total_count="5024" offset="0" limit="25" type="array">
                  <client>
                      <id>1</id>
                      <taxcode>ESA13585625</taxcode>
                      <name>Client1</name>
                      <project id="32" name="b2brouter"/>
                      <edi_code></edi_code>
                      <created_at>2017-09-25T14:49:45Z</created_at>
                      <updated_at>2018-07-19T10:46:52Z</updated_at>
                      <phone/>
                  </client>
                  ...
                </clients>
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
        '404':
          description: Not found
      security:
        - api_key: []
    post:
      operationId: create-contact
      tags:
        - Contacts
      summary: Create a contact
      parameters:
        - $ref: '#/components/parameters/account'
        - $ref: '#/components/parameters/format'
      requestBody:
        description: The Contact object in format JSON to create
        content:
          application/json:
            schema:
              type: object
              properties:
                client:
                  oneOf:
                    - $ref: '#/components/schemas/ClientWithRequiredAttributes'
          application/xml:
            schema:
              type: object
              properties:
                client:
                  oneOf:
                    - $ref: '#/components/schemas/ClientWithRequiredAttributes'
      responses:
        '201':
          description: Contact has been created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClientWithRequiredAttributes'
        '422':
          description: The customer has not been created due to validation errors (the payload of the response contains the error message)
          content:
            application/json:
              example: |
                <?xml version="1.0" encoding="UTF-8"?>
                <errors type="array">
                  <error>VAT Id Number has already been taken</error>
                  <error>Language can't be blank</error>
                </errors>
      x-code-samples:
        - lang: PowerShell
          label: cURL
          source: |
            //example 1
            curl --location --request POST 'ttps://app-staging.b2brouter.net/projects/b2brouter-global/clients.xml' \
            --data-raw '<?xml version="1.0" encoding="UTF-8"?>
            <client>
                <name>Client2</name>
                <taxcode>59609346Q</taxcode>
                <language>en</language>
                <country>es</country>
                <payment_method>1</payment_method>
                <transport_type_code>es.efact</transport_type_code>
                <document_type_code>xml.facturae.3.2</document_type_code>
            </client>'
            //example 2
            curl --location --request POST 'https://app-staging.b2brouter.net/projects/b2brouter-global/clients.json' \
            --header 'Content-Type: application/json' \
            --data-raw '{
                "client": {
                    "name" : "Client2 SL",
                    "taxcode" : "ESB10317980",
                    "language" : "es",
                    "country": "es",
                    "payment_method": 1,
                    "transport_type_code": "es.efact",
                    "document_type_code": "xml.facturae.3.2",
                }
            }'
      security:
        - api_key: []
  /users/channels.{format}:
    get:
      operationId: get-channels
      tags:
        - Code lists
      summary: List available channels
      deprecated: true
      description: |
        DEPRECATED. Use /transport_types.json instead.

        Returns an array of channels / connections you can use to send or receive
        documents
      parameters:
        - $ref: '#/components/parameters/format'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  channels:
                    type: array
                    items:
                      $ref: '#/components/schemas/Channel'
            application/xml:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/Channel'
                xml:
                  name: channels
              example: |
                <?xml version="1.0" encoding="UTF-8"?>
                <channels type="array">
                    <channel>
                        <name>Email with a link to the Invoice</name>
                        <key>b2brouter</key>
                    </channel>
                    <channel>
                        <name>With XML attachment (XRechnung)</name>
                        <key>xml_by_mail_xrechnung</key>
                    </channel>
                    <channel>
                    ...
                </channels>
      x-code-samples:
        - lang: PowerShell
          label: cURL
          source: |
            curl https://app-staging.b2brouter.net/users/channels.json?key=xxxx
      security:
        - api_key: []
  /users/countries.{format}:
    get:
      operationId: get-countries
      tags:
        - Code lists
      summary: List countries
      description: Returns an array of countries where is available to use B2BRouter.
      parameters:
        - $ref: '#/components/parameters/format'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  countries:
                    type: array
                    items:
                      $ref: '#/components/schemas/Country'
            application/xml:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/Country'
                xml:
                  name: countries
              example: |
                <?xml version="1.0" encoding="UTF-8"?>
                <countries type="array">
                  <country>
                      <code>rs</code>
                      <name>Serbia</name>
                  </country>
                  ...
                </countries>
      x-code-samples:
        - lang: PowerShell
          label: cURL
          source: |
            curl https://app-staging.b2brouter.net/users/countries.json?key=api_key
      security:
        - api_key: []
  /users/schemes.{format}:
    get:
      operationId: get-schemes
      tags:
        - Code lists
      summary: List schemes
      description: Returns an array of available schemes to use.
      parameters:
        - $ref: '#/components/parameters/format'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  schemes:
                    type: array
                    items:
                      $ref: '#/components/schemas/Scheme'
      x-code-samples:
        - lang: PowerShell
          label: cURL
          source: |
            curl https://app-staging.b2brouter.net/users/schemes.json?key=api_key&country='es'
      security:
        - api_key: []
  /users/currencies.{format}:
    get:
      operationId: get-currencies
      tags:
        - Code lists
      summary: List of currencies
      description: Returns an array of available currencies
      parameters:
        - $ref: '#/components/parameters/format'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  currencies:
                    type: array
                    items:
                      $ref: '#/components/schemas/Currency'
            application/xml:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/Currency'
                xml:
                  name: currencies
              example: |
                <?xml version="1.0" encoding="UTF-8"?>
                <currencies type="array">
                  <currency>
                      <id:aed/>
                      <priority>100</priority>
                      <iso_code>AED</iso_code>
                      <name>United Arab Emirates Dirham</name>
                      <symbol>د.إ</symbol>
                      <subunit>Fils</subunit>
                      <subunit_to_unit>100</subunit_to_unit>
                      <symbol_first>false</symbol_first>
                      <html_entity></html_entity>
                      <decimal_mark>.</decimal_mark>
                      <thousands_separator>,</thousands_separator>
                      <iso_numeric>784</iso_numeric>
                  </currency>
                  ...
                </currencies>
      x-code-samples:
        - lang: PowerShell
          label: cURL
          source: |
            curl https://app-staging.b2brouter.net/users/currencies.json?key=xxxx
      security:
        - api_key: []
  /users/languages.{format}:
    get:
      operationId: get-languages
      tags:
        - Code lists
      summary: List of available languages
      description: Returns a list of all available languages in b2brouter.
      parameters:
        - $ref: '#/components/parameters/format'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  languages:
                    type: array
                    items:
                      $ref: '#/components/schemas/Language'
            application/xml:
              schema:
                type: object
                properties:
                  languages:
                    type: array
                    items:
                      $ref: '#/components/schemas/Language'
                xml:
                  name: languages
              example: |
                <?xml version="1.0" encoding="UTF-8"?>
                <languages type="array">
                    <language>
                        <code:en/>
                        <name>English</name>
                    </language>
                    <language>
                        <code:fr/>
                        <name>Français</name>
                    </language>
                    ...
                </languages>
      x-code-samples:
        - lang: PowerShell
          label: cURL
          source: |
            curl https://app-staging.b2brouter.net/users/languages.json?key=xxxx
      security:
        - api_key: []
  /document_types.{format}:
    get:
      operationId: get-document-types
      tags:
        - Code lists
      summary: List of available document types
      description: Returns a list of all available document types in b2brouter.
      parameters:
        - $ref: '#/components/parameters/format'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  document_types:
                    type: array
                    items:
                      $ref: '#/components/schemas/DocumentType'
            application/xml:
              schema:
                type: object
                properties:
                  document_types:
                    type: array
                    items:
                      $ref: '#/components/schemas/DocumentType'
                xml:
                  name: languages
              example: |
                <?xml version="1.0" encoding="UTF-8"?>
                <document_types type="array">
                    <document_type>
                        <code>csv.anvolia.invoice</code>
                        <name>CSV ANVOLIA Invoice</name>
                        <document>Invoice</document>
                        <can_export>false</can_export>
                        <can_import>true</can_import>
                    </document_type>
                    ...
                </document_types>
      x-code-samples:
        - lang: PowerShell
          label: cURL
          source: |
            curl https://app-staging.b2brouter.net/document_types.json
      security:
        - api_key: []
  /transport_types.{format}:
    get:
      operationId: get-transport-types
      tags:
        - Code lists
      summary: List of available transport types
      description: Returns a list of all available transport types in b2brouter.
      parameters:
        - $ref: '#/components/parameters/format'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  transport_types:
                    type: array
                    items:
                      $ref: '#/components/schemas/TransportType'
            application/xml:
              schema:
                type: object
                properties:
                  transport_types:
                    type: array
                    items:
                      $ref: '#/components/schemas/TransportType'
                xml:
                  name: languages
              example: |
                <?xml version="1.0" encoding="UTF-8"?>
                <transport_types type="array">
                    <transport_type>
                        <code>ad.govern</code>
                        <name>Govern d'Andorra</name>
                        <exportable_document_types>
                          <xml.ubl.credit_note.bis2/>
                          <xml.ubl.invoice.bis2/>
                        </exportable_document_types>
                        <importable_document_types/>
                        <default_document_type/>
                        <category>pge</category>
                        <country>ad</country>
                        <test_available>true</test_available>
                    </transport_type>
                    ...
                </transport_types>
      x-code-samples:
        - lang: PowerShell
          label: cURL
          source: |
            curl https://app-staging.b2brouter.net/transport_types.json
      security:
        - api_key: []
  /users/invoice_states.{format}:
    get:
      operationId: get-invoice-states
      tags:
        - Code lists
      summary: List of available invoice status
      description: Return an array of all available states of invoice.
      parameters:
        - $ref: '#/components/parameters/format'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  invoice_states:
                    type: array
                    items:
                      $ref: '#/components/schemas/InvoiceState'
            application/xml:
              schema:
                type: object
                properties:
                  invoice_states:
                    type: array
                    items:
                      $ref: '#/components/schemas/InvoiceState'
              example: |
                <?xml version="1.0" encoding="UTF-8"?>
                <invoice_states type="array">
                  <state>
                      <state:new/>
                      <name>New</name>
                  </state>
                  <state>
                      <state:sent/>
                      <name>Sent</name>
                  </state>
                  ...
                </invoice_states>
      x-code-samples:
        - lang: PowerShell
          label: cURL
          source: |
            curl https://app-staging.b2brouter.net/users/invoice_states.json?key=xxxx
      security:
        - api_key: []
  /projects/{account}/events.{format}:
    get:
      operationId: get-events
      tags:
        - Events
      summary: List of events
      description: Returns a paginated list of the events of a project.
      parameters:
        - $ref: '#/components/parameters/account'
        - $ref: '#/components/parameters/format'
        - $ref: '#/components/parameters/offset'
        - $ref: '#/components/parameters/limit'
        - $ref: '#/components/parameters/invoice_id_query'
        - $ref: '#/components/parameters/tax_report_id_query'
        - $ref: '#/components/parameters/date_from'
        - $ref: '#/components/parameters/date_to'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  events:
                    type: array
                    items:
                      anyOf:
                        - $ref: '#/components/schemas/InvoiceEvent'
                        - $ref: '#/components/schemas/ClientEvent'
                  total_count:
                    type: integer
                    example: 1
                  offset:
                    type: integer
                    example: 0
                  limit:
                    type: integer
                    example: 25
            application/xml:
              schema:
                type: object
                properties:
                  events:
                    type: array
                    items:
                      anyOf:
                        - $ref: '#/components/schemas/InvoiceEvent'
                        - $ref: '#/components/schemas/ClientEvent'
                  total_count:
                    type: integer
                    example: 1
                    xml:
                      attribute: true
                  offset:
                    type: integer
                    example: 0
                    xml:
                      attribute: true
                  limit:
                    type: integer
                    example: 25
                    xml:
                      attribute: true
                xml:
                  name: events
              example: |
                <?xml version="1.0" encoding="UTF-8"?>
                <events total_count="1" offset="0" limit="25" type="array">
                    <event>
                        <name>delivered_notification</name>
                        <invoice>
                            <id>3429787</id>
                            <number>32</number>
                            <state>registered</state>
                            <state_updated_at>2019-12-12T09:24:21Z</state_updated_at>
                        </invoice>
                        <text>Notification: Sent invoice</text>
                        <description>Notification: Sent invoice\n<a href=\"/events/file/2305470\">Download notification</a>\n</description>
                        <created_at>2019-12-12T09:24:21Z</created_at>
                        <updated_at>2019-12-12T09:24:21Z</updated_at>
                    </event>
                </events>
      x-code-samples:
        - lang: PowerShell
          label: cURL
          source: |
            curl https://app-staging.b2brouter.net/projects/b2brouter/events.json?key=xxxx
      security:
        - api_key: []
  /projects/{account}/tax_reports.{format}:
    get:
      operationId: get-tax-reports
      tags:
        - Tax Reports
      summary: List tax reports
      description: |-
        Returns a paginated list of the actual tax reports or a summary of their status.
        You have to check the status of the tax report that we send in your behalf in order to be able to take the necessary actions in case any error or warning is issued by the Tax Authority. Because of the asynchronous nature of the tax report sending process, there is no guarantee that when you check the status of the tax reports it will already have the response of the Tax Authority. It usually takes a few seconds to complete the transaction. You will know that the transaction is complete if the response of the check of the status of the tax report has an status **registered** or **error**. We recommend you retry the status check until you get a final state on your tax report.
        The format **json** returns the state of the tax report, along with other useful information (which depends on the kind of tax report you are sending), such as the timestamp of the sending process, the response of the Tax Authority, etc ...
        The format **xml** returns the actual file of the tax report that have been sent to the Tax Authority.
      parameters:
        - $ref: '#/components/parameters/account'
        - $ref: '#/components/parameters/format'
        - $ref: '#/components/parameters/offset'
        - $ref: '#/components/parameters/limit'
        - $ref: '#/components/parameters/invoice_id_query'
        - $ref: '#/components/parameters/sent_at_from'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  tax_reports:
                    type: array
                    items:
                      $ref: '#/components/schemas/TaxReport'
                  total_count:
                    type: integer
                    example: 1
                  offset:
                    type: integer
                    example: 0
                  limit:
                    type: integer
                    example: 25
            application/xml:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/TaxReport'
                  total_count:
                    type: integer
                    example: 1
                    xml:
                      attribute: true
                  offset:
                    type: integer
                    example: 0
                    xml:
                      attribute: true
                  limit:
                    type: integer
                    example: 25
                    xml:
                      attribute: true
                xml:
                  name: tax_reports
      security:
        - api_key: []
  /accounts/{account}/transports:
    get:
      operationId: get-transports
      tags:
        - Transports
      summary: List configured transports
      description: This endpoint list all transports this account has configured.
      parameters:
        - $ref: '#/components/parameters/account'
        - $ref: '#/components/parameters/offset'
        - $ref: '#/components/parameters/limit'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  transports:
                    type: array
                    items:
                      anyOf:
                        - $ref: '#/components/schemas/TransportB2brouter'
                        - $ref: '#/components/schemas/TransportEmail'
                        - $ref: '#/components/schemas/TransportPeppol'
                        - $ref: '#/components/schemas/TransportUserPassword'
                        - $ref: '#/components/schemas/TransportEdi'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
      security:
        - api_key: []
    post:
      operationId: create-transport
      tags:
        - Transports
      summary: Create a transport configuration
      description: 'Some transport types needs configuration. Configurable transport types are: b2brouter, email, peppol, es.pecam, es.eusko_jaurlaritza, edicom, ediversa.'
      parameters:
        - $ref: '#/components/parameters/account'
      requestBody:
        description: The transport configuration to create
        content:
          application/json:
            schema:
              type: object
              required:
                - transport
              properties:
                transport:
                  oneOf:
                    - allOf:
                        - $ref: '#/components/schemas/TransportB2brouter'
                        - required:
                            - code
                    - allOf:
                        - $ref: '#/components/schemas/TransportEmail'
                        - required:
                            - code
                    - allOf:
                        - $ref: '#/components/schemas/TransportPeppol'
                        - required:
                            - code
                            - pin_scheme
                            - pin_value
                    - allOf:
                        - $ref: '#/components/schemas/TransportUserPassword'
                        - required:
                            - code
                            - username
                            - password
                    - allOf:
                        - $ref: '#/components/schemas/TransportEdi'
                        - required:
                            - code
                            - username
                            - password
                            - edi_identifier
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  transport:
                    oneOf:
                      - $ref: '#/components/schemas/TransportB2brouter'
                      - $ref: '#/components/schemas/TransportEmail'
                      - $ref: '#/components/schemas/TransportPeppol'
                      - $ref: '#/components/schemas/TransportUserPassword'
                      - $ref: '#/components/schemas/TransportEdi'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '442':
          $ref: '#/components/responses/UnprocessableEntity'
      security:
        - api_key: []
  /accounts/{account}/transports/{code}:
    get:
      operationId: get-transport
      tags:
        - Transports
      summary: Retrieve a transport configuration
      parameters:
        - $ref: '#/components/parameters/account'
        - $ref: '#/components/parameters/transport_type_code'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                required:
                  - transport
                properties:
                  transport:
                    anyOf:
                      - $ref: '#/components/schemas/TransportB2brouter'
                      - $ref: '#/components/schemas/TransportEmail'
                      - $ref: '#/components/schemas/TransportPeppol'
                      - $ref: '#/components/schemas/TransportUserPassword'
                      - $ref: '#/components/schemas/TransportEdi'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '442':
          $ref: '#/components/responses/UnprocessableEntity'
      security:
        - api_key: []
    put:
      operationId: put-transport
      tags:
        - Transports
      summary: Update a transport configuration
      description: |
        This endpoint updates a transport configuration associated with an account.
      parameters:
        - $ref: '#/components/parameters/account'
        - $ref: '#/components/parameters/transport_type_code'
      requestBody:
        description: The transport configuration to update
        content:
          application/json:
            schema:
              type: object
              required:
                - transport
              properties:
                transport:
                  anyOf:
                    - $ref: '#/components/schemas/TransportB2brouter'
                    - $ref: '#/components/schemas/TransportEmail'
                    - $ref: '#/components/schemas/TransportPeppol'
                    - $ref: '#/components/schemas/TransportUserPassword'
                    - $ref: '#/components/schemas/TransportEdi'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  transport:
                    oneOf:
                      - $ref: '#/components/schemas/TransportB2brouter'
                      - $ref: '#/components/schemas/TransportEmail'
                      - $ref: '#/components/schemas/TransportPeppol'
                      - $ref: '#/components/schemas/TransportUserPassword'
                      - $ref: '#/components/schemas/TransportEdi'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '442':
          $ref: '#/components/responses/UnprocessableEntity'
      security:
        - api_key: []
    delete:
      operationId: delete-transport
      tags:
        - Transports
      summary: Delete a transport configuration
      description: This endpoint deletes a transport configuration associated with an account.
      parameters:
        - $ref: '#/components/parameters/account'
        - $ref: '#/components/parameters/transport_type_code'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  transport:
                    properties:
                      code:
                        type: string
                        example: peppol
                        description: Code of the transport configuration
                      deleted:
                        type: boolean
                        example: true
                        description: Indicates if the transport configuration was deleted
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '442':
          $ref: '#/components/responses/UnprocessableEntity'
      security:
        - api_key: []
  /tax_reports/{id}.{format}:
    get:
      operationId: get-tax-report
      tags:
        - Tax Reports
      summary: Get a tax report
      description: |-
        Returns a tax report or a summary of its status
        You have to check the status of the tax report that we send in your behalf in order to be able to take the necessary actions in case any error or warning is issued by the Tax Authority. Because of the asynchronous nature of the tax report sending process, there is no guarantee that when you check the status of the tax reports it will already have the response of the Tax Authority. It usually takes a few seconds to complete the transaction. You will know that the transaction is complete if the response of the check of the status of the tax report has an status **registered** or **error**. We recommend you retry the status check until you get a final state on your tax report.
        The format **json** returns the state of the tax report, along with other useful information (which depends on the kind of tax report you are sending), such as the timestamp of the sending process, the response of the Tax Authority, etc ...
        The format **xml** returns the actual file of the tax report that have been sent to the Tax Authority.
      parameters:
        - $ref: '#/components/parameters/tax_report_id'
        - $ref: '#/components/parameters/format'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  tax_report:
                    $ref: '#/components/schemas/TaxReport'
        '403':
          description: Unauthorized
        '404':
          description: Tax Report not found
      security:
        - api_key: []
  /tax_reports/{id}/annullate.json:
    post:
      operationId: annulate-tax-report
      tags:
        - Tax Reports
      summary: Annulates a tax report
      description: Annulates a TaxReport
      parameters:
        - $ref: '#/components/parameters/tax_report_id'
      responses:
        '204':
          description: Successful annulation
        '403':
          description: Unauthorized
        '404':
          description: Tax Report not found
        '422':
          description: Tax Report cannot be annulled
      security:
        - api_key: []
  /tax_reports/send_tax_report/{id}.json:
    post:
      operationId: send-tax-report
      tags:
        - Tax Reports
      summary: Send a tax report
      description: Depends on the tax authority and the settings of your account, the tax report could be sent automatically.
      parameters:
        - $ref: '#/components/parameters/tax_report_id'
      responses:
        '200':
          description: Successful operation
        '422':
          description: Unprocessable Entity
      security:
        - api_key: []
      x-code-samples:
        - lang: PowerShell
          label: cURL
          source: curl -X POST htps://app-staging.b2brouter.net/tax_reports/send_tax_report/6542.json
  /tax_reports/{id}/as/{document_type_code}:
    get:
      operationId: get-tax-report-with-document-type
      tags:
        - Tax Reports
      summary: Get the TaxReport with the specified document type
      description: Get the TaxReport with the specified document type
      parameters:
        - $ref: '#/components/parameters/tax_report_id'
        - $ref: '#/components/parameters/tax_report_document_type_code'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  tax_report:
                    $ref: '#/components/schemas/TaxReport'
        '403':
          description: Unauthorized
        '404':
          description: Tax Report not found
      security:
        - api_key: []
  /tax_reports/{id}/download.{format}:
    get:
      operationId: download-tax-report
      tags:
        - Tax Reports
      summary: Download the tax report
      description: Download the TaxReport
      parameters:
        - $ref: '#/components/parameters/tax_report_id'
        - $ref: '#/components/parameters/tax_report_format'
      responses:
        '200':
          description: OK
          content:
            application/xml:
              schema:
                type: object
                properties:
                  tax_report:
                    $ref: '#/components/schemas/TaxReport'
            image/png:
              schema:
                type: object
                properties:
                  tax_report:
                    $ref: '#/components/schemas/TaxReport'
        '403':
          description: Unauthorized
        '404':
          description: Tax Report not found
      security:
        - api_key: []
  /api/v1/accounts/{account}/tax_reports:
    get:
      operationId: new-get-tax-reports
      tags:
        - Tax Reports
      summary: '[BETA][New Tax Report API] List tax reports'
      description: '[BETA][New Tax Report API] Returns a paginated list of tax reports.'
      parameters:
        - $ref: '#/components/parameters/account'
        - $ref: '#/components/parameters/offset'
        - $ref: '#/components/parameters/limit'
        - $ref: '#/components/parameters/invoice_id_query'
        - $ref: '#/components/parameters/sent_at_from'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  tax_reports:
                    type: array
                    items:
                      $ref: '#/components/schemas/NewTaxReport'
                  total_count:
                    type: integer
                    example: 1
                  offset:
                    type: integer
                    example: 0
                  limit:
                    type: integer
                    example: 25
      security:
        - api_key: []
    post:
      operationId: new-create-tax-report
      tags:
        - Tax Reports
      summary: '[BETA][New Tax Report API] Create a Tax Report'
      description: |-
        [BETA][New Tax Report API] Creates a Tax Report.
        If the creation of the Tax Report is successful, the response of this action will already contain the QR code and the identifier for the Tax Report.
        However, you have to check the status of the tax report that we send in your behalf in order to be able to take the necessary actions in case any error or warning is issued by the Tax Authority. Because of the asynchronous nature of the tax report sending process, there is no guarantee that when you check the status of the tax reports it will already have the response of the Tax Authority. It usually takes a few seconds to complete the transaction. You will know that the transaction is complete if the response of the check of the status of the tax report has an status **registered**, **registered_with_errors***, or **error**. We recommend you retry the status check until you get a final state on your tax report, or that you configure [WebHooks](https://developer.b2brouter.net/reference/getnewtaxreportstatechange) for tax report state changes.
      parameters:
        - $ref: '#/components/parameters/account'
      requestBody:
        description: The Tax Report object in JSON format
        content:
          application/json:
            schema:
              type: object
              required:
                - tax_report
              properties:
                tax_report:
                  type: object
                  allOf:
                    - $ref: '#/components/schemas/NewTaxReport'
                    - type: object
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  tax_report:
                    $ref: '#/components/schemas/NewTaxReport'
        '403':
          description: Unauthorized
        '422':
          description: Unprocessable Entity.
      security:
        - api_key: []
  /api/v1/accounts/{account}/tax_reports/import:
    post:
      operationId: new-import-tax-report
      tags:
        - Tax Reports
      summary: '[BETA][New Tax Report API] Import a Tax Report from an XML file'
      description: |-
        [BETA][New Tax Report API] Import a Tax Report from an XML file
        If the creation of the Tax Report is successful, the response of this action will already contain the QR code and the identifier for the Tax Report. Note that if the XML file has chaining information (eg Huella for VeriFactu), this information will be ignored and our system will perform the chaining process regardless. This is the only way to ensure the integrity of the data sent to the Tax Authority.
        Remember that you have to check the status of the tax report that we send in your behalf in order to be able to take the necessary actions in case any error or warning is issued by the Tax Authority. Because of the asynchronous nature of the tax report sending process, there is no guarantee that when you check the status of the tax reports it will already have the response of the Tax Authority. It usually takes a few seconds to complete the transaction. You will know that the transaction is complete if the response of the check of the status of the tax report has an status **registered**, **registered_with_errors***, or **error**. We recommend you retry the status check until you get a final state on your tax report, or that you configure [WebHooks](https://developer.b2brouter.net/reference/getnewtaxreportstatechange) for tax report state changes.
      parameters:
        - $ref: '#/components/parameters/account'
      requestBody:
        description: The Tax Report XML file to import
        content:
          application/octet-stream:
            schema:
              type: string
              format: binary
      responses:
        '201':
          description: Tax Report has been created
          content:
            application/json:
              schema:
                type: object
                properties:
                  tax_report:
                    $ref: '#/components/schemas/NewTaxReport'
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
        '406':
          description: Not Acceptable
      security:
        - api_key: []
  /api/v1/tax_reports/{id}.{format}:
    get:
      operationId: new-get-tax-report
      tags:
        - Tax Reports
      summary: '[BETA][New Tax Report API] Get a tax report'
      description: |-
        [BETA][New Tax Report API] Returns a tax report
        You have to check the status of the tax report that we send in your behalf in order to be able to take the necessary actions in case any error or warning is issued by the Tax Authority. Because of the asynchronous nature of the tax report sending process, there is no guarantee that when you check the status of the tax reports it will already have the response of the Tax Authority. It usually takes a few seconds to complete the transaction. You will know that the transaction is complete if the response of the check of the status of the tax report has an status **registered** or **error**. We recommend you retry the status check until you get a final state on your tax report or you configure [WebHooks](https://developer.b2brouter.net/reference/getnewTaxReportstatechange) for tax report state changes.
      parameters:
        - $ref: '#/components/parameters/tax_report_id'
        - $ref: '#/components/parameters/format'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  tax_report:
                    $ref: '#/components/schemas/NewTaxReport'
        '403':
          description: Unauthorized
        '404':
          description: Tax Report not found
      security:
        - api_key: []
    patch:
      operationId: new-modify-tax-report
      tags:
        - Tax Reports
      summary: '[BETA][New Tax Report API] Correct or Modify a Tax Report'
      description: |-
        [BETA][New Tax Report API] Correct or Modify a Tax Report
        If the tax report has already been registered by the Tax Authority, issue a correction ("subsanación" as it's call in Verifactu) of the tax report with the data provided in body.
        If the report has not been sent to the Tax Authority, change the fields indicated in the payload.
      parameters:
        - $ref: '#/components/parameters/tax_report_id'
        - $ref: '#/components/parameters/format'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  tax_report:
                    $ref: '#/components/schemas/NewTaxReport'
        '403':
          description: Unauthorized
        '404':
          description: Tax Report not found
        '422':
          description: Invalid Tax Report
      security:
        - api_key: []
    delete:
      operationId: new-annulate-tax-report
      tags:
        - Tax Reports
      summary: '[BETA][New Tax Report API] Annulates a tax report'
      description: '[BETA][New Tax Report API] Annulates a TaxReport'
      parameters:
        - $ref: '#/components/parameters/tax_report_id'
        - $ref: '#/components/parameters/format'
      responses:
        '204':
          description: Successful annulation
        '403':
          description: Unauthorized
        '404':
          description: Tax Report not found
        '422':
          description: Tax Report cannot be annulled
      security:
        - api_key: []
  /api/v1/tax_reports/{id}/download:
    get:
      operationId: new-download-tax-report
      tags:
        - Tax Reports
      summary: '[BETA][New Tax Report API] Download a tax report'
      description: |-
        [BETA][New Tax Report API] Download a tax report in the format that is sent to the Tax Authority.
        Note that if the Tax Authority requires the tax report to be cleared (such as in Zatca) or chained (such as in Verifactu and TicketBAI) the XML will only contain all the information after the tax report is chained or cleared. Given the the asynchronous nature of this process, there is no guarantee  that when you download the tax reports will be prepared. This process usually only takes a few seconds.
      parameters:
        - $ref: '#/components/parameters/tax_report_id'
      responses:
        '200':
          description: OK
          content:
            application/xml:
              schema:
                type: object
                properties:
                  tax_report:
                    $ref: '#/components/schemas/NewTaxReport'
        '403':
          description: Unauthorized
        '404':
          description: Tax Report not found
      security:
        - api_key: []
  /api/v1/ledgers/{id}/download:
    get:
      operationId: download-ledger
      tags:
        - Ledgers
      summary: '[BETA][New Tax Report API] Download a Ledger'
      description: |-
        [BETA][New Tax Report API] Download a Ledger, the XML document sent to the Tax Authority.
        Note that sending the ledger to the Tax Authority is an asynchronous  process. No ledger can be downloaded until all tax reports in the ledger have been chained,
      parameters:
        - $ref: '#/components/parameters/ledger_id'
      responses:
        '200':
          description: OK
          content:
            application/xml:
              schema:
                type: object
        '403':
          description: Unauthorized
        '404':
          description: Tax Report not found
      security:
        - api_key: []
  /api/v1/ledgers/{id}/download_response:
    get:
      operationId: download-response-ledger
      tags:
        - Ledgers
      summary: '[BETA][New Tax Report API] Download the response for a Ledger'
      description: |-
        [BETA][New Tax Report API] Download the response from the Tax Authority for a Ledger.
        Note that sending the ledger to the Tax Authority is an asynchronous process. No response can be downloaded until B2Brouter receives it from the Tax Authority.
      parameters:
        - $ref: '#/components/parameters/ledger_id'
      responses:
        '200':
          description: OK
          content:
            application/xml:
              schema:
                type: object
        '403':
          description: Unauthorized
        '404':
          description: Tax Report not found
      security:
        - api_key: []
  /api/v1/directory/{country}/{scheme}/{id}.json:
    get:
      operationId: lookup-directory-by-country-and-scheme
      tags:
        - Lookup
      summary: Show company from Directory (by country and scheme codes)
      description: Return the information about specified company that lists in our Directory
      parameters:
        - $ref: '#/components/parameters/directory_country'
        - $ref: '#/components/parameters/directory_scheme'
        - $ref: '#/components/parameters/directory_id'
      responses:
        '200':
          description: Returns specified company from directory
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExternalCompany'
        '401':
          description: Unauthorized
        '404':
          description: Company not found
      x-code-samples:
        - lang: PowerShell
          label: cURL
          source: |
            // Using all params
            curl https://app-staging.b2brouter.net/api/v1/es/9920/ESP2807900B.json
            // Without scheme
            curl https://app-staging.b2brouter.net/api/v1/es/ESP2807900B.json
            // Without XIN prefix in ID
            curl https://app-staging.b2brouter.net/api/v1/es/P2807900B.json
      security:
        - api_key: []
  /api/v1/directory/{scheme}/{id}.json:
    get:
      operationId: lookup-directory-by-scheme
      tags:
        - Lookup
      summary: Show company from Directory (by scheme code)
      description: Return the information about specified company that lists in our Directory
      parameters:
        - $ref: '#/components/parameters/directory_scheme'
        - $ref: '#/components/parameters/directory_id'
      responses:
        '200':
          description: Returns specified company from directory
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExternalCompany'
        '401':
          description: Unauthorized
        '404':
          description: Company not found
      security:
        - api_key: []
  /api/v1/directory/{country}/{id}.json:
    get:
      operationId: lookup-directory-by-country
      tags:
        - Lookup
      summary: Show company from Directory (by country code)
      description: Return the information about specified company that lists in our Directory
      parameters:
        - $ref: '#/components/parameters/directory_country'
        - $ref: '#/components/parameters/directory_id'
      responses:
        '200':
          description: Returns specified company from directory
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExternalCompany'
        '401':
          description: Unauthorized
        '404':
          description: Company not found
      security:
        - api_key: []
  /documents/validate:
    post:
      operationId: validate-document
      tags:
        - Validation
      summary: Validates an electronic document
      description: |
        This endpoint validates a single electronic document provided in the request body. 

        The validation of the e-document is performed through:

        - Checking the use of a correct syntax schema (XSD).
        - Checking the business rules depending on the document type (Schematron).

        The following formats can be validated:
        - UBL (Universal Business Language)
        - CII (Cross Industry Invoice)
        - Peppol BIS
        - PINT (JP, SG, MY, AUNZ)
        - ZUGFeRD
        - XRechnung
        - Factur-X
        - FacturaE
        - Svefaktura
        - Fattura PA
        - eSPap
        - Any EN16931 CIUS-compliant format
      requestBody:
        description: The document file to validate.
        required: true
        content:
          application/octet-stream:
            schema:
              type: string
              format: binary
          text/plain:
            schema:
              type: string
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DocumentValidation'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
      security:
        - api_key: []
components:
  securitySchemes:
    api_key:
      type: apiKey
      description: API Key of your account
      name: X-B2B-API-Key
      in: header
  parameters:
    offset:
      name: offset
      description: Jump to the first object.
      in: query
      required: false
      schema:
        type: integer
        default: 0
        example: 0
    limit:
      name: limit
      description: Number of items in the response (500 maximum)
      in: query
      required: false
      schema:
        type: integer
        default: 25
        example: 25
    account:
      name: account
      in: path
      description: ID of account
      required: true
      schema:
        type: string
      example: my-account
    bank_account_id:
      name: id
      description: A unique internal identifier of the bank account in B2Brouter.
      in: path
      required: true
      schema:
        type: integer
        example: 123
    tax_authority_code:
      name: code
      description: Code of tax report setting
      in: path
      required: true
      schema:
        type: string
        example: tbai
        enum:
          - tbai
          - sdi
          - lhdn
    format:
      name: format
      description: |
        Format

        The format of the API response can be either JSON or XML.
      in: path
      required: true
      schema:
        type: string
        enum:
          - json
          - xml
        example: json
    invoice_id:
      name: id
      in: path
      description: |
        An internal identifier that is unique to each **Invoice** within B2Brouter.
      required: true
      example: 4053100
      schema:
        type: integer
    include:
      name: include
      in: query
      description: If you want to get the associations with the entities, this has to be explicitly specified. If you need more details about the lines, use "detailed_lines"
      schema:
        type: string
        enum:
          - lines
          - detailed_lines
      example: lines
    disposition:
      name: disposition
      in: query
      description: In PDF, view the PDF file instead of downloading
      schema:
        type: string
        enum:
          - inline
        example: inline
    document_type_code:
      name: document_type_code
      in: path
      description: |
        An internal identifier that is unique to each **Document Type** within
        B2Brouter.<br> You can get all valid document type codes using the **Document
        Types** endpoint (`/users/document_types.{format}`).
        If you want to obtain the submitted format, use `original`.
      required: true
      example: xml.facturae.3.2
      schema:
        $ref: '#/components/schemas/DocumentTypeCode'
    ack:
      name: ack
      in: query
      description: Filter documents with ACK.
      required: false
      schema:
        type: boolean
      example: true
    date_from:
      name: date_from
      in: query
      description: Filter from submission date.
      required: false
      schema:
        type: string
        format: date
      example: '2024-09-12'
    date_to:
      name: date_to
      in: query
      description: Filter to submission date
      required: false
      schema:
        type: string
        format: date
      example: '2024-09-12'
    due_date_from:
      name: due_date_from
      in: query
      description: Filter from due date
      required: false
      schema:
        type: string
        format: date
      example: '2024-09-12'
    due_date_to:
      name: due_date_to
      in: query
      description: Filter to due date
      required: false
      schema:
        type: string
        format: date
      example: '2024-09-12'
    number:
      name: number
      in: query
      description: Filter on invoice number. Use as a string search, for example, searching "00" lists all the invoices containing "00" in the invoice number
      required: false
      schema:
        type: string
      example: '00'
    state_updated_at_from:
      name: state_updated_at_from
      in: query
      description: Filter on change status date. Invoices with change status date later than the specified date are returned
      required: false
      schema:
        type: string
        format: date
      example: '2024-09-12'
    taxcode:
      name: taxcode
      in: query
      description: Filter on customer VAT code
      required: false
      schema:
        type: string
      example: ESP2807900B
    new:
      name: new
      description: Filter on invoice status "new". Created and ready to be sent
      in: query
      required: false
      schema:
        type: integer
        minimum: 0
        maximum: 1
        enum:
          - 0
          - 1
        example: 1
    sending:
      name: sending
      description: Filter on invoice status "sending". Invoice is being sent
      in: query
      required: false
      schema:
        type: integer
        minimum: 0
        maximum: 1
        enum:
          - 0
          - 1
        example: 1
    error:
      name: error
      description: Filter on invoice status "error". An error has been raised when sending the invoice to its recipient
      in: query
      required: false
      schema:
        type: integer
        minimum: 0
        maximum: 1
        enum:
          - 0
          - 1
        example: 1
    discarded:
      name: discarded
      description: Filter on invoice status "discarded". Maximum number of submission retries reached
      in: query
      deprecated: true
      required: false
      schema:
        type: integer
        minimum: 0
        maximum: 1
        enum:
          - 0
          - 1
        example: 1
    sent:
      name: sent
      description: Filter on invoice status "sent". Successfully sent to its recipient
      in: query
      required: false
      schema:
        type: integer
        minimum: 0
        maximum: 1
        enum:
          - 0
          - 1
        example: 1
    refused:
      name: refused
      description: Filter on invoice status "refused". The recipient has refused the invoice. Usually, the reason for the rejection is provided
      in: query
      required: false
      schema:
        type: integer
        minimum: 0
        maximum: 1
        enum:
          - 0
          - 1
        example: 1
    closed:
      name: closed
      description: Filter on invoice status "closed". The sender considers that the invoice is closed and does not want to perform further operations
      in: query
      required: false
      schema:
        type: integer
        minimum: 0
        maximum: 1
        enum:
          - 0
          - 1
        example: 1
    registered:
      name: registered
      description: Filter on invoice status "registered". The receiver has registered the invoice. Some receivers may indicate a registration number
      in: query
      required: false
      schema:
        type: integer
        minimum: 0
        maximum: 1
        enum:
          - 0
          - 1
        example: 1
    accepted:
      name: accepted
      description: Filter on invoice status "accepted". The receiver has accepted the invoice
      in: query
      required: false
      schema:
        type: integer
        minimum: 0
        maximum: 1
        enum:
          - 0
          - 1
        example: 1
    allegedly_paid:
      name: allegedly_paid
      description: Filter on invoice status "allegedly_paid". The receiver has indicated that he has ordered the payment of the invoice
      in: query
      required: false
      schema:
        type: integer
        minimum: 0
        maximum: 1
        enum:
          - 0
          - 1
        example: 1
    received_invoice_new:
      name: new
      description: Filter on received invoices with status "new".
      in: query
      required: false
      schema:
        type: integer
        minimum: 0
        maximum: 1
        enum:
          - 0
          - 1
        example: 1
    received_invoice_received:
      name: received
      description: Filter on received invoices with status "received".
      in: query
      required: false
      schema:
        type: integer
        minimum: 0
        maximum: 1
        enum:
          - 0
          - 1
        example: 1
    received_invoice_error:
      name: error
      description: Filter on received invoices with status "error".
      in: query
      required: false
      schema:
        type: integer
        minimum: 0
        maximum: 1
        enum:
          - 0
          - 1
        example: 1
    received_invoice_discarded:
      name: discarded
      description: Filter on received invoices with status "discarded".
      in: query
      required: false
      deprecated: true
      schema:
        type: integer
        minimum: 0
        maximum: 1
        enum:
          - 0
          - 1
        example: 1
    received_invoice_paid:
      name: paid
      description: Filter on received invoices with status "paid".
      in: query
      required: false
      schema:
        type: integer
        minimum: 0
        maximum: 1
        enum:
          - 0
          - 1
        example: 1
    received_invoice_refused:
      name: refused
      description: Filter on received invoices with status "refused".
      in: query
      required: false
      schema:
        type: integer
        minimum: 0
        maximum: 1
        enum:
          - 0
          - 1
        example: 1
    received_invoice_invalid:
      name: closed
      description: Filter on received invoices with status "invalid".
      in: query
      required: false
      schema:
        type: integer
        minimum: 0
        maximum: 1
        enum:
          - 0
          - 1
        example: 1
    received_invoice_ocr_failed:
      name: ocr_failed
      description: Filter on received invoices with status "ocr_failed".
      in: query
      required: false
      schema:
        type: integer
        minimum: 0
        maximum: 1
        enum:
          - 0
          - 1
        example: 1
    received_invoice_accepted:
      name: accepted
      description: Filter on received invoices with status "accepted".
      in: query
      required: false
      schema:
        type: integer
        minimum: 0
        maximum: 1
        enum:
          - 0
          - 1
        example: 1
    received_invoice_exclude_offices:
      name: exclude_offices
      description: Do not show the invoices of the Organizational Units.
      in: query
      required: false
      schema:
        type: integer
        minimum: 0
        maximum: 1
        enum:
          - 0
          - 1
        example: 1
    from_net:
      name: from_net
      in: query
      description: Filter on received invoice from net value. Use as a string search, for example, searching "api" lists all the received invoices that are received via API.
      required: false
      schema:
        type: string
      example: api
    send_after_import:
      name: send_after_import
      in: query
      description: |
        A flag to indicate if the invoice should be sent after import. It will only send the invoice if it passes all the validations.
        **Note:** This option is incompatible with the custom signature configuration.
      required: false
      schema:
        $ref: '#/components/schemas/SendAfterImport'
    issued:
      name: issued
      in: query
      description: |
        A flag that specifies whether the invoice to be imported is issued or received.
      required: false
      schema:
        type: boolean
        default: null
    filename:
      name: filename
      in: query
      description: |
        Name of the attachment.
      required: true
      example: test.pdf
      schema:
        type: string
    use_as_pdf_view:
      name: use_as_pdf_view
      in: query
      description: |
        Boolean to indicate that the uploaded PDF attachment should be used as the visual component 
        when generating a hybrid PDF (such as a ZUGFeRD document) or any legal PDF representation.
        When set to true, this attachment will be considered the legal PDF to display or embed, 
        instead of regenerating one from the invoice data. It can be used both for PDF deliveries 
        and for embedding XML (e.g., ZUGFeRD) into the provided PDF.

        NOTICE: If the invoice is modified after this PDF has been uploaded, the attachment will still be used as-is, unless explicitly replaced. 
        B2Brouter treats it as the legal representation provided by the account.
      required: false
      example: true
      schema:
        type: boolean
    order_id:
      name: id
      in: path
      description: A unique internal identifier of the **Order** in B2Brouter.
      required: true
      example: 4053100
      schema:
        $ref: '#/components/schemas/OrderId'
    order_format:
      name: format
      description: Format of the order
      in: path
      required: true
      schema:
        type: string
        enum:
          - json
          - xml
          - original
        description: |
          In addition to the standard json and xml formats, there are some extra visualization formats for an order:
           * `json` - XML format
           * `xml` - XML format
           * `original` - Original format
        example: json
    order_number:
      name: number
      in: query
      description: Filter on order number.
      required: false
      schema:
        type: string
      example: '01'
    order_filename:
      name: filename
      in: query
      description: |
        Name of the attachment.
      required: false
      schema:
        type: string
        example: test.pdf
    order_delivery_location_id:
      name: delivery_location_id
      description: Filtered by delivery_location_id.
      in: query
      required: false
      schema:
        type: integer
        example: 123
    order_client:
      name: client
      description: Search field. Searches on the customer name and VAT code.
      in: query
      required: false
      schema:
        type: string
      example: John Doe
    order_sel_data:
      name: sel_data
      in: query
      description: Filter on submission date options.
      required: false
      schema:
        type: string
        enum:
          - issue_datetime
          - validity_end
          - delivery_date_start
          - order_confirmation.created_at
        description: |
          There are this options for an order:
           * `issue_datetime` - Filter on submission issue dates.
           * `validity_end` - Filter on submission validity end dates.
           * `delivery_date_start` - Filter on submission validity start dates.
           * `order_confirmation.created_at` - Filter on submission order confirmation dates.
        example: issue_datetime
    order_date_from:
      name: date_from
      in: query
      description: Filter from submission order date.
      required: false
      schema:
        type: string
        format: date
        example: '2022-01-01'
    order_date_to:
      name: date_to
      in: query
      description: Filter to submission order date.
      required: false
      schema:
        type: string
        format: date
        example: '2022-01-01'
    order_country:
      name: country
      description: Search field. Searches on the country code.
      in: query
      required: false
      schema:
        type: string
        example: es
    order_delivery_confirmed:
      name: delivery_confirmed
      description: Filter on order status "delivery confirmed".
      in: query
      required: false
      schema:
        type: integer
        minimum: 0
        maximum: 1
        enum:
          - 0
          - 1
        example: 1
    order_closed:
      name: closed
      description: Filter on order status "closed".
      in: query
      required: false
      schema:
        type: integer
        minimum: 0
        maximum: 1
        enum:
          - 0
          - 1
        example: 1
    order_accepted:
      name: accepted
      description: Filter on order status "accepted".
      in: query
      required: false
      schema:
        type: integer
        minimum: 0
        maximum: 1
        enum:
          - 0
          - 1
        example: 1
    order_refused:
      name: refused
      description: Filter on order status "refused".
      in: query
      required: false
      schema:
        type: integer
        minimum: 0
        maximum: 1
        enum:
          - 0
          - 1
        example: 1
    order_received:
      name: received
      description: Filter on order status "received".
      in: query
      required: false
      schema:
        type: integer
        minimum: 0
        maximum: 1
        enum:
          - 0
          - 1
        example: 1
    client_id:
      name: id
      in: path
      description: |
        A unique internal identifier of the client/provider in B2Brouter.
      required: true
      schema:
        type: integer
      example: 123
    client_name:
      name: name
      description: Search field. Searches on the customer name, address and VAT code.
      in: query
      required: false
      schema:
        type: string
      example: John Doe
    client_is_client:
      name: is_client
      description: Filter on contact type, if it is client.
      in: query
      required: false
      schema:
        type: boolean
        example: true
    client_is_provider:
      name: is_provider
      description: Filter on contact type, if it is provider.
      in: query
      required: false
      schema:
        type: boolean
        example: true
    invoice_id_query:
      name: invoice_id
      description: Filtered per invoice.
      in: query
      required: false
      schema:
        type: integer
        example: 123
    tax_report_id_query:
      name: tax_report_id
      description: Filtered per tax_report.
      in: query
      required: false
      schema:
        type: integer
        example: 123
    sent_at_from:
      name: sent_at_from
      in: query
      description: Filter on sent date. Tax reports with sent date later than the specified date are returned.
      required: false
      schema:
        type: string
        format: date
      example: '2024-10-11'
    transport_type_code:
      name: code
      description: Code of the transport
      in: path
      required: true
      schema:
        type: string
        enum:
          - b2brouter
          - peppol
          - email
          - es.eusko_jaurlaritza
          - es.pecam
          - edicom
          - ediversa
        example: peppol
    tax_report_id:
      name: id
      in: path
      description: |
        A unique internal identifier of the Tax Report in B2Brouter.
      required: true
      example: 4053100
      schema:
        type: integer
    tax_report_document_type_code:
      name: document_type_code
      in: path
      description: |
        An internal identifier that is unique to each **Document Type** within B2Brouter.<br> You can get all valid document type codes using the **Document Types** endpoint (`/users/document_types.{format}`) for the **document "TaxReport"**.
      required: true
      example: xml.tax_report.ticket_bai.issued
      schema:
        $ref: '#/components/schemas/DocumentTypeCode'
    tax_report_format:
      name: format
      description: |
        Format

        The format of the Tax Report can be either PNG or XML.
        * When requesting the PNG format, the response will be the QR code image.
        * When requesting the XML format, the response will be the signed XML file.
      in: path
      required: true
      schema:
        type: string
        enum:
          - png
          - xml
        example: png
    ledger_id:
      name: id
      in: path
      description: |
        A unique internal identifier of the Ledger in B2Brouter.
      required: true
      example: 405
      schema:
        type: integer
    directory_country:
      name: country
      description: Country identifier of the company.
      in: path
      required: true
      schema:
        type: string
        example: es
    directory_scheme:
      name: scheme
      description: Scheme number of the company identifier
      in: path
      required: true
      schema:
        type: integer
        example: 9920
    directory_id:
      name: id
      description: Value of the company identifier. You can introduce id without the prefix
      in: path
      required: true
      schema:
        type: string
        example: ES123456789, 123456789
  schemas:
    Account:
      type: object
      description: Represents an account as an object
      properties:
        id:
          type: number
          example: 12345678
          description: The id of the account at B2brouter
          readOnly: true
        tin_value:
          type: string
          example: 29225608E
          description: The Tax Identification Number (TIN) of the account.
          nullable: true
        tin_scheme:
          type: integer
          example: 9920
          description: |
            The TIN Scheme for the Tax Identification Number of the account.
            You can get all schemes codes using the *Schemes* endpoint.
            By default Main TIN Scheme of the country will be used.
          nullable: true
        cin_value:
          type: string
          example: 7080000950171
          description: The Company Identification Number (CIN) of the account.
          nullable: true
        cin_scheme:
          type: integer
          example: 88
          description: |
            The scheme for the Company Identification Number of the account.
            You can get all schemes codes using the *Schemes* endpoint where taxcode=false.
            If cin_value is provided, cin_scheme is required.
          nullable: true
        name:
          type: string
          example: Seller Business Name
          description: The name of the account.
        address:
          type: string
          example: Main Street 1
          description: The street address of the account.
          nullable: true
        address2:
          type: string
          example: Po Box 123
          description: An additional address line in an address that can be used to give further details supplementing the main line.
          nullable: true
        city:
          type: string
          example: Madrid
          description: The city of the account.
          nullable: true
        postalcode:
          type: string
          example: '28014'
          description: The postal code of the account. Zip code for USA and Canada.
          nullable: true
        province:
          type: string
          example: Madrid
          description: The province of the account.
          nullable: true
        country:
          type: string
          description: The country which the company belongs. Use ISO 3166-1 alpha-2 codes.
          default: es
          example: se
        currency:
          type: string
          maxLength: 3
          example: EUR
          description: The currency used by the account.
        contact_person:
          type: string
          description: The contact person of the account.
          nullable: true
          example: johndoe@example.com
        email:
          type: string
          example: ayuntamiento@madrid.es
          description: Email of the person who will receive notifications.
        phone:
          type: string
          example: '6123123123'
          description: The phone number of the account.
          nullable: true
        rounding_method:
          type: string
          enum:
            - half_up
            - bankers
            - truncate
          description: |
            Roundings (only for imported invoices)
             * `half_up` - Round half up
             * `bankers` - Bank rounding
             * `truncate` - Truncate decimals
          default: half_up
          example: half_up
        round_before_sum:
          type: boolean
          description: Round before sum (only for imported invoices)
          default: false
        apply_taxes_per_line:
          type: boolean
          description: Apply taxes per line
          default: false
        registered_for_empl_tax:
          type: boolean
          description: |
            Indicates whether the seller is approved for F-tax (F-skatt), a Swedish tax status.
            If true, invoices generated will include the text "GODKÄND FÖR F-SKATT"
            in compliance with PEPPOL rule SE-R-005.
            This setting applies only to accounts based in Sweden (country = 'se').
          default: false
        archived:
          type: boolean
          example: false
          description: It means if the account is archived
          readOnly: true
        created_at:
          type: string
          format: date-time
          example: '2024-06-06T11:51:57Z'
          description: Date when the account was created
          readOnly: true
        updated_at:
          type: string
          format: date-time
          example: '2024-06-06T11:51:57Z'
          description: Date when the account was last updated
          readOnly: true
    TransactionsEdocsync:
      properties:
        transactions_count:
          type: integer
          example: 16
          description: The transactions the account has made during the current period
          nullable: true
          readOnly: true
        transactions_count_previous_period:
          type: integer
          example: 28
          description: The transactions the account has made in the past period
          nullable: true
          readOnly: true
        transactions_limit:
          type: integer
          example: 25
          description: The number of transactions available for the current product
          nullable: true
          readOnly: true
    Error:
      type: object
      description: Represents an error object returned in a failed request
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: A unique error code identifying the type of error.
              example: invalid_request
            message:
              type: string
              description: A human-readable error message providing more context about the error.
              example: The parameter 'param' is missing or the value is empty
            param:
              type: string
              description: The parameter in the request that caused the error (if applicable).
              example: param
            type:
              type: string
              description: The type of error, often mirrors the error code for clarity.
              example: invalid_request
    UnauthorizedError:
      type: object
      description: Represents an error object returned in a failed request
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: A unique error code identifying the type of error.
              example: unauthorized
              default: unauthorized
            message:
              type: string
              description: A human-readable error message providing more context about the error.
              example: Invalid API Key provided, or the API key might not have the necessary permissions for this action.
            type:
              type: string
              description: The type of error, often mirrors the error code for clarity.
              example: invalid_request_error
              default: invalid_request_error
    BankAccountCommon:
      type: object
      description: Represents common fields of a bank account as an object
      properties:
        type:
          type: string
          writeOnly: true
          description: |
            Bank account type:
             * `number` - Account number
             * `iban` - IBAN
          enum:
            - iban
            - number
          default: iban
          example: iban
        number:
          type: string
          description: Bank account number. This field is required only when `type` is set to `number`.
          example: 10000000000000000000
          maxLength: 24
        iban:
          type: string
          description: International Bank Account Number (IBAN). This field is required only when `type` is set to `iban`.
          example: ES6000000000000000000000
        bic:
          type: string
          description: Bank Identifier Code (BIC). This field is optional, and used only when `type` is set to `iban`.
          example: 0
          maxLength: 11
          nullable: true
    BankAccount:
      allOf:
        - $ref: '#/components/schemas/BankAccountCommon'
        - type: object
          description: Represents a bank account as an object
          required:
            - type
          properties:
            id:
              type: integer
              description: Internal ID
              readOnly: true
              example: 402
            name:
              type: string
              description: Name
              example: My Bank Account
              maxLength: 255
            sufix:
              type: integer
              description: Sufix for the bank account
              example: 1
            address:
              type: string
              description: Address
              example: 1234 Main Street
              maxLength: 255
              nullable: true
            city:
              type: string
              description: City
              example: Barcelona
              maxLength: 255
            province:
              type: string
              description: Province
              example: Barcelona
            postalcode:
              type: string
              description: Postal Code
              example: 12345
            country:
              type: string
              description: Country. Use ISO 3166-1 alpha-2 country codes.
              example: es
              maxLength: 2
            created_at:
              type: string
              format: date-time
              example: '2021-02-20T19:12:44Z'
              readOnly: true
              description: Date and time when the bank account record was created
            updated_at:
              type: string
              format: date-time
              example: '2021-02-30T15:12:44Z'
              readOnly: true
              description: Date and time when the bank account record was last updated
    TbaiTaxReportSetting:
      type: object
      description: Represents a tax report settings for 'tbai' as an object
      properties:
        code:
          type: string
          example: tbai
          description: The Tax Report Authority code.
          enum:
            - tbai
        start_date:
          type: string
          format: date-time
          example: '2024-07-09T00:00:00.000Z'
          description: Date when the Tax Report Setting was enabled. If not provided, the current date and time will be used..
          nullable: true
        auto_generate:
          type: boolean
          example: true
          default: true
          description: Generate the Tax Report automatically
        auto_send:
          type: boolean
          example: true
          default: true
          description: Send the Tax Report automatically
        enabled:
          type: boolean
          example: true
          default: true
          description: Represents if the tax report setting is enabled
        delegation:
          type: string
          example: gipuzkoa
          description: Tax Authority Delegation.
          enum:
            - gipuzkoa
            - bizkaia
            - araba
        reason_vat_exempt:
          type: string
          example: E1
          description: TicketBAI Reason for VAT Exempt.
          enum:
            - E1
            - E2
            - E3
            - E4
            - E5
            - E6
          nullable: true
        special_regime_key:
          type: string
          example: '01'
          description: TicketBAI Special Regime Key.
          enum:
            - '01'
            - '02'
            - '03'
            - '04'
            - '05'
            - '06'
            - '07'
            - '08'
            - '09'
            - '10'
            - '11'
            - '12'
            - '13'
            - '14'
            - '15'
            - '51'
            - '52'
            - '53'
          nullable: true
        reason_no_subject:
          type: string
          example: OT
          description: Default TicketBAI Reason for No Subject.
          enum:
            - OT
            - RL
          nullable: true
        credit_note_code:
          type: string
          example: R1
          description: Default TicketBAI Credit Note Code.
          enum:
            - R1
            - R2
            - R3
            - R4
            - R5
          nullable: true
        type_operation:
          type: string
          example: services
          description: Default TicketBAI Type of Operation.
          enum:
            - services
            - goods
          nullable: true
        epigraph:
          type: string
          example: '147410'
          description: TicketBAI Epigraph needed for bizkaia delegation.
          nullable: true
        locked:
          type: boolean
          example: true
          description: Cannot be completely modified or deleted
          readOnly: true
        created_at:
          type: string
          format: date-time
          example: '2024-06-06T11:51:57Z'
          description: Date when the Tax Report Setting was created
          readOnly: true
        updated_at:
          type: string
          format: date-time
          example: '2024-06-06T11:51:57Z'
          description: Date when the Tax Report Setting was updated
          readOnly: true
    SdiTaxReportSetting:
      type: object
      description: Represents a tax report settings for 'sdi' as an object
      properties:
        code:
          type: string
          example: sdi
          description: The Tax Report Authority code.
          enum:
            - sdi
        start_date:
          type: string
          format: date-time
          example: '2024-06-06T11:51:57Z'
          description: Date when the Tax Report Setting was enabled
          nullable: true
        auto_generate:
          type: boolean
          example: true
          default: true
          description: Generate the Tax Report automatically
        auto_send:
          type: boolean
          example: true
          default: true
          description: Send the Tax Report automatically
        enabled:
          type: boolean
          example: true
          default: true
          description: Represents if the tax report setting is enabled
        locked:
          type: boolean
          example: true
          description: Cannot be completely modified or deleted
          readOnly: true
        created_at:
          type: string
          format: date-time
          example: '2024-06-06T11:51:57Z'
          description: Date when the Tax Report Setting was created
          readOnly: true
        updated_at:
          type: string
          format: date-time
          example: '2024-06-06T11:51:57Z'
          description: Date when the Tax Report Setting was last updated
          readOnly: true
    VerifactuTaxReportSetting:
      type: object
      description: Represents a tax report settings for VeriFactu as an object
      properties:
        code:
          type: string
          example: verifactu
          description: The Tax Report Authority code.
          enum:
            - verifactu
        start_date:
          type: string
          format: date-time
          example: '2025-04-29T00:00:00.000Z'
          description: Date when the Tax Report Setting was enabled. If not provided, the current date and time will be used..
          nullable: true
        auto_generate:
          type: boolean
          example: true
          default: true
          description: Generate the Tax Report automatically
        auto_send:
          type: boolean
          example: true
          default: true
          description: Send the Tax Report automatically
        enabled:
          type: boolean
          example: true
          default: true
          description: Represents if the tax report setting is enabled
        reason_vat_exempt:
          type: string
          example: E1
          description: VeriFactu Reason for VAT Exempt.
          enum:
            - E1
            - E2
            - E3
            - E4
            - E5
            - E6
          nullable: true
        special_regime_key:
          type: string
          example: '01'
          description: VeriFactu Special Regime Key.
          enum:
            - '01'
            - '02'
            - '03'
            - '04'
            - '05'
            - '06'
            - '07'
            - '08'
            - '09'
            - '10'
            - '11'
            - '12'
            - '13'
            - '14'
            - '15'
          nullable: true
        reason_no_subject:
          type: string
          example: N1
          description: Default VeriFactu Reason for No Subject.
          enum:
            - N1
            - N2
          nullable: true
        credit_note_code:
          type: string
          example: R1
          description: Default VeriFactu Credit Note Code.
          enum:
            - R1
            - R2
            - R3
            - R4
            - R5
          nullable: true
        locked:
          type: boolean
          example: true
          description: Cannot be completely modified or deleted
          readOnly: true
        created_at:
          type: string
          format: date-time
          example: '2024-06-06T11:51:57Z'
          description: Date when the Tax Report Setting was created
          readOnly: true
        updated_at:
          type: string
          format: date-time
          example: '2024-06-06T11:51:57Z'
          description: Date when the Tax Report Setting was updated
          readOnly: true
    LhdnTaxReportSetting:
      type: object
      description: Represents a tax report settings for 'lhdn' as an object
      properties:
        code:
          type: string
          example: lhdn
          description: The Tax Report Authority code.
          enum:
            - lhdn
        start_date:
          type: string
          format: date-time
          example: '2024-07-09T00:00:00.000Z'
          description: Date when the Tax Report Setting was enabled. If not provided, the current date and time will be used..
          nullable: true
        auto_generate:
          type: boolean
          example: true
          default: true
          description: Generate the Tax Report automatically
        auto_send:
          type: boolean
          example: true
          default: true
          description: Send the Tax Report automatically
        enabled:
          type: boolean
          example: true
          default: true
          description: Represents if the tax report setting is enabled
        msic:
          type: string
          example: '01111'
          description: Malaysia Standard Industrial Classification (MSIC) Code
          enum:
            - '00000'
            - A
            - '01111'
            - '01112'
            - '01113'
            - '01119'
            - '01120'
            - '01131'
            - '01132'
            - '01133'
            - '01134'
            - '01135'
            - '01136'
            - '01137'
            - '01138'
            - '01140'
            - '01150'
            - '01160'
            - '01191'
            - '01192'
            - '01193'
            - '01199'
            - '01210'
            - '01221'
            - '01222'
            - '01223'
            - '01224'
            - '01225'
            - '01226'
            - '01227'
            - '01228'
            - '01229'
            - '01231'
            - '01232'
            - '01233'
            - '01239'
            - '01241'
            - '01249'
            - '01251'
            - '01252'
            - '01253'
            - '01259'
            - '01261'
            - '01262'
            - '01263'
            - '01269'
            - '01271'
            - '01272'
            - '01273'
            - '01279'
            - '01281'
            - '01282'
            - '01283'
            - '01284'
            - '01285'
            - '01289'
            - '01291'
            - '01292'
            - '01293'
            - '01294'
            - '01295'
            - '01296'
            - '01299'
            - '01301'
            - '01302'
            - '01303'
            - '01304'
            - '01411'
            - '01412'
        type_operation:
          type: string
          example: services
          description: Default Type of Operation.
          enum:
            - services
            - goods
        classification_code:
          type: string
          description: |
            Default classification code, that defines the category of products or services being billed as a result of a commercial transaction.
          enum:
            - '001'
            - '002'
            - '003'
            - '004'
            - '005'
            - '006'
            - '007'
            - '008'
            - '009'
            - '010'
            - '011'
            - '012'
            - '013'
            - '014'
            - '015'
            - '016'
            - '017'
            - '018'
            - '019'
            - '020'
            - '021'
            - '022'
            - '023'
            - '024'
            - '025'
            - '026'
            - '027'
            - '028'
            - '029'
            - '030'
            - '031'
            - '032'
            - '033'
            - '034'
            - '035'
            - '036'
            - '037'
            - '038'
            - '039'
            - '040'
            - '041'
            - '042'
            - '043'
            - '044'
            - '045'
        locked:
          type: boolean
          example: true
          description: Cannot be completely modified or deleted
          readOnly: true
        created_at:
          type: string
          format: date-time
          example: '2024-06-06T11:51:57Z'
          description: Date when the Tax Report Setting was created
          readOnly: true
        updated_at:
          type: string
          format: date-time
          example: '2024-06-06T11:51:57Z'
          description: Date when the Tax Report Setting was updated
          readOnly: true
    Project:
      type: object
      description: Represents a project as an object
      properties:
        id:
          type: number
          description: Project ID
          example: 9763
        name:
          type: string
          description: Name
          example: B2Brouter Global, S.L.
          maxLength: 255
        identifier:
          type: string
          description: Identifier
          example: b2brouter-global
        company_name:
          type: string
          description: Company Name
          example: B2Brouter Global, S.L.
        company_taxcode:
          type: string
          description: Company Taxcode
          example: ES29225608E
        description:
          type: string
          description: Description
          example: Description of the company
        status:
          type: integer
          example: 1
          description: Status
        created_on:
          type: string
          format: date-time
          description: Date when the entity was created
          example: '2022-01-01T00:00:00Z'
        updated_on:
          type: string
          format: date-time
          description: Date when the entity was updated
          example: '2022-01-01T00:00:00Z'
    TransportTypeCode:
      type: string
      maxLength: 100
      title: Transport Type Code
      description: |
        An internal identifier that is unique to each **Transport Type** within B2Brouter.<br> You can get all valid transport type codes using the **Transport Types** endpoint (`/users/transport_types.{format}`).
      example: peppol
      nullable: true
    DocumentTypeCode:
      type: string
      maxLength: 100
      title: Document Type Code
      description: |
        An internal identifier that is unique to each **Document Type** within B2Brouter.<br> You can get all valid document type codes using the **Document Types** endpoint (`/users/document_types.{format}`).
      example: xml.ubl.invoice.bis3
      nullable: true
    Company:
      description: Represents a company as an object
      type: object
      properties:
        taxcode:
          type: string
          example: ESB63276174
        name:
          type: string
          example: B2Brouter Global, S.L.
          description: The name of the company.
        email:
          type: string
          example: factures@b2brouter.net
          description: The email of the company.
        phone:
          type: string
          example: '99838727763'
          description: Phone number.
          nullable: true
        address:
          type: string
          example: Avinguda Diagonal, 433, 1 1
          description: Company address.
          nullable: true
        city:
          type: string
          example: Barcelona
          description: City name.
          nullable: true
        postalcode:
          type: string
          example: '80360'
          description: Postal code. Zip code for USA and Canada
        province:
          type: string
          example: Barcelona
          nullable: true
        country:
          type: string
          example: es
          description: Country name to which the company belongs.
        website:
          type: string
          example: https://b2brouter.net
          description: Website address
          nullable: true
        invoice_format:
          type: string
          deprecated: true
          example: xml.facturae.3.2
          nullable: true
        transport_type_code:
          $ref: '#/components/schemas/TransportTypeCode'
        document_type_code:
          $ref: '#/components/schemas/DocumentTypeCode'
        currency:
          type: string
          example: EUR
        company_identifier:
          type: string
          example: company-identifier
          nullable: true
        project_identifier:
          type: string
          example: project-identifier
        edi_code:
          type: string
          example: '11111'
          nullable: true
        logo:
          type: string
          example: url/logo.png
          nullable: true
        issued_invoice_notifications:
          type: string
          nullable: true
          example: correu@b2brouter.net
        refused_invoice_notifications:
          type: string
          nullable: true
          example: correu@b2brouter.net
        invoice_error_sending_notifications:
          type: string
          nullable: true
          example: correu@b2brouter.net
        received_invoice_notifications:
          type: string
          nullable: true
          example: correu@b2brouter.net
        received_order_notifications:
          type: string
          nullable: true
          example: correu@b2brouter.net
        sii_imported_notifications:
          type: string
          nullable: true
          example: correu@b2brouter.net
        sii_sent_notifications:
          type: string
          nullable: true
          example: correu@b2brouter.net
        sii_state_changes_notifications:
          type: string
          example: correu@b2brouter.net
          nullable: true
        sii_duplicates_notifications:
          type: string
          nullable: true
          example: correu@b2brouter.net
        connector:
          type: string
          example: SFTP
          nullable: true
        plan:
          type: string
          example: enterprise
      xml:
        name: my_company
    InvoiceContactHash:
      type: object
      description: Represents a client as an object
      properties:
        id:
          type: integer
          example: 123
          readOnly: true
          description: Client ID
        name:
          type: string
          description: |
            The full name of the Buyer.

            ID: `BT-44`
          example: Buyer Full Name AS
        taxcode:
          type: string
          example: 9920:ESD29766391
          description: |
            TaxCode. The Buyer's VAT identifier (also known as Buyer VAT identification number).
            Can be prefixed by a scheme code followed by a colon.

            ID: `BT-48`
        address:
          type: string
          description: |
            The main address line in an address.

            ID: `BT-50`
          example: Lausitzer Str. 65
          nullable: true
        address2:
          type: string
          description: |
            An additional address line in an address that can be used to give further details supplementing the main line.

            ID: `BT-51`
          nullable: true
          example: Lausitzer Str. 66
        postalcode:
          type: string
          description: |
            The identifier for an addressable group of properties according to the relevant postal service.

            ID: `BT-53`
          example: '80535'
          nullable: true
        city:
          type: string
          description: |
            The common name of the city, town or village,where the Buyer's address is located.

            ID: `BT-52`
          example: Berlin
          nullable: true
        province:
          type: string
          description: |
            The  subdivision  of  a  country.

            ID: `BT-54`
          example: Berlin
          nullable: true
        country:
          type: string
          description: Country
          example: de
        email:
          type: string
          description: |
            An e-mail address for the contact point.

            ID: `BT-58`
          writeOnly: true
          example: example@email.com
        pin_value:
          type: string
          description: |
            Peppol Identifier Number, identifies the Buyer's electronic address to which the invoice is delivered.

            ID: `BT-49`
          example: '987654321'
          nullable: true
          writeOnly: true
        pin_scheme:
          type: string
          description: |
            The identification scheme identifier of the Buyer electronic address.

            You can get all schemes codes using the **Schemes* endpoint (`/users/schemes.{format}`). The value has to be in EAS code list
            https://docs.peppol.eu/poacc/billing/3.0/codelist/eas/
          example: '0192'
          nullable: true
          writeOnly: true
        party_identification:
          type: string
          description: |
            Seller/Buyer identifier

            ID: `BT-29` if Contact is a Seller (Invoice is a Received Invoice)
            ID: `BT-46` if Contact is a Buyer (Invoice is an Issued Invoice)
          example: '506001234999'
          nullable: true
    StateOutput:
      type: string
      example: refused
      enum:
        - new
        - sent
        - accepted
        - registered
        - refused
        - closed
        - paid
        - annotated
        - error
        - invalid
      description: |
        States for an issued invoice:
         * `new` - The initial status of an issued invoice.
         * `sent` - The invoice has been sent successfully.
         * `accepted` - When the invoice is marked as accepted.
         * `registered` -  When a registered notification has been received or manually marked as registered.
         * `refused` - When a refused notification has been received or manually marked as refused.
         * `closed` - Is a final state.
         * `error` - Indicates that an error occurred while sending the invoice.

        States for a received invoice:
         * `new` - The initial status of an issued invoice or the invoice is manually marked as new.
         * `paid` - When the invoice has been paid or the invoice is marked manually as paid.
         * `accepted` - When the invoice is marked as accepted.
         * `refused` - When the invoice is marked as refused.
         * `annotated` - When the invoice is marked annotated.
         * `invalid` - When the invoice is marked as invalid during validation.
         * `error` - Indicates that an error occurred while processing the invoice.
    Tax:
      type: object
      description: Represents a tax as an object
      properties:
        name:
          type: string
          description: Tax Name
          example: IVA
        base:
          type: number
          format: decimal
          description: The base amount that may be used to calculate the Tax Amount
          example: 100
          readOnly: true
        amount:
          type: number
          format: decimal
          description: The amount of the tax.
          readOnly: true
          example: 21
        category:
          type: string
          enum:
            - E
            - NS
            - Z
            - S
            - H
            - AA
            - AAA
            - AE
            - G
            - O
            - K
          example: S
          description: |
            Taxes categories
             * `E` - Exempt
             * `NS` - NotSubject
             * `Z` - ZeroRated
             * `S` - Standard
             * `H` - High Rate
             * `AA` - Low Rate
             * `AAA` - Super Low Rate
             * `AE` - Reverse
             * `G` - Free export item, VAT not charged
             * `O` - Services outside scope of tax
             * `K` - VAT exempt for EEA intra-community supply of goods and services
          writeOnly: true
        percent:
          type: number
          format: float
          description: Tax %
          example: 21
        comment:
          type: string
          description: Tax comment
          nullable: true
          example: IVA 21%
    CardAccountCommon:
      type: object
      description: |
        Represents common fields of a card account as an object.
        A group of business terms providing information about card used for payment contemporaneous with invoice issuance.
      properties:
        id:
          type: integer
          description: A unique identifier for this CardAccount across all the system.
          readOnly: true
        account_number:
          type: string
          description: |
            The Primary Account Number (PAN) of the card used for payment. In accordance with card payments security standards, 
            an invoice should never include a full card primary account number. 
            At the moment PCI Security Standards Council has defined that the first 6 digits and last 4 digits 
            are the maximum number of digits to be shown.
            ID: `BT-87`
          example: 1234567890
          minLength: 10
          maxLength: 10
        holder_name:
          type: string
          description: |
            The name of the payment card holder.
            ID: `BT-88`
          example: John Doe
        network:
          type: string
          description: Card Network identifier, such as VISA, American Express, Master Card.
          example: VISA
          maxLength: 50
          nullable: true
    InvoiceLine:
      type: object
      required:
        - quantity
      description: |
        A group of business terms providing information on individual Invoice lines.

        ID: `BG-25`
      properties:
        id:
          type: integer
          example: 435453
          description: A unique identifier for this InvoiceLine across all the system. Only shown if the query parameter "include" is "detailed_lines".
          readOnly: true
        position:
          type: integer
          example: 1
          description: position
          writeOnly: true
        quantity:
          type: number
          format: decimal
          description: |
            Invoiced quantity. The quantity of items (goods or services) that is charged in the Invoice line.

            ID: `BT-129`
          maxLength: 255
          example: 1
        price:
          type: number
          format: decimal
          description: |
            The price of an item, exclusive of VAT,after subtracting item price discount.

            ID: `BT-146`
          maxLength: 255
          example: 10
        description:
          type: string
          description: |
            Item Name.

            ID: `BT-153`
          maxLength: 65535
          nullable: true
          example: Item 1
        total_cost:
          type: number
          format: float
          description: Price * Quantity
          maxLength: 255
          readOnly: true
          example: 10
        extension_amount:
          type: number
          format: float
          description: |
            Line net total amount (total_cost + charges - discounts)

            ID: `BT-131`
          maxLength: 255
          example: 10
        unit:
          type: number
          maxLength: 255
          default: 1
          enum:
            - 1
            - 2
            - 3
            - 4
            - 5
            - 6
            - 7
            - 8
            - 9
            - 10
            - 11
            - 12
            - 15
            - 16
            - 17
            - 18
            - 19
            - 21
            - 22
            - 23
            - 24
            - 25
            - 26
            - 28
            - 30
            - 31
            - 32
            - 33
            - 34
            - 35
            - 36
          description: |
            * `1` - units
            * `2` - hours
            * `3` - kilograms
            * `4` - liters
            * `5`  - other
            * `6`  - days
            * `7`  - boxes
            * `8`  - trays
            * `9`  - barrels
            * `10` - bags
            * `11` - carboys
            * `12` - bottles
            * `15` - centiliters
            * `16` - centimeters
            * `17` - bins
            * `18` - dozens
            * `19` - cases
            * `21` - grams
            * `22` - kilometers
            * `23` - cans
            * `24` - bunches
            * `25` - meters
            * `26` - milimeters
            * `28` - packages
            * `30` - rolls
            * `31` - envelopes
            * `32` - tubs
            * `33` - cubicmeter
            * `34` - second
            * `35` - watt
            * `36` - squaremetre
          example: 1
        discount_amount:
          type: number
          format: decimal
          nullable: true
          description: |
            Discount amount (null if discount is a percentage)

            ID: `BT-147`
          maxLength: 255
          example: 100
        discount_percent:
          type: number
          format: decimal
          description: |
            Discount % (null if discount is an absolute amount). Invoice line allowance percentage. The percentage that may be used, in conjunction with the Invoice line allowance base amount, to calculate the Invoice line allowance amount.

            ID: `BT-138`
          maxLength: 255
          example: 20
          nullable: true
        discount_text:
          type: string
          description: |
            Invoice line allowance reason. The reason for the Invoice line allowance, expressed as text.

            ID: `BT-139`
          maxLength: 255
          writeOnly: true
          example: Discount
          nullable: true
        charge_amount:
          type: number
          format: decimal
          description: |
            Charge amount. (null if charge is a percentage)

            ID: `BT-141`
          nullable: true
          example: 4
        charge_percent:
          type: number
          format: decimal
          description: |
            Invoice line charge percentage. The percentage that may be used, in conjunction with the Invoice line charge base amount, to calculate Invoice line charge amount.
            (null if charge is an absolute amount)

            ID: `BT-143`
          example: 20
          nullable: true
        charge_reason:
          type: string
          description: |
            Invoice line charge reason. The reason for the Invoice line charge, expressed as text.

            ID: `BT-144`
          maxLength: 255
          example: Charge
          nullable: true
        gross_amount:
          type: number
          format: decimal
          description: total_cost + charges - discounts
          readOnly: true
          example: 100
        taxes:
          type: array
          description: Taxes
          items:
            $ref: '#/components/schemas/Tax'
          readOnly: true
        taxes_attributes:
          type: array
          description: Taxes
          items:
            $ref: '#/components/schemas/Tax'
          writeOnly: true
        article_code:
          type: string
          description: |
            Seller product ID. An identifier, assigned by the Seller, for the item.

            ID: `BT-155`
          maxLength: 255
          example: '9873242'
          nullable: true
        article_code2:
          type: string
          description: |
            Product ID. An item identifier based on a registered scheme.

            ID: `BT-157`
          maxLength: 255
          example: '10986700'
          nullable: true
        article_code2_scheme:
          type: string
          description: |
            Product ID Scheme.Item standard identifier identification scheme identifier. The identification scheme identifier of the Item standard identifier.

            ID: `BT-157-1`
          maxLength: 255
          writeOnly: true
          example: '0160'
          nullable: true
        article_code_buyer:
          type: string
          description: |
            Buyer product ID. An identifier, assigned by the Buyer, for the item.

            ID: `BT-156`
          maxLength: 255
          nullable: true
          example: '9873242'
        classification_code:
          type: string
          description: Category product ID
          maxLength: 255
          nullable: true
          example: '9873242'
        classification_code_scheme:
          type: string
          description: Classification code scheme
          maxLength: 255
          nullable: true
          example: '0160'
        client_reference:
          type: string
          description: |
            Client reference. A textual value that specifies where to book the
            relevant data into the Buyer's financial accounts.

            ID: `BT-133`
            Deprecated, use buyer_accounting_reference instead
          maxLength: 255
          example: '1287:65464'
          nullable: true
          deprecated: true
        buyer_accounting_reference:
          type: string
          description: |
            A textual value that specifies where to book the relevant data into the Buyer's financial accounts.

            ID: `BT-133`
          maxLength: 255
          example: '1287:65464'
          nullable: true
        delivery_note_date:
          type: string
          format: date
          description: Dispatch advice date
          nullable: true
          example: '2024-09-12'
        delivery_note_number:
          type: string
          description: Dispatch advice no
          maxLength: 255
          nullable: true
          example: '123'
        file_reference:
          type: string
          description: |
            Project Reference
            [FacturaE Only]
          maxLength: 255
          writeOnly: true
          nullable: true
          example: BE-123
        file_date:
          type: string
          format: date
          description: |
            Date of file
            [Facturae Only] Tag: FileDATE
          nullable: true
          example: '2024-09-12'
        invoicing_period_start:
          type: string
          format: date
          description: |
            Invoice line period start date. The date when the Invoice period for this Invoice line starts.

            ID: `BT-134`
          maxLength: 255
          example: '2017-10-10'
          nullable: true
        invoicing_period_end:
          type: string
          format: date
          description: |
            Invoice line period end date. The date when the Invoice period for this Invoice line ends.

            ID: `BT-135`
          maxLength: 255
          example: '2017-10-15'
          nullable: true
        issuer_transaction_reference:
          type: string
          description: Receiving advice
          maxLength: 255
          nullable: true
          example: '123'
        issuer_transaction_date:
          type: string
          format: date
          description: |
            Date of issuer's operation
            [Facturae Only] Tag: IssuerTransactionDate
          nullable: true
          example: '2024-09-12'
        notes:
          type: string
          description: |
            A description for an item.

            ID: `BT-154`
          maxLength: 65535
          example: Long description of the item on the invoice line
          nullable: true
        ponumber:
          type: string
          description: |
            Purchase Order Number. An identifier for an object on which the invoice line is based, given by the Seller.


            ID: `BT-128`
          maxLength: 255
          example: PO123
          nullable: true
        receiver_transaction_date:
          type: string
          format: date
          description: |
            Date of recipient's operation
            [FacturaE Only]
          nullable: true
          example: '2024-09-12'
        receiver_contract_reference:
          type: string
          description: Assignment code
          maxLength: 255
          example: reference_123
          nullable: true
        receiver_contract_date:
          type: string
          format: date
          description: |
            Date of the recipient's contract
            [FacturaE Only]
          nullable: true
          example: '2024-09-12'
        sequence_number:
          type: string
          description: |
            Sequence number. An identifier for a referenced line within a purchase order, issued by the Buyer.

            ID: `BT-132`
          example: '3'
          nullable: true
        receipt_reference:
          type: object
          description: The information about the referenced Receipt. Used only in FatturaPA exportation.
          properties:
            identifier:
              type: string
              description: The alphanumeric identifier of the receipt (or of the RT/server RT).
              nullable: true
              example: '123456'
            number:
              type: integer
              description: The progressive number of the receipt (or of the receipt or of the commercial commercial document).
              nullable: true
              example: 123
            date:
              type: string
              format: date
              description: The date of the receipt.
              nullable: true
              example: '2024-09-12'
    PaymentDues:
      type: object
      description: Represents a payment due as an object
      properties:
        due_date:
          type: string
          format: date
          example: '2024-09-12'
        amount:
          type: number
          example: 10
    Invoice:
      type: object
      description: Represents an invoice as an object
      properties:
        id:
          type: integer
          example: 4053100
          description: |
            A unique internal identifier of the Invoice in B2Brouter.
          readOnly: true
        type:
          type: string
          description: Invoice type
          example: IssuedInvoice
          enum:
            - IssuedInvoice
            - ReceivedInvoice
            - IssuedSelfInvoice
            - IssuedSimplifiedInvoice
          default: IssuedInvoice
        number:
          type: string
          example: '3'
          description: |
            A unique identification of the Invoice.

            ID: `BT-1`
          maxLength: 100
        series_code:
          type: string
          example: S01
          description: |
            The series code of the Invoice.
        to_net:
          type: string
          readOnly: true
          nullable: true
          example: '123'
        to_net_id:
          type: string
          readOnly: true
          nullable: true
          example: '123'
        from_net:
          type: string
          readOnly: true
          nullable: true
          example: '123'
        from_net_id:
          type: string
          readOnly: true
          nullable: true
          example: '123'
        project:
          type: object
          properties:
            id:
              type: integer
              example: 742
              description: ID Project
            name:
              type: string
              example: Project Trading Name
              description: Project Name
          readOnly: true
        company:
          type: object
          properties:
            id:
              type: integer
              example: 742
              description: Unique identifier for the company.
            name:
              type: string
              example: Company Trading Name
              description: |
                A name by which the Seller/Buyer is known, other than Seller/Buyer name (also known as Business name).

                ID: `BT-27` and `BT-28` if the company is the Seller Party (in case to be a IssuedInvoice).
                ID: `BT-44` and `BT-45` if the company is the Buyer Party (in case to be a ReceivedInvoice).
            taxcode:
              type: string
              example: SE8765456787
              description: |
                The tax identification number of the company.

                ID: `BT-31` if the company is the Seller Party (in case to be a IssuedInvoice).
                ID: `BT-48` if the company is the Buyer Party (in case to be a ReceivedInvoice).
            address:
              type: string
              description: |
                The main address line in an address.

                ID: `BT-35` if the company is the Seller Party (in case to be a IssuedInvoice).
                ID: `BT-50` if the company is the Buyer Party (in case to be a ReceivedInvoice).
              example: Main Street 1
              nullable: true
            address2:
              type: string
              description: |
                An additional address line in an address that can be used to give further details supplementing the main line.              

                ID: `BT-36` if the company is the Seller Party (in case to be a IssuedInvoice).
                ID: `BT-51` if the company is the Buyer Party (in case to be a ReceivedInvoice).
              example: Po Box 351
              nullable: true
            postalcode:
              type: string
              description: |
                The identifier for an addressable group of properties according to the relevant postal service.              

                ID: `BT-38` if the company is the Seller Party (in case to be a IssuedInvoice).
                ID: `BT-53` if the company is the Buyer Party (in case to be a ReceivedInvoice).
              example: 34567
              nullable: true
            city:
              type: string
              description: |
                The common name of the city, town or village,where the Seller/Buyer address is located.              

                ID: `BT-37` if the company is the Seller Party (in case to be a IssuedInvoice).
                ID: `BT-52` if the company is the Buyer Party (in case to be a ReceivedInvoice).
              example: Stockholm
              nullable: true
            province:
              type: string
              description: |
                The  subdivision  of  a  country. Such as a region, a county, a state, a province, etc. 

                ID: `BT-39` if the company is the Seller Party (in case to be a IssuedInvoice).
                ID: `BT-54` if the company is the Buyer Party (in case to be a ReceivedInvoice).
              example: Region A
              nullable: true
            country:
              type: string
              description: |
                A code that identifies the country.

                ID: `BT-40` if the company is the Seller Party (in case to be a IssuedInvoice).
                ID: `BT-55` if the company is the Buyer Party (in case to be a ReceivedInvoice).
              example: se
              nullable: true
          readOnly: true
        contact_id:
          type: integer
          description: |
            If the customer exists on B2Brouter and you know its ID, you can
            pass it, inside invoice hash, with contact_id. If it does not exist
            or you don’t know its ID, you can pass a hash with client
            attributes, inside the invoice hash.
          writeOnly: true
          example: 123
        client_id:
          type: integer
          description: |
            If the customer exists on B2Brouter and you know its ID, you can
            pass it, inside invoice hash, with client_id. If it does not exist
            or you don’t know its ID, you can pass a hash with client
            attributes, inside the invoice hash.
          deprecated: true
          writeOnly: true
          example: 123
        contact:
          allOf:
            - $ref: '#/components/schemas/InvoiceContactHash'
          writeOnly: true
        client:
          allOf:
            - $ref: '#/components/schemas/InvoiceContactHash'
          readOnly: true
        state:
          allOf:
            - $ref: '#/components/schemas/StateOutput'
        refuse_reason:
          type: string
          example: Incorrect invoice amount
          description: The reason provided for refusing the invoice.
          readOnly: true
          nullable: true
        date:
          type: string
          format: date
          description: |
            The date when the Invoice was issued.

            ID: `BT-2`
          example: '2020-11-12'
        due_date:
          type: string
          format: date
          description: |
            The date when the payment is due.

            ID: `BT-9`
          example: '2021-01-04'
          nullable: true
        tax_point_date:
          type: string
          format: date
          description: |
            The date when the VAT becomes accountable for the Seller and for the Buyer in so far as that date can be 
            determined and differs from the date of issue of the invoice, according to the VAT directive.
            This element is required if the Value added tax point date is different from the Invoice issue date. 

            ID: `BT-7`
          example: '2022-02-01'
          nullable: true
        invoicing_period_start:
          type: string
          format: date
          description: |
            The date when the invoice period starts.

            ID: `BT-73`
          example: '2024-07-07'
          nullable: true
        invoicing_period_end:
          type: string
          format: date
          description: |
            The date when the invoice period ends. 

            ID: `BT-74`
          example: '2024-07-07'
          nullable: true
        buyer_reference:
          type: string
          maxLength: 255
          description: |
            An identifier assigned by the Buyer used for internal routing purposes.

            ID: `BT-10`
          example: '321654'
          nullable: true
        file_reference:
          type: string
          description: |
            The identification of the project the invoice refers to.

            ID: `BT-11`
          maxLength: 255
          example: PID33
          nullable: true
        ponumber:
          type: string
          maxLength: 255
          description: |
            Purcharse order reference. An identifier of a referenced purchase order, issued by the Buyer.

            ID: `BT-13`
          nullable: true
          example: '123'
        sales_order_reference:
          type: string
          maxLength: 255
          description: |
            An identifier of a referenced sales order, issued by the Seller.

            ID: `BT-14`
          example: '123'
          nullable: true
        receiving_advice_reference:
          type: string
          maxLength: 255
          description: |
            An identifier of a referenced receiving advice.

            ID: `BT-15`
          example: '123'
          nullable: true
        lot_reference:
          type: string
          maxLength: 255
          description: |
            Tender or Lot number. The identification of the call for tender or lot
            the invoice relates to.


            ID: `BT-17`
          example: '321654'
          nullable: true
        contract_number:
          type: string
          maxLength: 255
          description: |
            Contract reference. The identification of a contract.

            ID: `BT-12`
          example: 123Contractref
          nullable: true
        party_identification:
          type: string
          maxLength: 60
          description: |
            Seller identifier or bank assigned creditor identifier

            *This element is used for both the identification of the Seller, or the unique banking reference identifier of Seller (assigned by the Seller bank.). For seller identification use ICD code list, for SEPA bank assigned creditor reference, use SEPA. In order for the buyer to automatically identify a supplier, the Seller identifier (`BT-29`), the Seller legal registration identifier (`BT-30`) and/or the Seller VAT identifier (`BT-31`) shall be present*
          example: '506001234999'
          nullable: true
        customer_party_identification:
          type: string
          description: |
            Buyer identifier

            ID: `BT-46`
            DEPRECATED: Use contact.party_identification
          example: '506001234999'
          writeOnly: true
          deprecated: true
        delivery_note_number:
          type: string
          maxLength: 220
          description: |
            An identifier of a referenced despatch advice

            ID: `BT-16`
          example: '321654'
          nullable: true
        delivery_note_date:
          type: string
          format: date
          description: |
            Dispatch advice date
            [FacturaE and FatturaPA only]
          example: '2024-07-07'
          nullable: true
        accounting_cost:
          type: string
          description: Accounting cost. Deprecated, use buyer_accounting_reference instead
          maxLength: 210
          writeOnly: true
          example: Accounting cost
          deprecated: true
        buyer_accounting_reference:
          type: string
          description: |
            A textual value that specifies where to book the relevant data into the Buyer's financial accounts.

            ID: `BT-19`
          maxLength: 255
          nullable: true
        customer_contact_person:
          type: string
          maxLength: 170
          description: Overwrites the existing contact of the client
          example: John Doe
          nullable: true
        language:
          type: string
          maxLength: 2
          description: |
            Contact language. It should be a language available inside B2Brouter. 
            You can check all available languages using the **Languages** endpoint (`/users/languages.json`)
          enum:
            - en
            - es
            - ca
            - fr
            - it
            - de
            - pt
            - nl
            - pl
            - da
            - sv
            - ar
          example: en
          nullable: true
        amended_number:
          type: string
          description: |
            Number of the invoice to amend.

            ID: `BT-25`
          example: '123'
          nullable: true
        amended_date:
          type: string
          description: |
            Date of the invoice to amend

            ID: `BT-26`
          example: '2024-01-01'
          nullable: true
        amended_invoicing_period_start:
          type: string
          format: date
          description: |
            [Facturae Only]

            ../Corrective/TaxPeriod/StartDate
          nullable: true
          example: '2024-01-01'
        amended_invoicing_period_end:
          type: string
          format: date
          description: |
            [Facturae Only]

            ../Corrective/TaxPeriod/EndDate
          nullable: true
          example: '2024-01-30'
        amend_reason:
          type: string
          description: |
            [Facturae Only]

            ../Corrective/TaxPeriod/EndDate

            * `01` - Invoice number
            * `02` - Invoice serial number
            * `03` - Issue date
            * `04` - Name and surnames/Corporate name – Issuer (Sender)
            * `05` - Name and surnames/Corporate name - Receiver
            * `06` - Issuer’s Tax Identification Number
            * `07` - Receiver’s Tax Identification Number
            * `08` - Issuer’s address
            * `09` - Receiver’s address
            * `10` - Item line
            * `11` - Applicable Tax Rate
            * `12` - Applicable Tax Amount
            * `13` - Applicable Date/Period
            * `14` - Invoice Class
            * `15` - Legal literals
            * `16` - Taxable Base
            * `80` - Calculation of tax outputs
            * `81` - Calculation of tax inputs
            * `82` - Taxable Base modified due to return of packages and packaging materials
            * `83` - Taxable Base modified due to discounts and rebates
            * `84` - Taxable Base modified due to firm court ruling or administrative decision
            * `85` - Taxable Base modified due to unpaid outputs where there is a judgement opening insolvency proceedings
          nullable: true
          example: '01'
        correction_method:
          type: string
          description: |
            [Facturae Only]

            ../Corrective/CorrectionMethod

            * `02` - Only items already corrected are noted.
          nullable: true
          example: '01'
        adjustment_in_cents:
          type: integer
          example: 2
          minimum: -99
          maximum: 99
          description: |
            The amount (in cents) to be added to the invoice total to round the amount to be paid.

            ID: `BT-114`
        charge_amount:
          type: number
          format: decimal
          description: |
            The amount of the charge, without VAT.

            ID: `BT-99`
          example: 363.5
        charge_percent:
          type: number
          format: decimal
          nullable: true
          description: |
            Invoice charge percentage. The percentage that may be used to
            calculate the invoice charge amount.


            ID: `BT-101`
          example: 20
        charge_reason:
          type: string
          description: |
            Invoice charge reason. The reason for the Invoice charge, expressed as
            text.


            ID: `BT-104`
          maxLength: 255
          nullable: true
          example: Charge
        discount_amount:
          type: number
          format: decimal
          maxLength: 60
          description: |
            The amount of the discount, without VAT.

            ID: `BT-92`
          example: 20
        discount_percent:
          type: number
          nullable: true
          format: float
          maxLength: 60
          description: |
            Invoice discount percentage. The percentage that may be used to
            calculate the invoice discount amount.

            ID: `BT-94`
          example: 20
        discount_text:
          type: string
          maxLength: 60
          description: |
            The reason for the document level discount expressed as text.

            ID: `BT-97`
          nullable: true
          example: Discount
        subtotal:
          type: number
          format: float
          example: 363.5
          readOnly: true
        taxes:
          type: array
          items:
            $ref: '#/components/schemas/Tax'
          readOnly: true
        total:
          type: number
          format: float
          example: 363.5
          readOnly: true
        currency:
          type: string
          example: EUR
          description: |
            The currency in which all Invoice amounts are given, except for the
            Total VAT amount in accounting currency.


            ID: `BT-5`
          maxLength: 3
        amounts_withheld_reason:
          type: string
          maxLength: 255
          description: Withheld reason
          nullable: true
          example: Withheld
        withheld_percent:
          type: number
          nullable: true
          format: decimal
          description: Withheld percent
          example: 10
        amounts_withheld:
          type: number
          description: Withheld amount
          example: 36.35
        payable_amount:
          type: number
          format: float
          description: |
            The outstanding amount that is requested to be paid.

            ID: `BT-115`
          example: 327.15
          readOnly: true
        payment_method:
          type: integer
          enum:
            - 1
            - 2
            - 3
            - 4
            - 7
            - 10
            - 11
            - 12
            - 13
            - 14
            - 15
            - 17
            - 19
            - 54
            - 56
            - 58
            - 59
            - 101
            - 102
          maxLength: 4
          description: |
            The means, expressed as code, for how a payment is expected to be or has been settled. 
            ID: `BT-81`
            This is B2Brouter’s internal code list for payment means. Each internal code maps to a UBL code following the EN 16931 semantic model.
            Payment method
             * `1` - Cash (UBL: 10)
             * `2` - Direct debit (UBL: 49)
             * `3` - Hold (UBL: 8)
             * `4` - Bank transfer (UBL: 30)
             * `7` - Awarded contract (UBL: ZZZ)
             * `10` - Promissory note (UBL: 60)
             * `11` - Cheque (UBL: 20)
             * `12` - Reposition (UBL: ZZZ)
             * `13` - Other (UBL: ZZZ)
             * `14` - Compensation (UBL: 97)
             * `15` - Payment by postgiro (UBL: 50)
             * `17` - Bank cheque (UBL: 23)
             * `19` - Bank card (UBL: 48)
             * `54` - Credit card (UBL: 54)
             * `56` - Bank giro (UBL: 56)
             * `58` - SEPA bank transfer (SCT) (UBL: 58)
             * `59` - SEPA Direct Debit (SDD) (UBL: 59)          
             * `101` - GIRO (UBL: ZZZ)
             * `102` - PayNow Corporate (UBL: ZZZ)
          writeOnly: true
          example: 4
        payment_method_text:
          type: string
          maxLength: 255
          description: |
            The means, expressed as text, for how a payment is expected to be or has been settled.

            ID: `BT-82`
          example: Bank transfer
          nullable: true
        payment_terms:
          type: string
          maxLength: 65535
          description: |
            Payment terms. A textual description of the payment terms that apply
            to the amount due for payment (Including description of possible
            penalties).


            ID: `BT-20`
          example: Payment terms
          nullable: true
        bank_assigned_creditor_reference:
          type: string
          description: |
            Bank assigned creditor reference

            ID: `BT-90`
          maxLength: 255
          example: ES6000000000000000000000
          nullable: true
        remittance_information:
          type: string
          maxLength: 180
          description: |
            Remittance information. A textual value used to establish a link
            between the payment and the Invoice, issued by the Seller.


            ID: `BT-83`
          example: Remittance information
          nullable: true
        mandate_reference_identifier:
          type: string
          maxLength: 110
          description: |
            Mandate reference identifier. Unique identifier assigned by the Payee for referencing the direct debit mandate.

            ID: `BT-89`
          example: '321654'
          nullable: true
        bank_account_id:
          type: integer
          description: |
            Unique identifier for an existing bank account in B2Brouter. 
            Use this field to reference an existing bank account. To create a new account, use `bank_account` instead.
          example: 402
          writeOnly: true
        bank_account:
          description: |
            Represents a bank account as an object. 
            Use this field to create a new bank account.
          type: object
          writeOnly: true
          allOf:
            - $ref: '#/components/schemas/BankAccountCommon'
        iban:
          type: string
          description: IBAN<br>Use `bank_account.iban` instead.
          deprecated: true
          writeOnly: true
          example: ES6000000000000000000000
        bic:
          type: string
          description: BIC<br>Use `bank_account.bic` instead.
          writeOnly: true
          example: '123'
          deprecated: true
        contact_iban:
          type: string
          description: The IBAN associated with a received invoice.<br>This field is only applicable for received invoices and should be ignored for other invoice types.
          example: ES6000000000000000000000
        contact_bic:
          type: string
          description: The BIC associated with a received invoice.<br>This field is only applicable for received invoices and should be ignored for other invoice types.
          example: '123'
        card_account_attributes:
          description: |
            Represents the card account of the customer party. 
            Use this field to create the card account for this invoice.
          type: object
          allOf:
            - $ref: '#/components/schemas/CardAccountCommon'
            - type: object
              required:
                - account_number
          writeOnly: true
        card_account:
          description: |
            Represents the card account of the customer party. 
            Use this field to create the card account for this invoice.
          type: object
          allOf:
            - $ref: '#/components/schemas/CardAccountCommon'
          readOnly: true
        reminder_for_payment:
          type: boolean
          description: Send expiration reminder to customer
          writeOnly: true
          nullable: true
        payment_reminder_days:
          type: integer
          description: payment_reminder_days
          writeOnly: true
          example: 15
        terms:
          type: string
          default: custom
          enum:
            - custom
            - '0'
            - '15'
            - '30'
            - '60'
            - '90'
            - '120'
            - 0m-1
            - 1m-1
            - 1m1
            - 2m1
            - 1m15
            - 1m20
            - 1m10
          description: |
            Term
            * `custom` - Custom
            * `0` - Upon Receipt
            * `15` - 15 days
            * `30` - 30 days
            * `60` - 60 days
            * `90` - 90 days
            * `120` - 120 days
            * `0m-1` - Last day this month
            * `1m-1` - Last day next month
            * `1m1` - 1st day next month
            * `2m1` - 1st day in two months
            * `1m15` - 15th day next month
            * `1m20` - 20th day next month
            * `1m10` - 10th day next month
          nullable: true
          example: 1m1
          writeOnly: true
        extra_info:
          type: string
          maxLength: 65535
          description: |
            A textual note that gives unstructured information that is relevant to the Invoice as a whole.

            ID: `BT-22`
          nullable: true
          example: Some extra info
        tax_report_ids:
          type: array
          description: An array containing the internal IDs of the associated Tax Reports.
          readOnly: true
          items:
            type: integer
        legal_literals:
          type: string
          maxLength: 255
          description: Certification
          example: Legal literals
          nullable: true
        delivery_party_name:
          type: string
          example: Delivery party name
          description: |
            The name of the party to which the goods and services are delivered.

            ID: `BT-70`
          maxLength: 255
          nullable: true
        delivery_location_id:
          type: string
          maxLength: 90
          description: |
            An identifier for the location at which the goods and services are delivered.

            ID: `BT-71`
          example: 83745498753497
          nullable: true
        delivery_location_type:
          type: string
          maxLength: 20
          description: |
            The identification scheme identifier of the Deliver to location identifier.

            ID: `BT-71` (attribute @schemeID)
          example: 88
          nullable: true
        delivery_date:
          type: string
          format: date
          description: |
            The date on which the supply of goods or services was made or completed.

            ID: `BT-72`
          example: '2024-07-07'
          nullable: true
        delivery_address:
          type: string
          maxLength: 160
          description: |
            Deliver to address. The main address line in an address.

            ID: `BT-75`
          example: Invented address, 1
          nullable: true
        delivery_address2:
          type: string
          maxLength: 160
          description: |
            Deliver to addresss line 2. An additional address line in an address that can be used to give further details supplmenting the main line.

            ID: `BT-76`
          example: Invented address, 2
          nullable: true
        delivery_postalcode:
          type: string
          maxLength: 60
          description: |
            The identifier for an addressable group of preperties according to the relevant postal service.

            ID: `BT-78`
          example: '80808'
          nullable: true
        delivery_city:
          type: string
          maxLength: 50
          description: |
            Deliver to city, The common name of the city, town or village, where the deliver to address is located.

            ID: `BT-77`
          example: Barcelona
          nullable: true
        delivery_province:
          type: string
          maxLength: 60
          description: |
            Deliver to country subdivision. The subdivision of a country. Such as a region, a county, a state, a province, etc.

            ID: `BT-79`
          example: Barcelona
          nullable: true
        delivery_country:
          type: string
          maxLength: 2
          description: |
            Deliver to country code. A code that identifies the country.

            ID: `BT-80`
          example: ES
          nullable: true
        download_legal_url:
          type: string
          description: The attachment of the original invoice if sent.
          readOnly: true
          nullable: true
          example: http://example.com
        public_url:
          type: string
          description: |
            The public page of the B2Brouter invoice, visible to the contact if the invoice status allows it. 
            For example, a new invoice does not have a public URL, but a sent invoice does.
          readOnly: true
          nullable: true
          example: http://example.com
        created_at:
          type: string
          format: datetime
          description: A datetime when the object was created in B2Brouter
          example: '2020-07-06T09:36:18Z'
          readOnly: true
        updated_at:
          type: string
          format: datetime
          description: A datetime of the last time the invoice was updated.
          example: '2020-07-06T09:36:18Z'
          readOnly: true
        state_updated_at:
          type: string
          format: datetime
          example: '2020-07-06T09:36:18Z'
          description: A datetime of the last time the state of the invoice was changed.
          readOnly: true
          nullable: true
        ack_at:
          type: string
          format: datetime
          example: '2020-07-06T09:36:18Z'
          description: The datetime when this Invoice was acknowledged
          readOnly: true
          nullable: true
        invoice_lines_attributes:
          type: array
          description: |
            A group of business terms providing information on individual invoice
            lines.


            ID: `BG-25`
          items:
            $ref: '#/components/schemas/InvoiceLine'
          writeOnly: true
          minItems: 1
        lines:
          type: array
          description: |
            A group of business terms providing information on individual invoice
            lines.
            Only shown if the query parameter "include" is "lines" or "detailed_lines".

            ID: `BG-25`
          items:
            $ref: '#/components/schemas/InvoiceLine'
          readOnly: true
          nullable: true
        payment_dues_attributes:
          type: array
          items:
            $ref: '#/components/schemas/PaymentDues'
          writeOnly: true
        payment_dues:
          type: array
          description: Represents a payment due as an object
          items:
            $ref: '#/components/schemas/PaymentDues'
          readOnly: true
        type_document:
          type: string
          description: |
            Value for mapping FatturaPA-specific values to the SDI document types.
            Explanation of each value:
            - TD01: Invoice (Fattura)
            - TD02: Advance payment on invoice (Acconto/Anticipo su fattura)
            - TD03: Advance payment on proforma invoice (Acconto/Anticipo su parcella)
            - TD04: Credit note (Nota di credito)
            - TD05: Debit note (Nota di debito)
            - TD06: Proforma invoice (Parcella)
            - TD16: Local reverse charge (Integrazione per acquisti interni)
            - TD17: Self invoice for EU services (Integrazione o autofattura per acquisti di servizi da soggetto non residente ai sensi dell’articolo 17, comma 2, DPR 633/1972)
            - TD18: EU acquisition reverse charge (Integrazione della fattura del fornitore UE per acquisto intracomunitario di beni)
            - TD19: Not resident acquisition reverse charge (Integrazione o autofattura per acquisti di beni da soggetti non residenti ai sensi dell’articolo 17, comma 2, DPR 633/1972)
            - TD20: Self invoice (Autofattura per regolarizzazione e integrazione delle fatture)
            - TD21: Regulated plafond self invoice (In caso di emissione di autofattura per regolarizzazione dello splafonamento)
            - TD22: VAT deposit (In caso di estrazione beni da Deposito IVA)
            - TD23: VAT deposit with VAT payment (In caso di estrazione beni da Deposito IVA con versamento dell’IVA) 
            - TD24: Deferred invoice with DDT (Fattura differita – art 21, 4 comma, lett. a), del DPR 633/72, quindi fattura differita di beni e servizi collegata a DDT per i beni o da idonea documentazione di prova dell’effettuazione per le prestazioni di servizio)
            - TD25: Deferred invoice for internal triangular operations (Fattura differita di cui all’art. 21, 4 comma, lett. b), del DPR 633/72, quindi fattura differita per operazioni triangolari interne)
            - TD26: Sales of assets (Per la cessione di beni ammortizzabili e per passaggi interni)
            - TD27: Free of charge or self-consumption (In caso di fatture per auto consumo o per cessioni gratuite senza rivalsa)
          enum:
            - TD01
            - TD02
            - TD03
            - TD04
            - TD05
            - TD06
            - TD16
            - TD17
            - TD18
            - TD19
            - TD20
            - TD21
            - TD22
            - TD23
            - TD24
            - TD25
            - TD26
            - TD27
          nullable: true
        tax_report_description:
          type: string
          maxLength: 255
          description: Description of the tax report. Sent to the tax authority.
          example: Tax report for Invoice 1
          writeOnly: true
        apply_taxes_to_charge:
          type: boolean
          description: Indicates whether taxes should be applied to the charge.
          default: false
        charge_is_reimbursable_expense:
          type: boolean
          description: |
            [Facturae Only]
            Indicates whether the charge is a reimbursable expense, which is a cost incurred on behalf of the contact that will be reimbursed.   Taxes cannot be applied to a reimbursable expense, `apply_taxes_to_charge` must be `false`.
          default: false
        client_email_override:
          type: string
          maxLength: 200
          description: List of destination emails, separated by commas.
          writeOnly: true
          example: john_doe@example.net, jane_doe@example.net
        company_email_override:
          type: string
          maxLength: 200
          description: Your email
          writeOnly: true
          example: john_doe_override@example.net
        contact_person:
          type: string
          maxLength: 170
          description: |
            Contact person

            Use `customer_contact_person` instead.
          writeOnly: true
          example: John Doe
          deprecated: true
        receiver_contract_reference:
          type: string
          maxLength: 255
          description: Assignment code
          writeOnly: true
          example: '123'
        dire:
          type: string
          maxLength: 16
          description: Receiver code (DIRe)
          writeOnly: true
          example: ES12345678
        fa_address:
          type: string
          maxLength: 160
          description: Factoring assignment - Address
          writeOnly: true
          example: Invented address, 1
        fa_bank_code:
          type: string
          maxLength: 30
          description: Factoring assignment - Bank code
          writeOnly: true
          example: ES6000000000000000000000
        fa_bic:
          type: string
          description: Factoring assignment - BIC
          writeOnly: true
          example: '123'
        fa_clauses:
          type: string
          maxLength: 65535
          description: Factoring assignment - Assignment clause
          writeOnly: true
          example: Clauses
        fa_country:
          type: string
          maxLength: 2
          description: Factoring assignment - Country
          writeOnly: true
          example: ES
        fa_duedate:
          type: string
          format: date
          description: Factoring assignment - Due date
          writeOnly: true
          example: '2024-09-12'
        fa_iban:
          type: string
          maxLength: 40
          description: Factoring assignment - IBAN
          writeOnly: true
          example: ES6000000000000000000000
        fa_import:
          type: number
          format: float
          description: Factoring assignment - Amount
          writeOnly: true
          example: 100
        fa_info:
          type: string
          maxLength: 70
          description: Factoring assignment - Information
          writeOnly: true
          example: Information
        fa_name:
          type: string
          maxLength: 60
          description: Factoring assignment - Name
          writeOnly: true
          example: Name
        fa_payment_method:
          type: string
          maxLength: 2
          description: Factoring assignment - Payment method
          writeOnly: true
          example: '2'
        fa_person_type:
          type: string
          maxLength: 1
          description: Factoring assignment - Entity type
          writeOnly: true
          example: J
        fa_postcode:
          type: string
          maxLength: 10
          description: Factoring assignment - Postcode
          writeOnly: true
          example: '80808'
        fa_province:
          type: string
          maxLength: 60
          description: Factoring assignment - Province
          writeOnly: true
          example: Barcelona
        fa_residence_type:
          type: string
          maxLength: 1
          description: Factoring assignment - Residence type
          writeOnly: true
        fa_taxcode:
          type: string
          maxLength: 20
          description: Factoring assignment - VAT ID number
          writeOnly: true
          example: ES12345678
        fa_town:
          type: string
          maxLength: 50
          description: Factoring assignment - City
          writeOnly: true
          example: Barcelona
        num_contracte:
          type: string
          maxLength: 50
          description: Number of contract. Now is used `contract_number`.
          writeOnly: true
          deprecated: true
          example: '1234'
        oficina_comptable:
          type: string
          maxLength: 16
          description: Accounting unit. Now is used `accounting_unit`.
          writeOnly: true
          deprecated: true
          example: ES00000000
        accounting_unit:
          type: string
          maxLength: 16
          description: Accounting unit
          writeOnly: true
          example: ES00000000
        organ_gestor:
          type: string
          maxLength: 16
          description: Managing unit. Now is used `managing_unit`.
          writeOnly: true
          deprecated: true
          example: ES00000000
        managing_unit:
          type: string
          maxLength: 16
          description: Managing unit
          writeOnly: true
          example: ES00000000
        organ_proponent:
          type: string
          maxLength: 16
          description: Proponent unit. Now is used `proponent_unit`.
          writeOnly: true
          deprecated: true
          example: ES00000000
        proponent_unit:
          type: string
          maxLength: 16
          description: Proponent unit
          writeOnly: true
          example: ES00000000
        special_regime_key:
          type: string
          enum:
            - '01'
            - '02'
            - '03'
            - '04'
            - '05'
            - '06'
            - '07'
            - '08'
            - '09'
            - '10'
            - '11'
            - '12'
            - '13'
            - '14'
            - '15'
            - '51'
            - '52'
            - '53'
          description: |
            Keys to the VAT regime and operations with tax significance
             * `01` - General Regime Operation
             * `02` - Export
             * `03` - Operations to which the special regime for used goods, objects of art, antiques and collectibles applies
             * `04` - Special investment gold regime
             * `05` - Special scheme for travel agents
             * `06` - Special regime group of entities in VAT
             * `07` - Special cash criterion regime
             * `08` -  Operations subject to the IPSI / IGIC
             * `09` - Invoicing of the provision of services of travel agencies that act as mediators on behalf of and on behalf of another
             * `10` - Collections on behalf of third parties of professional fees or rights derived from industrial property, copyright or others on behalf of its partners, associates or collegiate members made by companies, associations, professional associations or other entities that perform these collection functions.
             * `11` - Leasing operations of business premises subject to withholding
             * `12` - Business premises lease operations not subject to withholding
             * `13` - Leasing operations of business premises subject and not subject to withholding
             * `14` - Invoice with VAT pending accrual in work certifications whose recipient is a Public Administration
             * `15` - Invoice with VAT pending accrual in successive tract operations
             * `51` - Operations in equivalence surcharge
             * `52` - Operations in simplified regime
             * `53` - Operations carried out by persons or entities that are not considered businessmen, businesswomen or professionals for VAT purposes
          writeOnly: true
          example: '01'
        special_regime_key_additional:
          type: string
          enum:
            - '01'
            - '02'
            - '03'
            - '04'
            - '05'
            - '06'
            - '07'
            - '08'
            - '09'
            - '10'
            - '11'
            - '12'
            - '13'
            - '14'
            - '15'
            - '51'
            - '52'
            - '53'
          description: |
            Keys to the VAT regime and operations with tax significance
             * `01` - General Regime Operation
             * `02` - Export
             * `03` - Operations to which the special regime for used goods, objects of art, antiques and collectibles applies
             * `04` - Special investment gold regime
             * `05` - Special scheme for travel agents
             * `06` - Special regime group of entities in VAT
             * `07` - Special cash criterion regime
             * `08` -  Operations subject to the IPSI / IGIC
             * `09` - Invoicing of the provision of services of travel agencies that act as mediators on behalf of and on behalf of another
             * `10` - Collections on behalf of third parties of professional fees or rights derived from industrial property, copyright or others on behalf of its partners, associates or collegiate members made by companies, associations, professional associations or other entities that perform these collection functions.
             * `11` - Leasing operations of business premises subject to withholding
             * `12` - Business premises lease operations not subject to withholding
             * `13` - Leasing operations of business premises subject and not subject to withholding
             * `14` - Invoice with VAT pending accrual in work certifications whose recipient is a Public Administration
             * `15` - Invoice with VAT pending accrual in successive tract operations
             * `51` - Operations in equivalence surcharge
             * `52` - Operations in simplified regime
             * `53` - Operations carried out by persons or entities that are not considered businessmen, businesswomen or professionals for VAT purposes
          writeOnly: true
          example: '01'
        unidad_contratacion:
          type: string
          maxLength: 110
          description: Contracting Unit / SEF. Now is used contract_unit.
          writeOnly: true
          deprecated: true
          example: Contracting Unit
        contract_unit:
          type: string
          maxLength: 110
          description: Contracting Unit / SEF
          writeOnly: true
          example: Contracting Unit
        unitat_tramitadora:
          type: string
          maxLength: 16
          description: Processing unit. Now is used processing_unit.
          writeOnly: true
          deprecated: true
          example: Processing Unit
        processing_unit:
          type: string
          maxLength: 16
          description: Processing unit.
          writeOnly: true
          example: Processing Unit
        unitat_tramitadora_name:
          type: string
          maxLength: 255
          description: Name of processing unit.
          writeOnly: true
          deprecated: true
          example: Processing Unit Name
        amend_code_tax:
          type: string
          enum:
            - R1
            - R2
            - R3
            - R4
            - R5
          description: |
            Code of credit note (only needed for tax reports)
             * `R1` - Error founded in law and Art. 80 One, Two and Six of the Foral VAT Regulation
             * `R2` - Article 80 Three of the Foral VAT Regulationial
             * `R3` - Article 80 Four of the Foral VAT Regulation
             * `R4` - Rest
             * `R5` - Corrective invoice in simplified invoices
          writeOnly: true
          example: R1
        type_operation:
          type: string
          enum:
            - services
            - goods
          description: Type of operation (needed for tax reports)
          writeOnly: true
          example: services
    CardAccountUpdate:
      allOf:
        - $ref: '#/components/schemas/CardAccountCommon'
        - type: object
          properties:
            id:
              type: integer
              description: A unique identifier for this CardAccount across all the system.
              readOnly: false
            _destroy:
              type: integer
              description: |
                Deletes the card account of the invoice 
                To delete the card account, set this field to `1`. If set to `0` or null, no action is taken.
              example: 1
              nullable: true
              writeOnly: true
              enum:
                - 1
                - 0
    StateInput:
      type: string
      example: refused
      writeOnly: true
      enum:
        - new
        - sent
        - accepted
        - registered
        - refused
        - closed
        - paid
        - annotated
      description: |
        Valid states for an issued invoice:
         * `new` - The initial status of an issued invoice.
         * `sent` - The invoice has been sent successfully.
         * `accepted` - When the invoice is marked as accepted.
         * `registered` -  When a registered notification has been received or manually marked as registered.
         * `refused` - When a refused notification has been received or manually marked as refused.
         * `closed` - Is a final state.

        Valid states for a received invoice:
         * `new` - The initial status of an issued invoice or the invoice is manually marked as new.
         * `paid` - When the invoice has been paid or the invoice is marked manually as paid.
         * `accepted` - When the invoice is marked as accepted.
         * `refused` - When the invoice is marked as refused.
         * `annotated` - When the invoice is marked annotated.
    InvoiceUpdate:
      allOf:
        - $ref: '#/components/schemas/Invoice'
        - type: object
          properties:
            iban:
              writeOnly: false
              readOnly: true
            bic:
              writeOnly: false
              readOnly: true
            bank_account:
              readOnly: true
            card_account_attributes:
              description: |
                Represents the card account of the customer party. 
                Use this field to update/create the card account for this invoice.
              type: object
              allOf:
                - $ref: '#/components/schemas/CardAccountUpdate'
            contact:
              readOnly: true
            client:
              readOnly: true
            state:
              description: |
                State of the invoice. To switch the state of an invoice, use the `/invoices/{id}/mark_as.{format}` endpoint instead.
              deprecated: true
              allOf:
                - $ref: '#/components/schemas/StateInput'
            invoice_lines_attributes:
              type: array
              items:
                allOf:
                  - $ref: '#/components/schemas/InvoiceLine'
                  - type: object
                    properties:
                      id:
                        type: integer
                        description: Unique identifier for the invoice line to update. Do not inform when creating a new line.
                        readOnly: false
                        writeOnly: true
                      _destroy:
                        type: integer
                        description: |
                          Marks an existing invoice line for deletion. 
                          To delete a line, set this field to `1` and provide the `id` field. If the `id` field is missing or not provided, the deletion will not occur. If set to `0` or null, no action is taken.
                        example: 1
                        nullable: true
                        writeOnly: true
                        enum:
                          - 1
                          - 0
    InvoiceReduced:
      type: object
      description: Represents an invoice with reduced fields as an object
      required:
        - number
        - date
      properties:
        id:
          type: integer
          example: 4053100
          description: |
            A unique internal identifier of the Invoice in B2Brouter.
          readOnly: true
        number:
          type: string
          example: '3'
          description: |
            A unique identification of the Invoice.

            ID: `BT-1`
          maxLength: 100
        file_reference:
          type: string
          description: |
            The identification of the project the invoice refers to.

            ID: `BT-11`
          maxLength: 255
          example: PID33
          nullable: true
        series_code:
          type: string
          example: S01
          description: |
            The series code of the Invoice.
        date:
          type: string
          format: date
          description: |
            The date when the Invoice was issued.

            ID: `BT-2`
          example: '2020-11-12'
        due_date:
          type: string
          format: date
          description: |
            The date when the payment is due.

            ID: `BT-9`
          example: '2021-01-04'
          nullable: true
        client:
          type: object
          properties:
            id:
              type: integer
              example: 326116
              description: Client ID
            name:
              type: string
              example: Client 2
              description: Name of the client or provider
            taxcode:
              type: string
              description: Taxcode
              example: ES12345678
          readOnly: true
        state:
          $ref: '#/components/schemas/StateOutput'
        total:
          type: number
          format: float
          example: 363.5
          readOnly: true
        currency:
          type: string
          example: EUR
          description: |
            "The currency in which all Invoice amounts are given, except for the Total VAT amount in accounting currency."

            ID: `BT-5`
          maxLength: 3
        created_at:
          type: string
          format: datetime
          description: A datetime when the object was created in B2Brouter
          example: '2020-07-06T09:36:18Z'
          readOnly: true
        updated_at:
          type: string
          format: datetime
          description: A datetime of the last time the invoice was updated.
          example: '2020-07-06T09:36:18Z'
          readOnly: true
        state_updated_at:
          type: string
          format: datetime
          example: '2020-07-06T09:36:18Z'
          description: A datetime of the last time the state of the invoice was changed.
          readOnly: true
          nullable: true
        from_net_id:
          type: string
          readOnly: true
          nullable: true
          example: '123'
        from_net_meta:
          type: string
          readOnly: true
          nullable: true
          example: '123'
        to_net_id:
          type: string
          readOnly: true
          nullable: true
          example: '123'
    SendAfterImport:
      type: boolean
      default: false
      example: true
      enum:
        - true
        - false
      description: |
        A flag to indicate whether the invoice should be sent after import. The invoice will only be sent if it passes all validations.
        **Note:** This option is incompatible with the custom signature configuration.
    InvoiceMarkAsCommit:
      type: string
      description: |
        Used to send notification of the state chan via mail to the client.
        Only for Received Invoices and for states 'accepted', 'refused' & 'paid'.
      example: with_mail
      enum:
        - with_mail
    InvoiceMarkAsReason:
      type: string
      example: Write here the reason of the state change, if you want.
      description: |
        To annotate the reason of the state change, if commit is 'with_mail',
        and the new state is 'accepted', 'refused' or 'paid', the reason will be
        included in the mail sent to the client.
    ErrorItem:
      type: string
      description: Error message
      example: The invoice cannot be marked as new
    Attachment:
      type: object
      description: Represents an attachment as an object
      properties:
        filename:
          type: string
          example: minimal.pdf
    Message:
      type: object
      description: Represents a message as an object
      properties:
        message:
          type: string
          example: Message
    ErrorMessage:
      type: object
      description: Represents an error message as an object
      properties:
        message:
          type: string
          example: Expected attachments to be a ZIP file, found .pdf
    TaxReportGenerated:
      type: object
      description: Response after generating a tax report
      properties:
        id:
          type: integer
          example: 123
      xml:
        name: tax_report
    OrderId:
      type: integer
      example: 4053100
      title: Order ID
      description: Unique identifier of the **Order** in B2Brouter.
      readOnly: true
    OrderLine:
      type: object
      description: A group of business terms providing information on individual Order lines.
      properties:
        position:
          type: integer
          example: 1
          description: position
          writeOnly: true
        name:
          type: string
          example: Item name
          description: Item name.
          maxLength: 65535
        description:
          type: string
          example: Item description
          description: Item description.
          maxLength: 65535
        quantity:
          type: number
          format: decimal
          example: 1
          description: Item quantity.
          maxLength: 255
        unit_code:
          type: string
          description: Item quantity unit code.
          maxLength: 65535
          example: '1'
        price:
          type: number
          format: decimal
          example: 33.3
          description: The price of an item, exclusive of VAT,after subtracting item price discount.
          maxLength: 255
        total_cost:
          type: number
          format: decimal
          example: 33.3
          description: Price * Quantity
          maxLength: 255
          readOnly: true
        sellers_item_id:
          type: string
          example: BB12KG
          description: Sellers item identifier.
          maxLength: 255
        additional_item_properties:
          type: object
          description: Additional item properties.
          readOnly: true
        standard_item_identification:
          type: string
          description: Standard item identification.
          maxLength: 255
          example: Item identification
        item_document_reference:
          type: string
          description: Item document reference.
          maxLength: 255
          example: Item reference
        delivery_date_start:
          type: string
          format: date
          example: '2020-11-01'
          description: Order line delivery start date.
          maxLength: 255
        delivery_date_end:
          type: string
          format: date
          example: '2020-11-20'
          description: Order line delivery end date.
          maxLength: 255
        note:
          type: string
          example: Note
          description: A note for an order line.
          maxLength: 255
    Order:
      type: object
      description: Represents an order as an object
      properties:
        id:
          $ref: '#/components/schemas/OrderId'
        project:
          type: object
          properties:
            id:
              type: integer
              example: 742
              description: ID Project
            name:
              type: string
              example: B2Brouter Global, S.L.
              description: Project Name
          readOnly: true
        company:
          type: object
          properties:
            id:
              type: integer
              example: 326116
              description: Client ID
            name:
              type: string
              example: Client 2
              description: Name of the client or provider
            taxcode:
              type: string
              description: Taxcode
              example: ES12345678
          readOnly: true
        client:
          type: object
          description: Represents a client as an object
          properties:
            id:
              type: integer
              example: 326116
              description: Client ID
            name:
              type: string
              example: Client 2
              description: Name of the client or provider
            taxcode:
              type: string
              description: Taxcode
              example: ES12345678
            address:
              type: string
              description: Address
              maxLength: 255
              nullable: true
              example: Carrer de Sant Antoni, 12
            address2:
              type: string
              description: Address 2
              maxLength: 255
              nullable: true
              example: Carrer de Sant Antoni, 13
            postalcode:
              type: string
              example: '80808'
              description: Postcode
              maxLength: 255
              nullable: true
            city:
              type: string
              example: Barcelona
              description: City
              maxLength: 255
              nullable: true
            province:
              type: string
              example: Barcelona
              description: Region/Province/County
              maxLength: 255
              nullable: true
            country:
              type: string
              example: es
              description: Country
              maxLength: 255
          readOnly: true
        accounting_party:
          type: object
          description: Represents an accounting party as an object
          properties:
            id:
              type: integer
              example: 326116
              description: Client ID
            name:
              type: string
              example: Client 2
              description: Name of the client or provider
            taxcode:
              type: string
              description: Taxcode
              example: ES12345678
            address:
              type: string
              description: Address
              maxLength: 255
              nullable: true
              example: Carrer de Sant Antoni, 14
            address2:
              type: string
              description: Address 2
              maxLength: 255
              nullable: true
              example: Carrer de Sant Antoni, 15
            postalcode:
              type: string
              example: '80808'
              description: Postcode
              maxLength: 255
            city:
              type: string
              example: Barcelona
              description: City
              maxLength: 255
              nullable: true
            province:
              type: string
              example: Barcelona
              description: Region/Province/County
              maxLength: 255
              nullable: true
            country:
              type: string
              example: es
              description: Country
              maxLength: 255
          readOnly: true
        number:
          type: string
          example: '3'
          description: |
            A unique identification of the Order.
          maxLength: 100
        issue_datetime:
          type: string
          format: datetime
          description: A datetime when the order was issued.
          example: '2020-07-06T09:36:18Z'
          readOnly: true
        currency:
          type: string
          example: EUR
          description: The currency in which all Invoice amounts are given, except for the Total VAT amount in accounting currency.
          maxLength: 3
          nullable: true
        validity_start:
          type: string
          format: date
          description: Validity start
          example: '2020-11-01'
          nullable: true
        validity_end:
          type: string
          format: date
          description: Validity end
          example: '2020-12-01'
          nullable: true
        contract:
          type: string
          example: Contract
          description: Contract
          maxLength: 255
          nullable: true
        type_code:
          type: string
          example: Type code
          description: Type code
          maxLength: 255
          nullable: true
        state:
          type: string
          description: State of order
          example: received
          maxLength: 255
        is_confirmation:
          type: boolean
          default: false
          example: true
          enum:
            - true
            - false
          description: Is confirmation
        anticipated_amount_in_cents:
          type: integer
          example: 3330
          description: Anticipated amount in cents.
          readOnly: true
        invoice_id:
          type: integer
          example: 4053100
          description: A unique internal identifier of the Invoice in B2Brouter.
          readOnly: true
          nullable: true
        delivery_date_start:
          type: string
          format: date
          description: Delivery date start
          example: '2020-11-01'
          nullable: true
        delivery_date_end:
          type: string
          format: date
          description: Delivery date end
          example: '2020-11-12'
          nullable: true
        delivery_address:
          type: string
          example: Address 1
          description: Delivery address 1
          maxLength: 255
          nullable: true
        delivery_address2:
          type: string
          example: Address 2
          description: Delivery address 2
          maxLength: 255
          nullable: true
        delivery_address3:
          type: string
          example: Address 3
          description: Delivery address 3
          maxLength: 255
          nullable: true
        delivery_city:
          type: string
          example: Barcelona
          description: Delivery city
          maxLength: 255
          nullable: true
        delivery_postalcode:
          type: string
          example: '80808'
          description: Delivery postal code
          maxLength: 255
          nullable: true
        delivery_province:
          type: string
          example: Barcelona
          description: Region/Province/County
          maxLength: 255
          nullable: true
        delivery_country:
          type: string
          example: es
          description: Delivery country
          maxLength: 255
          nullable: true
        delivery_party_id:
          type: string
          example: '111'
          description: Delivery party id
          maxLength: 255
          nullable: true
        delivery_party_scheme:
          type: string
          example: '9920'
          description: Delivery party scheme
          maxLength: 255
          nullable: true
        delivery_party_name:
          type: string
          example: Delivery party name
          description: Delivery party name
          maxLength: 255
          nullable: true
        delivery_location_id:
          type: string
          example: '111'
          description: Delivery location id
          maxLength: 255
          nullable: true
        delivery_location_name:
          type: string
          example: Delivery party name
          description: Delivery location name
          maxLength: 255
          nullable: true
        originator_id:
          type: string
          example: '111'
          description: Originator id
          maxLength: 255
          nullable: true
        originator_name:
          type: string
          example: Originator name
          description: Originator name
          maxLength: 255
          nullable: true
        buyer_contact_name:
          type: string
          example: Buyer contac name
          description: Buyer contac name
          maxLength: 255
          nullable: true
        buyer_contact_phone:
          type: string
          example: '6666666666'
          description: Phone
          maxLength: 255
          nullable: true
        buyer_contact_email:
          type: string
          example: mail@client1.com
          description: Email
          maxLength: 255
          nullable: true
        notes:
          type: string
          example: Notes
          nullable: true
        order_format:
          type: string
          example: ubl
          nullable: true
        additional_document_references:
          type: object
          description: Additional Order references.
          readOnly: true
          nullable: true
        order_lines:
          type: array
          description: |
            A group of business terms providing information on individual order lines.
          items:
            $ref: '#/components/schemas/OrderLine'
          readOnly: true
        attachments:
          type: array
          description: |
            A group of business terms providing information on attachments.
          items:
            type: object
            properties:
              link:
                type: string
                example: /attachments/download/1/order.xml
              content_type:
                type: string
                example: text/xml
          readOnly: true
        created_at:
          type: string
          format: datetime
          description: A datetime when the object was created in B2Brouter.
          example: '2020-07-06T09:36:18Z'
          readOnly: true
        updated_at:
          type: string
          format: datetime
          description: A datetime of the last time the invoice was updated.
          example: '2020-07-06T09:36:18Z'
          readOnly: true
    OrderState:
      type: string
      example: received
      enum:
        - delivery_confirmed
        - closed
        - accepted
        - refused
        - received
      description: |
        Some states for an order:
         * `delivery_confirmed` - When the order is marked as the order has been confirmed.
         * `closed` - When the order is marked as closed.
         * `accepted` - When the order is marked as accepted.
         * `refused` - When the order is marked as refused.
         * `received` - The initial status of an order or when the order is marked as received.
    Client:
      type: object
      description: Represents a client as an object
      properties:
        id:
          type: integer
          example: 133842
          readOnly: true
          description: Internal ID
        taxcode:
          type: string
          description: |
            TaxCode. The Buyer's VAT identifier (also known as Buyer VAT identification number).
            Can be prefixed by a scheme code followed by a colon.

            ID: `BT-48`
          maxLength: 255
          example: ESA13585625
        name:
          type: string
          example: Client1
          description: Name
          maxLength: 255
        email:
          type: string
          example: mail@client1.com
          description: Email
          maxLength: 255
        phone:
          type: string
          example: '6666666666'
          description: Phone
          maxLength: 255
          nullable: true
        website:
          type: string
          description: Website
          maxLength: 255
          nullable: true
          example: https://www.client1.com
        address:
          type: string
          description: Address
          maxLength: 255
          nullable: true
          example: Invented Address, 1
        address2:
          type: string
          description: Address 2
          maxLength: 255
          nullable: true
          example: Invented Address, 2
        postalcode:
          type: string
          example: '80808'
          description: Postcode
          maxLength: 255
        city:
          type: string
          example: Barcelona
          description: City
          maxLength: 255
          nullable: true
        province:
          type: string
          example: Barcelona
          description: Region/Province/County
          maxLength: 255
          nullable: true
        country:
          type: string
          example: es
          description: Country
          maxLength: 255
        language:
          type: string
          example: es
          default: en
          description: |
            Contact language. It should be a language available inside B2Brouter. 
            You can check all available languages  using the **Languages** endpoint (`/users/languages.json`)
          enum:
            - en
            - es
            - ca
            - fr
            - it
            - de
            - pt
            - nl
            - pl
            - da
            - sv
            - ar
          maxLength: 2
        currency:
          type: string
          example: EUR
          description: |
            Default currency for the electronic documents related to this contact.
            You can check all supported currencies using the **Currencies** endpoint (`/users/currencies.json`)
          maxLength: 255
        is_client:
          type: boolean
          description: Indicates if the contact is a client for your organisation
          default: true
        is_provider:
          type: boolean
          description: Indicates if the contact is a provider for your organisation
          default: false
        invoice_format:
          type: string
          deprecated: true
          example: facturae_32
          description: Method for sending invoices. Now can be used the combination of fields `transport_type_code` and `document_type_code`
          maxLength: 255
          nullable: true
        transport_type:
          allOf:
            - $ref: '#/components/schemas/TransportTypeCode'
            - readOnly: true
              deprecated: true
        document_type:
          allOf:
            - $ref: '#/components/schemas/DocumentTypeCode'
            - readOnly: true
              deprecated: true
        transport_type_code:
          allOf:
            - $ref: '#/components/schemas/TransportTypeCode'
            - writeOnly: true
        document_type_code:
          allOf:
            - $ref: '#/components/schemas/DocumentTypeCode'
            - writeOnly: true
        cin_value:
          type: string
          description: Company Identifier Number
          nullable: true
          example: ES123456789
        cin_scheme:
          type: string
          description: |
            The scheme identifier of Company Identifier Number (not a tax identifier number).
            You can get all schemes codes using the **Schemes* endpoint (`/users/schemes.{format}`).
          nullable: true
          example: '9920'
        pin_value:
          type: string
          description: |
            Peppol Identifier Number, identifies the Buyer's electronic address to which the invoice is delivered.
          nullable: true
          example: ES123456789
        pin_scheme:
          type: string
          description: |
            The identification scheme identifier of the Buyer electronic address.

            You can get all schemes codes using the **Schemes* endpoint (`/users/schemes.{format}`). The value has to be in EAS code list
            https://docs.peppol.eu/poacc/billing/3.0/codelist/eas/
          nullable: true
          example: '9920'
        party_identification:
          type: string
          maxLength: 12
          description: |
            Seller/Buyer identifier

            ID: `BT-29` if Contact is a Seller
            ID: `BT-46` if Contact is a Buyer
          example: '506001234999'
          nullable: true
        bank_account:
          type: string
          description: |
            Bank account number
            Use the `bank_account_number` field instead.
          maxLength: 24
          example: ES6000000000000000000000
          deprecated: true
        bank_account_number:
          type: string
          description: Contact's bank account number (do not specify if IBAN + BIC is used)
          maxLength: 24
          example: ES6000000000000000000000
        iban:
          type: string
          description: Contact's IBAN (International Bank Account Number)
          maxLength: 255
          nullable: true
          example: ES6000000000000000000000
        bic:
          type: string
          description: Contact's BIC (Bank Identifier Code)
          maxLength: 255
          nullable: true
          example: 0
        bank_account_id:
          type: integer
          description: Internal Bank Account ID used to link the bank account configured for your account, where the contact deposits payments to you.
          example: 1234
          nullable: true
        payment_method:
          type: integer
          enum:
            - 0
            - 1
            - 2
            - 3
            - 4
            - 7
            - 10
            - 11
            - 12
            - 13
            - 14
            - 15
            - 17
            - 19
            - 54
            - 56
            - 58
            - 59
            - 101
            - 102
          example: 1
          description: |
            Payment method
             * `1` - Cash
             * `2` - Direct debit
             * `3` - Hold
             * `4` - Bank transfer
             * `7` - Awarded contract
             * `10` - Promissory note
             * `11` - Cheque
             * `12` - Reposition
             * `13` - Other
             * `14` - Compensation
             * `15` - Payment by postgiro
             * `17` - Bank cheque
             * `19` - Bank card
             * `54` - Credit card
             * `56` - Bank giro
             * `58` - SEPA bank transfer (SCT)
             * `59` - SEPA Direct Debit (SDD)   
             * `101` - GIRO
             * `102` - PayNow Corporate
          maxLength: 4
          nullable: true
        payment_method_text:
          type: string
          description: Payment method. The means, expressed as text, for how a payment is expected to be or has been settled.
          maxLength: 255
          nullable: true
          example: Credit transfer
        payment_reminder_days:
          type: integer
          description: payment_reminder_days
          maxLength: 4
          writeOnly: true
          example: 4
        terms:
          type: string
          default: custom
          enum:
            - custom
            - '0'
            - '15'
            - '30'
            - '60'
            - '90'
            - '120'
            - 0m-1
            - 1m-1
            - 1m1
            - 2m1
            - 1m15
            - 1m20
            - 1m10
          description: |
            Term
            * `custom` - Custom
            * `0` - Upon Receipt
            * `15` - 15 days
            * `30` - 30 days
            * `60` - 60 days
            * `90` - 90 days
            * `120` - 120 days
            * `0m-1` - Last day this month
            * `1m-1` - Last day next month
            * `1m1` - 1st day next month
            * `2m1` - 1st day in two months
            * `1m15` - 15th day next month
            * `1m20` - 20th day next month
            * `1m10` - 10th day next month
          maxLength: 255
          nullable: true
          example: 1m1
        sepa_type:
          type: string
          example: CORE
          description: SEPA payments type
          maxLength: 255
          nullable: true
        company_identifier:
          type: string
          nullable: true
          example: company-identifier
        department:
          type: string
          description: Department
          maxLength: 255
          writeOnly: true
          example: Sales
        description:
          type: string
          description: Description
          maxLength: 65535
          writeOnly: true
          example: Description
        contact_person:
          type: string
          description: Contact person
          maxLength: 200
          example: John Doe
        edi_code:
          type: string
          description: EDI Code
          maxLength: 255
          nullable: true
          example: '11111'
        payer_edi_code:
          type: string
          description: Payer EDI
          maxLength: 255
          writeOnly: true
          example: '11111'
        buyer_edi_code:
          type: string
          description: Buyer EDI
          maxLength: 255
          writeOnly: true
          example: '11111'
        destination_edi_code:
          type: string
          description: Delivery party EDI
          maxLength: 255
          writeOnly: true
          example: '11111'
        receiver_edi_code:
          type: string
          description: Receiver EDI
          maxLength: 255
          writeOnly: true
          example: '11111'
        public_sector:
          type: boolean
          description: Indicates if the contact is a public administration
          default: false
          writeOnly: true
        notes:
          type: string
          description: Notes
          maxLength: 65535
          writeOnly: true
          example: Notes for the client
        brd_additional_data:
          type: string
          description: Additional data
          maxLength: 255
          writeOnly: true
          example: Additional data
        vat_payability:
          type: string
          enum:
            - I
            - D
            - S
          example: I
          description: |
            VAT collection
             * `I` - Immediate
             * `D` - Deferred
             * `S` - Party
          writeOnly: true
        posta_elettronica_certificata:
          type: string
          description: Posta Elettronica Certificata. Now is used the field `certified_email`
          maxLength: 255
          writeOnly: true
          deprecated: true
          example: fatturapa@example.com
        certified_email:
          type: string
          description: |
            Used as the PEC (Posta Elettronica Certificata) address to send invoice through SDI. 
            A certified email guarantees legal certainty of the sender’s identity, of the date and time of sending and receiving the email, and of its content.
          maxLength: 255
          writeOnly: true
          example: certified@example.com
        codice_destinatario:
          type: string
          description: Codice Destinatario. Now is used the field `recipient_code`.
          maxLength: 7
          writeOnly: true
          deprecated: true
          example: '1234567'
        recipient_code:
          type: string
          pattern: \w{6,7}
          description: |
            The recipient code is a 7-digit alphanumeric code that represents the telematic address of the electronic invoice receiver and is assigned by the SDI (Interchange System).
          maxLength: 7
          example: '1234567'
        integration_code:
          type: string
          maxLength: 255
          description: |
            Internal code of the client in the ERP. 
            It is used by B2Brouter in the integration process to assign the document to this customer
          example: client_erpcode12345
          nullable: true
        routing_codes:
          type: object
          description: Routing codes
          properties:
            cin1_scheme:
              type: string
              nullable: true
              example: '9920'
            cin1_value:
              type: string
              nullable: true
              example: '12345678'
            cin2_scheme:
              type: string
              nullable: true
              example: '9920'
            cin2_value:
              type: string
              nullable: true
              example: '12345678'
            cin3_scheme:
              type: string
              nullable: true
              example: '9920'
            cin3_value:
              type: string
              nullable: true
              example: '12345678'
            cin4_scheme:
              type: string
              nullable: true
              example: '9920'
            cin4_value:
              type: string
              nullable: true
              example: '12345678'
            cin5_scheme:
              type: string
              nullable: true
              example: '9920'
            cin5_value:
              type: string
              nullable: true
              example: '12345678'
          readOnly: true
        created_at:
          type: string
          format: date-time
          example: '2024-07-07T11:51:57Z'
          readOnly: true
          description: Date and time when the client record was created
        updated_at:
          type: string
          format: date-time
          example: '2024-07-07T11:51:57Z'
          readOnly: true
          description: Date and time when the client record was last updated
    ClientWithRequiredAttributes:
      allOf:
        - $ref: '#/components/schemas/Client'
        - type: object
          description: Client object with required attributes
          required:
            - name
            - taxcode
            - country
    ClientReduced:
      type: object
      description: Client object with reduced attributes
      properties:
        id:
          type: integer
          example: 133842
          readOnly: true
          description: Client ID
        taxcode:
          type: string
          example: ESD29766391
          description: TaxCode
        name:
          type: string
          description: Name
          example: Client 1
        project:
          type: object
          properties:
            id:
              type: integer
              example: 435
            name:
              type: string
              example: b2brouter
          readOnly: true
        edi_code:
          type: string
          readOnly: true
          example: '11111'
        address:
          type: string
          description: Address
          writeOnly: true
          nullable: true
          example: Invented Address, 1
        postalcode:
          type: string
          description: Postal Code
          writeOnly: true
          example: '80808'
        city:
          type: string
          description: City
          writeOnly: true
          example: Barcelona
        province:
          type: string
          description: Province
          writeOnly: true
          example: Barcelona
        email:
          type: string
          description: Email
          writeOnly: true
          example: mail@client1.com
        integration_code:
          type: string
          maxLength: 255
          description: |
            Internal code of the client in the ERP. 
            It is used by B2Brouter in the integration process to assign the document to this customer
          example: client_erpcode12345
        created_at:
          type: string
          format: date-time
          example: '2021-01-16T19:12:44Z'
          readOnly: true
          description: Date and time when the client record was created
        updated_at:
          type: string
          format: date-time
          example: '2021-01-16T19:12:44Z'
          readOnly: true
          description: Date and time when the client record was last updated
    Channel:
      type: object
      description: Represents a channel as an object
      properties:
        name:
          type: string
          description: The name of the channel in the language of the user.
          example: Email with a link to the Invoice
        key:
          type: string
          description: The key to identify the entity
          example: b2brouter
      xml:
        name: channel
    Country:
      description: Represents a country as an object
      type: object
      properties:
        code:
          type: string
          example: fr
        name:
          type: string
          example: France
      xml:
        name: country
    Scheme:
      description: Represents a scheme as an object
      type: object
      properties:
        code:
          type: string
          example: '9920'
        name:
          type: string
          example: NIF (CIF)
        country:
          type: string
          example: es
          nullable: true
      xml:
        name: country
    Currency:
      description: Represents a currency as an object
      type: object
      properties:
        id:
          type: string
          example: eur
          description: The id of the entity.
        priority:
          type: number
          example: 2
        iso_code:
          type: string
          example: EUR
        name:
          type: string
          example: Euro
        symbol:
          type: string
          example: €
        subunit:
          type: string
          example: Cent
        subunit_to_unit:
          type: string
          example: '100'
        symbol_first:
          type: boolean
          example: true
        html_entity:
          type: string
          example: '&#x20AC;'
        decimal_mark:
          type: string
          example: ','
        thousands_separator:
          type: string
          example: .
        iso_numeric:
          type: string
          example: '987'
      xml:
        name: currency
    Language:
      description: Represents a currency as an object
      type: object
      properties:
        code:
          type: string
          example: de
        name:
          type: string
          example: Deutsch
      xml:
        name: language
    DocumentType:
      type: object
      title: Document Type
      description: Specifies the format of a specific document.
      properties:
        code:
          $ref: '#/components/schemas/DocumentTypeCode'
        name:
          type: string
          description: Name
          example: Peppol BIS3 Invoice
        document:
          type: string
          description: Document
          example: Invoice
        countries:
          type: array
          items:
            type: string
        can_export:
          type: boolean
          description: True if the document type can be sent.
          example: true
        can_import:
          type: boolean
          description: True if the document type can be received.
          example: true
    TransportType:
      type: object
      title: Transport Type
      description: Specifies the transport method of a specific document.
      properties:
        code:
          $ref: '#/components/schemas/TransportTypeCode'
        name:
          type: string
          description: Name
          example: Chorus PRO
        exportable_document_types:
          type: array
          description: The transport is capable of sending these document types.
          items:
            $ref: '#/components/schemas/DocumentTypeCode'
        importable_document_types:
          type: array
          description: The transport is capable of receiving these document types.
          items:
            $ref: '#/components/schemas/DocumentTypeCode'
        default_document_type:
          allOf:
            - $ref: '#/components/schemas/DocumentTypeCode'
            - description: Default document type.
        category:
          type: string
          description: Category
          example: pge
        country:
          type: string
          description: Country
          example: fr
        test_available:
          type: boolean
          description: Indicates if there is test environment available
          example: true
    InvoiceState:
      description: Represents a InvoiceState as an object
      type: object
      properties:
        state:
          type: string
          description: State of invoice
          example: received
        name:
          type: string
          description: State name translated
          example: Received
      xml:
        name: state
    Event:
      description: Represents an event as an object
      type: object
      properties:
        name:
          type: string
          example: delivered_notification
        text:
          type: string
          example: 'Notification: Sent Invoice'
        notes:
          type: string
          example: Description can not be blank
          description: Field that provides descriptive information about the event
        description:
          type: string
          example: |
            Notification: Sent invoice
            <a href="/events/file/2305470">Download notification</a>
        created_at:
          type: string
          format: date-time
          example: '2024-07-07T11:51:57Z'
        updated_at:
          type: string
          format: date-time
          example: '2024-07-07T11:51:57Z'
      xml:
        name: event
    InvoiceEvent:
      description: Represents an invoice event as an object
      allOf:
        - $ref: '#/components/schemas/Event'
        - type: object
          properties:
            invoice:
              type: object
              properties:
                id:
                  type: integer
                  example: 1452334
                number:
                  type: string
                  example: '54'
                state:
                  type: string
                  example: registered
                state_updated_at:
                  type: string
                  format: date-time
                  example: '2019-12-12T09:24:21Z'
      xml:
        name: event
    ClientEvent:
      allOf:
        - $ref: '#/components/schemas/Event'
        - type: object
          description: Represents an event for a client
          properties:
            client:
              type: object
              properties:
                id:
                  type: integer
                  example: 942
                  description: Client ID
                name:
                  type: string
                  example: Client name
                  description: Client Name
      xml:
        name: event
    TaxReport:
      type: object
      description: Represents a TaxReport as an object
      properties:
        id:
          type: integer
          example: 123
        label:
          type: string
          example: TicketBai ZZ/1
        state:
          type: string
          example: processing
          enum:
            - new
            - processing
            - sending
            - sent
            - registered
            - error
            - invalid
          description: |
            Some states for a Tax Report:
              * `processing` - Initial state of a TicketBAI TaxReport. The TicketBAI is being signed and chained. In this state the URL and the fingerprint won't be available.
              * `new` - The TaxReport has been created on B2Brouter. If it's a TicketBAI, it was successfully signed and chained, so you can now get the URL and the fingerprint.
              * `sending` - The TaxReport is in the queue waiting to be send.
              * `sent`  - The TaxReport has been successfully sent.
              * `registered` - The TaxReport has been successfully registered by the TaxAuthority.
              * `error` - There was an error sending the TaxReport or it was refused by the TaxAuthority.
              * `invalid` - The TaxReport does not pass XSD/SCH validations.
        sent_at:
          type: string
          format: date-time
          example: '2022-09-12T11:51:57Z'
          nullable: true
        created_at:
          type: string
          format: date-time
          example: '2022-09-12T11:51:57Z'
        url:
          type: string
          example: https://tbai.prep.gipuzkoa.eus/qr/?id=TBAI+is+not+ready+yet&s=ZZ&nf=1&i=89.36&cr=193
          nullable: true
        tax_authority_identifier:
          type: string
          description: TaxReport identifier set by the Tax Authority.
          example: '123456'
          nullable: true
        fingerprint:
          type: string
          description: Fingerprint of the TaxReport.
          example: TBAI-CXXXXXXXX-000000-BDFe4uB48zwL4-000
          nullable: true
        warnings:
          type: string
          nullable: true
      xml:
        name: tax_report
    TransportB2brouter:
      type: object
      description: Represents a configuration for transport B2Brouter
      properties:
        code:
          type: string
          enum:
            - ''
            - b2brouter
        enabled:
          description: Enable or disable the transport configuration.
          type: boolean
          example: true
          default: true
        reception:
          type: boolean
          default: false
          example: true
        created_at:
          type: string
          format: date-time
          example: '2024-07-07T11:51:57Z'
          readOnly: true
        updated_at:
          type: string
          format: date-time
          example: '2024-07-07T11:51:57Z'
          readOnly: true
    TransportEmail:
      type: object
      description: Represents a configuration for transport Email
      properties:
        code:
          type: string
          enum:
            - ''
            - email
        enabled:
          description: Enable or disable the transport configuration.
          type: boolean
          example: true
          default: true
        reception:
          type: boolean
          example: true
          default: false
        email_for_reception:
          type: string
          example: tin@b2brouter.email
          readOnly: true
        created_at:
          type: string
          format: date-time
          example: '2024-07-07T11:51:57Z'
          readOnly: true
        updated_at:
          type: string
          format: date-time
          example: '2024-07-07T11:51:57Z'
          readOnly: true
    TransportPeppol:
      type: object
      description: Represents a configuration for transport Peppol
      properties:
        code:
          type: string
          enum:
            - ''
            - peppol
        enabled:
          description: Enable or disable the transport configuration.
          type: boolean
          example: true
          default: true
        reception:
          type: boolean
          default: false
          example: true
        pin_scheme:
          description: pin_scheme
          type: number
          example: 1
        pin_value:
          description: pin_value
          type: string
          example: 1234
        created_at:
          type: string
          format: date-time
          example: '2024-07-07T11:51:57Z'
          readOnly: true
        updated_at:
          type: string
          format: date-time
          example: '2024-07-07T11:51:57Z'
          readOnly: true
    TransportUserPassword:
      type: object
      description: Represents a configuration for transport UserPassword
      properties:
        code:
          type: string
          enum:
            - ''
            - es.pecam
            - es.eusko_jaurlaritza
          example: es.pecam
        enabled:
          description: Enable or disable the transport configuration.
          type: boolean
          example: true
          default: true
        username:
          description: Username
          type: string
          example: user1234
        password:
          description: Password
          type: string
          example: 1234pass
        created_at:
          type: string
          format: date-time
          example: '2024-07-07T11:51:57Z'
          readOnly: true
        updated_at:
          type: string
          format: date-time
          example: '2024-07-07T11:51:57Z'
          readOnly: true
    TransportEdi:
      type: object
      description: Represents a configuration for transport EDI
      properties:
        code:
          type: string
          enum:
            - ''
            - ediversa
            - edicom
        enabled:
          description: Enable or disable the transport configuration.
          type: boolean
          example: true
          default: true
        username:
          description: Username
          type: string
          example: user1234
        password:
          description: Password
          type: string
          example: 1234pass
        edi_identifier:
          description: PO EDI legal
          type: string
          example: 1234edi
        created_at:
          type: string
          format: date-time
          example: '2024-07-07T11:51:57Z'
          readOnly: true
        updated_at:
          type: string
          format: date-time
          example: '2024-07-07T11:51:57Z'
          readOnly: true
    TaxBreakdowns:
      type: object
      description: |
        Represents a TaxBreakdown, referred to as "Desglose" in the Verifactu system. A TaxBreakdown contains all the detailed information about the tax category applied to a specific operation. It includes the tax base, the tax amount, and other relevant information necessary for tax reporting.
      properties:
        id:
          type: integer
          example: 355040
          description: |
            An internal identifier that is unique to each **Tax Breakdown** within B2Brouter.
          readOnly: true
        kind:
          type: string
          enum:
            - charged
            - withheld
          example: charged
          writeOnly: true
        date:
          type: string
          format: date
          example: '2025-04-10'
          writeOnly: true
        name:
          type: string
          example: IVA
        currency:
          type: string
          example: EUR
          writeOnly: true
        original_currency:
          type: string
          example: EUR
          writeOnly: true
        category:
          type: string
          enum:
            - E
            - NS
            - Z
            - S
            - H
            - AA
            - AAA
            - AE
            - G
            - O
            - K
          example: S
          description: |
            Taxes categories
             * `E` - Exempt
             * `NS` - NotSubject
             * `Z` - ZeroRated
             * `S` - Standard
             * `H` - High Rate
             * `AA` - Low Rate
             * `AAA` - Super Low Rate
             * `AE` - Reverse
             * `G` - Free export item, VAT not charged
             * `O` - Services outside scope of tax
             * `K` - VAT exempt for EEA intra-community supply of goods and services
        special_regime_key:
          type: string
          example: '01'
          nullable: true
          enum:
            - '01'
            - '02'
            - '03'
            - '04'
            - '05'
            - '06'
            - '07'
            - '08'
            - '09'
            - '10'
            - '11'
            - '12'
            - '13'
            - '14'
            - '15'
            - '17'
            - '19'
            - '20'
            - '51'
            - '52'
            - '53'
            - '54'
          description: |
            VAT regime key and operations with tax significance.

            - `01`,`02`,`03`,`04`,`05`,`06`,`07`,`08`,`09`,`10`,`11`,`14`,`15`,`17`,`18`,`19`,`20`: Codes used for Verifactu.
            - `01`,`02`,`03`,`04`,`05`,`06`,`07`,`08`,`09`,`10`,`11`,`14`,`15`,`17`,`18`,`19`,`51`,`52`,`53`,`54`: Codes used for TicketBAI.
        non_exempt:
          type: boolean
          example: true
        non_exemption_code:
          type: string
          example: S1
        no_subject:
          type: boolean
          example: false
          default: false
        no_subject_code:
          type: string
          nullable: true
          enum:
            - N1
            - N2
            - OT
            - RL
            - IE
            - VT
          description: |
            Reason code for No Suject. 
            - `N1`, `N2`: Codes used for Verifactu.
            - `OT`, `RL`, `IE`, `VT`: Codes used for TicketBAI.

            This field is required when `no_subject` is set to true.
        exempt:
          type: boolean
          example: false
        exemption_code:
          type: string
          nullable: true
          enum:
            - E1
            - E2
            - E3
            - E4
            - E5
            - E6
          description: |
            Reason code for VAT Exemption. 
            The provided code list is for Verifactu and TicketBAI.

            This field is required when `exempt` is set to true.
        kind_equivalence_surcharge:
          type: string
          nullable: true
          writeOnly: true
        scope:
          type: string
          enum:
            - domestic
            - international
          example: domestic
          writeOnly: true
        type_operation:
          type: string
          enum:
            - services
            - goods
          example: services
          writeOnly: true
        amend:
          type: boolean
          example: false
          writeOnly: true
        withheld:
          type: boolean
          example: false
          default: false
          writeOnly: true
        investment_good:
          type: boolean
          example: false
          default: false
          writeOnly: true
        comment:
          type: string
          nullable: true
          writeOnly: true
        percent:
          type: number
          format: decimal
          example: 21
        taxable_base:
          type: number
          format: decimal
          example: 123
        tax_amount:
          type: number
          format: decimal
          example: 25.83
        tax_amount_equivalence_surcharge:
          type: number
          format: decimal
          example: 0
          writeOnly: true
        base_imponible_a_coste:
          type: number
          format: decimal
      xml:
        name: tax_breakdown
    NewTaxReport:
      type: object
      description: Represents a TaxReport object, such as the ones generated by Verifactu
      properties:
        id:
          type: integer
          example: 6560
          description: |
            An internal identifier that is unique to each **Tax report** within B2Brouter.
        type:
          type: string
          example: Verifactu
          enum:
            - Verifactu
            - TicketBai
            - Sdi
            - MyInvois
            - Zatca
        invoice_id:
          type: integer
          example: 77
          description: |
            An internal identifier that is unique to each **Invoice** within B2Brouter.
        state:
          type: string
          example: registered
          enum:
            - new
            - processing
            - sending
            - sent
            - registered
            - error
            - invalid
          description: |
            States for a Tax Report:
              * `processing` - Initial state of a TaxReport. The report is being signed and validated.
              * `new` - The TaxReport is created and validated, ready for further actions.
              * `sending` - The report is in the queue for transmission.
              * `sent`  - The report was successfully transmitted.
              * `registered` - The TaxReport has been registered by the Tax Authority.
              * `error` - There was an error during submission, or it was rejected by the Tax Authority.
              * `invalid` - The report failed validation checks.
          readOnly: true
        qr:
          type: string
          description: |
            The QR code codified in base64 of the tax report.
        xml_base64:
          type: string
          description: |
            The XML representation of the tax report codified in base64.
        sent_at:
          type: string
          format: date-time
          example: '2025-04-10T10:14:31Z'
          nullable: true
          readOnly: true
        created_at:
          type: string
          format: date-time
          example: '2025-04-10T10:14:21.157690000Z'
          readOnly: true
        updated_at:
          type: string
          format: date-time
          example: '2025-04-10T10:14:29.259065000Z'
          readOnly: true
        label:
          type: string
          example: Verifactu A/1
        has_errors:
          type: boolean
          example: false
          description: Indicates if there are any errors in the report.
        has_warnings:
          type: boolean
          nullable: true
          description: Indicates if there are any warnings in the report.
        from_net:
          type: string
          nullable: true
        from_net_id:
          type: string
          nullable: true
        to_net:
          type: string
          example: b2brouter
        to_net_id:
          type: string
          example: A-TGEZLKMKVK9VVN
        ledger_id:
          type: integer
          example: 1096
          description: |
            An internal identifier that is unique to each **Ledger** within B2Brouter.
          readOnly: true
        tax_report_setting_id:
          type: integer
          example: 624
        document_type_code:
          type: string
          example: xml.tax_report.verifactu.alta
        transport_type_code:
          type: string
          example: es.verifactu
        annulled_by_id:
          type: integer
          nullable: true
        generation_timestamp:
          type: string
          format: date-time
          example: '2025-04-10T10:14:25.337580000Z'
        tax_point_date:
          type: string
          nullable: true
        chained_at:
          type: string
          nullable: true
        invoice_date:
          type: string
          format: date
          example: '2025-04-10'
        invoice_number:
          type: string
          example: '111234126332'
        invoice_series_code:
          type: string
          nullable: true
        fiscal_year:
          type: integer
          nullable: true
        fiscal_period:
          type: integer
          nullable: true
        amended_number:
          type: string
          nullable: true
        amended_series_code:
          type: string
          nullable: true
        amended_date:
          type: string
          nullable: true
        amended_line_extension:
          type: number
          format: decimal
          nullable: true
        amended_tax_amount:
          type: number
          format: decimal
          nullable: true
        amended_tax_exclusive:
          type: number
          format: decimal
          nullable: true
        amended_tax_inclusive:
          type: number
          format: decimal
          nullable: true
        amended_charge_total:
          type: number
          format: decimal
          nullable: true
        amended_payable:
          type: number
          format: decimal
          nullable: true
        amended_quota_recargo_equivalencia:
          type: number
          format: decimal
          nullable: true
        amend_type:
          type: string
          nullable: true
        invoice_type_code:
          type: string
          example: F1
        operation_type:
          type: string
          nullable: true
        external_reference:
          type: string
          nullable: true
        description:
          type: string
          example: Factura 111234126332
        annullation:
          type: boolean
          example: false
          default: false
        correction:
          type: boolean
          example: false
        ticket:
          type: boolean
          example: false
        issued_by_third_party_or_receiver:
          type: boolean
          example: false
        customer_party_name:
          type: string
          example: Ingent Grup Systems, SL
        customer_party_id:
          type: string
          nullable: true
        customer_party_scheme:
          type: string
          nullable: true
        customer_party_tax_id:
          type: string
          example: B63354243
        customer_party_tax_scheme:
          type: string
          nullable: true
        customer_party_country:
          type: string
          example: es
        customer_party_endpoint_id:
          type: string
          nullable: true
        supplier_party_name:
          type: string
          example: B2Brouter Global S.L.
        supplier_party_id:
          type: string
          nullable: true
        supplier_party_scheme:
          type: string
          nullable: true
        supplier_party_tax_id:
          type: string
          example: B63276174
        supplier_party_tax_scheme:
          type: string
          nullable: true
        supplier_party_country:
          type: string
          nullable: true
        supplier_party_endpoint_id:
          type: string
          nullable: true
        third_party_name:
          type: string
          nullable: true
        third_party_id:
          type: string
          nullable: true
        third_party_scheme:
          type: string
          nullable: true
        third_party_tax_id:
          type: string
          nullable: true
        third_party_tax_scheme:
          type: string
          nullable: true
        third_party_country:
          type: string
          nullable: true
        third_party_endpoint_id:
          type: string
          nullable: true
        line_extension_amount:
          type: number
          format: decimal
          nullable: true
        tax_amount:
          type: number
          format: decimal
          example: 2583
        tax_exclusive_amount:
          type: number
          format: decimal
          nullable: true
        tax_inclusive_amount:
          type: number
          format: decimal
          example: 14883
        charge_total:
          type: number
          format: decimal
          nullable: true
        payable_amount:
          type: number
          format: decimal
          nullable: true
        quota_recargo_equivalencia:
          type: number
          format: decimal
          nullable: true
        currency:
          type: string
          example: EUR
        original_currency:
          type: string
          example: EUR
        tax_breakdowns:
          type: array
          description: One or more tax breakdowns ("Desglose IVA" in Verifactu)
          items:
            $ref: '#/components/schemas/TaxBreakdowns'
      xml:
        name: tax_report
    ExternalCompanyTransportProperties:
      properties:
        transport_type_code:
          $ref: '#/components/schemas/TransportTypeCode'
        document_type_code:
          $ref: '#/components/schemas/DocumentTypeCode'
        other_document_type_codes:
          type: array
          description: Other document types that the Company can receive
          items:
            type: string
    DirectoryOrgUnits:
      type: object
      description: Organizational unit or Office that belongs to Company
      properties:
        name:
          type: string
          example: Ayuntamiento de Madrid
          description: The name of the office.
        address:
          type: string
          example: CALLE MONTALBAN, 1
          description: Office address.
          nullable: true
        address2:
          type: string
          example: CALLE MONTALBAN, 1
          description: Office additional address.
          nullable: true
        city:
          type: string
          example: Madrid
          description: City name.
        postalcode:
          type: string
          example: '28014'
          description: Postal code. Zip code for USA and Canada
        province:
          type: string
          example: Madrid
        country:
          type: string
          example: es
          description: Country name to which the office belongs.
        routing_codes:
          type: object
          description: Routing codes for the office Company
          properties:
            cin1_scheme:
              type: string
              nullable: true
              example: '9920'
            cin1_value:
              type: string
              nullable: true
              example: '12345678'
            cin2_scheme:
              type: string
              nullable: true
              example: '9920'
            cin2_value:
              type: string
              nullable: true
              example: '12345678'
            cin3_scheme:
              type: string
              nullable: true
              example: '9920'
            cin3_value:
              type: string
              nullable: true
              example: '12345678'
            cin4_scheme:
              type: string
              nullable: true
              example: '9920'
            cin4_value:
              type: string
              nullable: true
              example: '12345678'
            cin5_scheme:
              type: string
              nullable: true
              example: '9920'
            cin5_value:
              type: string
              nullable: true
              example: '12345678'
        required_fields:
          type: array
          description: Fields that are required for the invoice to send to the Company
          items:
            type: string
            example: cin1_scheme
    ExternalCompany:
      type: object
      description: Company from Directory
      properties:
        name:
          type: string
          example: Ayuntamiento de Madrid
          description: The name of the company.
        email:
          type: string
          example: info@madrid.es
          description: The email of the company.
        website:
          type: string
          example: www.madrid.es
          description: Website address
        address:
          type: string
          example: CALLE MONTALBAN, 1
          description: Company address.
          nullable: true
        address2:
          type: string
          example: CALLE MONTALBAN, 1
          description: Company additional address.
        city:
          type: string
          example: Madrid
          description: City name.
        postalcode:
          type: string
          example: '28014'
          description: Postal code. Zip code for USA and Canada
        province:
          type: string
          example: Madrid
        country:
          type: string
          example: es
          description: Country name to which the company belongs.
        language:
          type: string
          example: es
          maxLength: 2
          description: Contact language.
        currency:
          type: string
          example: EUR
        tin_scheme:
          type: string
          example: '9920'
          description: Scheme for the Tax Identification Number
        tin_value:
          type: string
          example: ESP2807900B
          description: Tax Identification Number
        cin_scheme:
          type: string
          example: '9920'
          description: Scheme for the Company Identification Number
          nullable: true
        cin_value:
          type: string
          example: ESP2807900B
          description: Company Identification Number
          nullable: true
        pin_scheme:
          type: string
          example: '9920'
          description: Scheme for the Peppol Identification Number
          nullable: true
        pin_value:
          type: string
          example: ESP2807900B
          description: Peppol Identification Number
          nullable: true
        invoice:
          type: object
          description: Defines the transport type and document type for sending invoices to the Company
          properties:
            transport_type_code:
              type: string
              example: peppol
              description: Transport type code defined for the Company
            document_type_code:
              type: string
              example: xml.ubl.invoice.bis3
              description: Document type code defined for the Company
            other_document_type_codes:
              type: array
              items:
                type: string
                example: xml.ubl.invoice.pint.billing.aunz.v1
        credit_note:
          allOf:
            - type: object
            - description: Defines the transport type and document type for sending credit notes to the Company
            - $ref: '#/components/schemas/ExternalCompanyTransportProperties'
        application_response:
          allOf:
            - type: object
            - description: Defines the transport type and document type for sending application responses to the Company
            - $ref: '#/components/schemas/ExternalCompanyTransportProperties'
        order:
          allOf:
            - type: object
            - description: Defines the transport type and document type for sending orders to the Company
            - $ref: '#/components/schemas/ExternalCompanyTransportProperties'
        order_response:
          allOf:
            - type: object
            - description: Defines the transport type and document type for sending order responses to the Company
            - $ref: '#/components/schemas/ExternalCompanyTransportProperties'
        despatch_advice:
          allOf:
            - type: object
            - description: Defines the transport type and document type for sending despatch advices to the Company
            - $ref: '#/components/schemas/ExternalCompanyTransportProperties'
        despatch_advice_response:
          allOf:
            - type: object
            - description: Defines the transport type and document type for sending despatch advice responses to the Company
            - $ref: '#/components/schemas/ExternalCompanyTransportProperties'
        information_notes:
          type: object
          description: Information notes, can be shown in different languages
          properties:
            language:
              type: string
              description: The content of the information note on the where language is the key
        routing_codes:
          type: object
          description: Routing codes for the parent Company
          properties:
            cin1_scheme:
              type: string
              nullable: true
              example: '9920'
            cin1_value:
              type: string
              nullable: true
              example: '12345678'
            cin2_scheme:
              type: string
              nullable: true
              example: '9920'
            cin2_value:
              type: string
              nullable: true
              example: '12345678'
            cin3_scheme:
              type: string
              nullable: true
              example: '9920'
            cin3_value:
              type: string
              nullable: true
              example: '12345678'
            cin4_scheme:
              type: string
              nullable: true
              example: '9920'
            cin4_value:
              type: string
              nullable: true
              example: '12345678'
            cin5_scheme:
              type: string
              nullable: true
              example: '9920'
            cin5_value:
              type: string
              nullable: true
              example: '12345678'
        required_fields:
          type: array
          description: Fields that are required for the invoice to send to the Company
          items:
            type: string
            example: cin1_scheme
        organizational_units:
          type: array
          description: Organizational units or Offices that Company has.
          items:
            $ref: '#/components/schemas/DirectoryOrgUnits'
    DocumentValidation:
      type: object
      description: Represents a document validation as an object
      properties:
        validation_result:
          type: object
          description: Contains the information result about the document's validation.
          properties:
            info:
              type: object
              description: Metadata about the validated document.
              properties:
                document_type_code:
                  type: string
                  example: xml.ubl.invoice.bis3
                  description: The document type code of the validated document. If the document type cannot be defined, the value is 'unknown'.
                model:
                  type: string
                  example: Invoice
                  description: Indicates the type of business document that was validated. If the document is not well formed, the value is 'unknown'.
                  enum:
                    - Invoice
                    - ApplicationResponse
                    - DespatchAdvice
                    - Order
                    - OrderResponse
                    - Ledger
                    - TaxReport
                    - unknown
            status:
              type: string
              example: invalid
              enum:
                - valid
                - invalid
                - valid_with_warnings
              description: |
                Status validation of the validated document.
                - If xsd or sch are ´invalid,´ the global status will be ´invalid´.
                - If sch is ´valid_with_warnings´, the global status will be ´valid_with_warnings´.
                - If xsd and sch are ´valid´, the global status will be ´valid´.
            xsd:
              type: object
              description: Representation of the xsd validation.
              properties:
                status:
                  type: string
                  example: invalid
                  enum:
                    - valid
                    - invalid
                  description: Validity status of document validation against the syntax schema (XSD).
                errors:
                  type: array
                  items:
                    type: object
                    description: Representation of an xsd error
                    properties:
                      message:
                        type: string
                        example: 'Element ''ProfileI'': This element is not expected. Expected is one of ( ProfileID, ProfileExecutionID, ID ).'
                        description: Description of the error encountered
            sch:
              type: object
              description: Representation of the sch validation.
              properties:
                status:
                  type: string
                  example: valid_with_warnings
                  enum:
                    - valid
                    - invalid
                    - valid_with_warnings
                  description: Validity status of document validation against the business rules (Schematrons).
                schematrons:
                  type: array
                  example:
                    - CEN-EN16931-UBL.sch
                    - PEPPOL-EN16931-UBL.sch
                  description: Schematrons used to validate the document.
                  items:
                    type: string
                errors:
                  type: array
                  items:
                    type: object
                    description: Representation of an sch error
                    properties:
                      code:
                        type: string
                        example: SE-R-005
                        description: Schematron rule code with which the error was found
                      category:
                        type: string
                        example: PEPPOL-EN16931-UBL.sch
                        description: Schematron model with which the error was found
                      message:
                        type: string
                        example: For Swedish suppliers, when using Seller tax registration identifier, 'Godkänd för F-skatt' must be stated
                        description: Description of the error encountered
                      property_path:
                        type: string
                        example: Invoice/AccountingSupplierParty/Party/PartyTaxScheme/CompanyID
                        description: Path of the property that has given the error
                warnings:
                  type: array
                  items:
                    type: object
                    description: Representation of an sch warning
                    properties:
                      code:
                        type: string
                        example: SE-R-013
                        description: Schematron rule code with which the warning was found
                      category:
                        type: string
                        example: PEPPOL-EN16931-UBL.sch
                        description: Schematron model with which the warning was found
                      message:
                        type: string
                        example: The last digit of a Swedish organization number must be valid according to the Luhn algorithm.
                        description: Description of the warning encountered
                      property_path:
                        type: string
                        example: Invoice/AccountingSupplierParty/Party/PartyLegalEntity
                        description: Path of the property that has given the warning
  responses:
    BadRequest:
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/UnauthorizedError'
    NotFound:
      description: Not Found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    UnprocessableEntity:
      description: Unprocessable Entity
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
