openapi: 3.1.0
info:
  title: getpaid API
  version: v2alpha1
  termsOfService: https://getpaid.io/terms/
  contact:
    email: support@getpaid.io
    url: https://getpaid.io/contact
  description: |
    # Introduction

    Our APIs provide programmatic access to the getpaid platform. This page contains
    a comprehensive reference for all of our public APIs. For walkthrough
    documentation please see our [main docs site](https://docs.getpaid.io).

    ## Getting Started

    To get started, sign up at <https://getpaid.io>. This will give you access to
    the [getpaid Dashboard](https://dashboard.getpaid.io) where you can configure
    your account and retrieve your credentials needed to authenticate with our APIs.

    To streamline integration we provide [client libraries](https://docs.getpaid.io)
    for a number of languages, otherwise you can integrate directly with the API
    using the HTTP tooling built-in to most modern frameworks.

    ## Fields Format

    | Type | Format |
    | :- | :- |
    | Amount Minor | Amount in the minor currency unit (e.g. 100 cents for 1 EUR). |
    | Card Number | Credit/debit card numbers are formatted as a string of digits with no white spaces or dashes. The value must be between 13 and 19 digits long and must fulfill the [Luhn check](https://en.wikipedia.org/wiki/Luhn_algorithm). |
    | Card Verification Value | Card Verification Value (CVV) or Card Verification Code (CVC) is formatted as a string of digits. The value must be 3 or 4 digits long. |
    | Country    | The country code fields follow the [ISO 3166-1 Alpha 2 standard](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) in uppercase. Examples: `ES`, `US`.                                                    |
    | Currency   | The currency code fields follow the [ISO 4217 standard](https://en.wikipedia.org/wiki/ISO_4217) in uppercase. Examples: `EUR`, `USD`.                                                                     |
    | Date       | Dates are formatted using the complete date format according to the [ISO 8601 standard](https://www.w3.org/TR/NOTE-datetime): `YYYY-MM-DD`. Example: `2023-09-30`.                                        |
    | Date-time  | Date-time fields are formatted using the [ISO 8601 standard](https://www.w3.org/TR/NOTE-datetime) for the combined date and time in UTC: `YYYY-MM-DDThh:mm:ss.sssZ`. Example: `2015-09-01T23:59:59.479Z`. |
    | Email | Email fields should follow the [RFC 5322](https://tools.ietf.org/html/rfc5322) standard. Example: `jon.smith@acme.com` |
    | Hex Color | Colors are represented as a string starting with `#` followed by six hexadecimal digits. Each pair of digits represents the intensity of red, green, and blue components respectively. Examples: `#FFFFFF`, `#000000`, `#FF5733`. |
    | Identifier | Identifiers are formatted as a string of 3 alphabetic characters (which represents the type of the identified object), one underscore and 26 alphanumeric characters. Every identifier generated in our system is globally unique. Examples: `acc_44678r08jtm8zbt227tzhc4nw5`, `doc_473cr1y0ghbyc3m1yfbwvn3nxx`. |
    | IP         | IP fields are formatted using the [Internet Protocol version 4 (IPv4)](https://en.wikipedia.org/wiki/Internet_Protocol_version_4) standard: `x.x.x.x` where `x` must be a decimal value between `0` and `255`. Example: `192.158.1.38`. |

    ## Files MIME Types

    The format of the files uploaded must correspond to the MIME type in the `Content-Type` header. See the supported file
    formats and the corresponding MIME types:

    <!-- From: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types -->
    | Extensions | Kind of document | MIME Type |
    | :- | :- | :- |
    | `.csv` | Comma-separated values (CSV) | `text/csv` |
    | `.doc` | Microsoft Word | `application/msword` |
    | `.docx` | Microsoft Word (OpenXML) | `application/vnd.openxmlformats-officedocument.wordprocessingml.document` |
    | `.jpeg`, `.jpg` | JPEG images | `image/jpeg` |
    | `.md` | Markdown | `text/markdown` |
    | `.pdf` | Adobe Portable Document Format (PDF) | `application/pdf` |
    | `.png` | Portable Network Graphics | `image/png` |
    | `.svg` | Scalable Vector Graphics (SVG) | `image/svg+xml` |
    | `.tsv` | Tab-separated values (TSV) | `text/tab-separated-values` |
    | `.txt` | Text (generally ASCII or ISO 8859-n) | `text/plain` |
    | `.xls` | Microsoft Excel | `application/vnd.ms-excel` |
    | `.xlsx` | Microsoft Excel (OpenXML) | `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet` |
servers:
  - url: https://api.getpaid.io
    description: Live
  - url: https://api.sandbox.getpaid.io
    description: Sandbox
security: []
tags:
  - name: Authentication
    description: |
      In order to authenticate with getpaid APIs you need to request an OAuth 2.0 Access Token using your Client ID and Secret
      available from the [getpaid Dashboard](https://dashboard.getpaid.io):

      ```
      curl --location --request POST 'https://auth.getpaid.io/oauth/token' \
      --header 'Content-Type: application/json' \
      --data-raw '{
        "client_id": "{{client_id}}",
        "client_secret": "{{client_secret}}",
        "audience": "https://api.sandbox.getpaid.io",
        "grant_type": "client_credentials"
      }'
      ```

      Specify the appropriate `audience`, `client_id` and `client_secret` to switch between Sandbox and Live environments.
      Full details of the access token endpoint can be found [here](#tag/Authentication/operation/access_token).

      This will return a Bearer access token in the JSON Web Token (JWT) format which you should use in the `Authorization`
      header of any subsequent getpaid API requests:

      ```json
      {
        "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
        "token_type": "bearer",
        "expires_in": 3600
      }
      ```

      The access token will be valid for the length of time in seconds indicated by the `expires_in` field. When it expires, you should request a new one.
      If using one of our client libraries, this will be handled automatically for you.


      <!-- ReDoc-Inject: <security-definitions> -->
  - name: Accounts
    description: |
      An account is the business that will be onboarded to getpaid.
      The account is the main entity that will be used to enable the different capabilities that getpaid offers.
  - name: Account Links
    description: |
      <!-- markdownlint-disable first-line-h1 -->
      The different relationships that accounts can have with one another. A link can define the hierarchy within the whole company and also allows the assignment of different "roles" that the current account can play in relation to each connected account.

      ## Types

      There are several types of relationships an account can have. The possible ones are:

      - `can_use` - Allows source account to use the resources of destination account.
  - name: Connections
    description: |
      A connection is a link between an account and a third-party service that will be used to enable the different capabilities that getpaid offers.
  - name: Bank Account Authorizations
    description: |
      <!-- markdownlint-disable first-line-h1 -->
      A bank account authorization is a permission granted by a bank account holder, allowing another person or entity to
      access, manage, or perform specific transactions on their account.

      ## Statuses

      Bank account authorizations have a status which indicates the current state of the consent process. The possible
      statuses are:

      - `completed` - The request was completed successfully.
      - `next_step_required` - The request requires additional action before it can be completed.
      - `awaiting` - The request is pending and waiting for a response or action from an external party.
      - `rejected` - The request was rejected by the user/bank.
      - `failed` - The request failed due to technical reasons.

      ## Next Steps

      In a bank account authorization process, there are multiple steps that need to be followed to complete the action. These
      steps are defined by the `next_step` block, which guides the flow of the authorization process.

      Possible values for `next_step.type`:
      <!-- markdownlint-disable link-fragments -->
      - `configure_redirect` - Redirection information needs to be collected by calling [Configure Single Redirect Bank
      Account Authorization](#operation/configure_redirect_account_bank_account_authorizations) endpoint.
      - `redirect` - The user needs to be redirected to the bank's website to complete a required action.
      - `pass_credentials` - The user needs to provide their credentials (e.g., username, password) for authentication
      purposes by calling [Pass User's Credentials Bank Account
      Authorization](#operation/pass_credentials_account_bank_account_authorizations).
      - `select_sca_method` - The user must select a Strong Customer Authentication (SCA) method, such as SMS, app-based
      authentication, or a hardware token by calling [Select SCA Method For Bank Account
      Authorization](#operation/select_sca_method_account_bank_account_authorizations).
      - `pass_sca_code` - The user needs to enter an SCA code (e.g., a one-time password) that was generated from their chosen
      SCA method by calling [Pass SCA Code For Bank Account
      Authorization](#operation/pass_sca_code_account_bank_account_authorizations).
      - `poll` - To poll the consent status, by calling [Get Bank Account
      Authorization](#operation/get_account_bank_account_authorizations), is required in order to determine whether the user
      has successfully authorized the request with the bank. Because the flow occurs directly between the end user and the
      bank without getpaid acting as an intermediary, for example, via a secondary device such as a mobile phone.
      <!-- markdownlint-enable link-fragments -->
  - name: Bank Transactions
    description: |
      A bank transaction is a financial event that occurs when a transfer of funds is made from one party to another.

      In the context of this API, a transaction represents a detailed record of an inbound payment, including direct debit transactions. Each transaction entry provides comprehensive information such as the booking date and time, amount, currency, counterparty details, and payment instrument information. This helps in tracking and managing receivables efficiently, ensuring transparency and accuracy in financial reporting.

      Transactions are essential for maintaining accurate financial records, supporting reconciliation processes, and ensuring that all payments are accounted for correctly. They form the backbone of financial data, enabling businesses to monitor cash flow, manage accounts, and meet regulatory requirements.
  - name: Connections
    description: |
      A connection is a link between an account and a third-party service that will be used to enable the different capabilities that getpaid offers.
  - name: Invoices
    description: |
      <!-- markdownlint-disable first-line-h1 -->
      An invoice is a formal contractual document dispatched from a seller to a buyer, notifying them of the purchase of goods or services and the corresponding obligation to make a payment.

      Additional information regarding the rounding process applied to the calculation of totals and taxes can be found in our [public documentation](../invoices/rounding).

      ## Statuses

      Represents the current status of an invoice.

      - `draft` - The invoice is a draft and can suffer changes.
      - `cancelled` - The invoice has been cancelled.
      - `initiated` - The invoice has been received and is about to be issued.
      - `issued` - The invoice code has been provided or generated.
  - name: Invoice Documents
    description: |
      The generated documents associated to a specific invoice. For example, a PDF.
  - name: Invoices Reports
    description: Export the invoices to a file to get a quick report on the historical data. The available file will be in CSV format.
  - name: Invoices Series
    description: |
      The series are used to create invoices with auto-generated codes. Invoices series can be created only for accounts with `issue_invoices` capability enabled.

      The `prefix` and `suffix` fields are used to generate the invoice number, the `padding` field is used to pad the number with zeros, the `valid_from` and `valid_to` fields are used to define the period in which the series is valid.
      The produced invoices reference will be `{prefix}{padded number}{suffix}`, the length of the reference is limited to 50 characters. So the sum of the length of prefix, suffix and the padding should be less than or equal to 50.
  - name: Invoice Webhooks
    description: |
      Notifications to inform about invoice events that occur so you can take action within your own systems, for example, updating the invoices's state, notifying your customers or integrating with third-parties.
  - name: Payment Instruments
    description: |
      <!-- markdownlint-disable first-line-h1 -->
      A payment instrument represents a financial entity that can be used for processing payments, invoicing, and reconciliation. It contains essential details about the funding source, such as a bank account or other financial methods, and provides metadata related to its status and capabilities.

      Note that every change performed on a payment instrument (create, disable, or enable) will alter the account version and can trigger some verification checks required on any capability.

      ## Statuses

      Payment instruments have a status which indicates its current state. The possible statuses are:

      - `active` - The payment instrument is active and can be used.
      - `inactive` - The payment instrument is inactive and cannot be used.
  - name: Subscriptions
    description: A subscription is a recurring invoice that is automatically issued to the buyer to charge for services or products that are delivered on a regular basis.
  - name: Bank Transactions Enrichment
    description: |
      <!-- markdownlint-disable first-line-h1 -->
      Upload bank transactions files to enrich the transactions synchronized with Open Banking.

      ## File Formats

      The supported file formats are:

      | Area | Format | `format` field | Description |
      | :- | :- | :- | :- |
      | Global | ISO 20022 camt.053 | `iso20022_camt053` | Bank to customer cash management in ISO 20022 format. |
      | Spain | AEB43 | `aeb43` | Bank transactions file format used in Spain. |

      ## Statuses

      Bank transactions imports have a status which indicates the current state of the upload process. The possible statuses are:

      - `pending` - The import job has been initiated but the document still to be processed.
      - `validated` - The document format has been validated and it is supported.
      - `completed` - The document has been processed successfully and the transactions were processed and matched, if
      possible.
      <!-- markdownlint-disable-next-line link-fragments -->
      - `error` - The import job failed, check the [status reasons](#tag/Bank-Transactions-Enrichment/Status-Reasons) for
      further details.

      ## Status Reasons

      | Status | Reason Code | Cause | Next Action |
      | :- | :- | :- | :- |
      | `error` | `file_integrity_failed` | The file type is supported but the content does not match the expected format. | Check the uploaded file to validate the format and upload it again with the expected format for the file type. |
      | `error` | `unknown_bank_account` | The bank account of the file does not belong to any of the bank accounts configured in your getpaid account. | Check the configuration of your getpaid account to include the bank account or skip the files related to this bank account. |
      | `error` | `duplicated_file_date` | There is already a file uploaded for the same bank account, format and date. | The file for that date was already uploaded and there is no need of upload it again. |
      | `error` | `missing_open_banking_data` | There are no bank transactions synchronized via Open Banking to be enriched with the uploaded file. | Check the Open Banking configuration of your getpaid account and upload the file again. |
  - name: Chats
    description: |
      A chat is a conversation between a user and the assistant. The assistant is an AI (Artificial Intelligence) prompt that helps the user on his day-by-day tasks within the Getpaid system.

      ## Supported MIME Types

      The format of the files uploaded must correspond to the MIME type in the `Content-Type` header. See the supported file
      formats and the corresponding MIME types:

      <!-- From: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types -->
      | Extensions | Kind of document | MIME Type |
      | :- | :- | :- |
      | `.pdf` | Adobe Portable Document Format (PDF) | `application/pdf` |
      | `.txt` | Text (generally ASCII or ISO 8859-n) | `text/plain` |
  - name: Labels
    description: |
      Labels are used to categorize and organize your data. They can be used to group invoices, accounts, or any other entity in the system.
paths:
  /oauth/token:
    post:
      tags:
        - Authentication
      summary: Access Token
      description: Obtain an OAuth 2.0 Access token to authenticate API requests
      operationId: access_token
      servers:
        - url: https://auth.getpaid.io
          description: OAuth Server
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OAuthTokenRequest'
            examples:
              Live Token Request:
                value:
                  client_id: g6gWu46zeP0HH4jkW3i22yJ2shDrNxJ8
                  client_secret: S6gozTXzrS42OZ0cmxVJG133mOfuHhSfkIJkcH7FBm-0HyGrVZMLGJtyruTA4CQv
                  audience: https://api.getpaid.io
                  grant_type: client_credentials
              Sandbox Token Request:
                value:
                  client_id: 0UvlOgIPIKqAzd0yi7Xnk8NroSsRLOaj
                  client_secret: S6gozTXzrS42OZ0cmxVJG133mOfuHhSfkIJkcH7FBm-0HyGrVZMLGJtyruTA4CQv
                  audience: https://api.sandbox.getpaid.io
                  grant_type: client_credentials
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OAuthTokenResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Problem'
  /v2alpha1/accounts:
    post:
      tags:
        - Accounts
      summary: Create Account
      operationId: create_account
      security:
        - OAuth:
            - accounts:read_write
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateAccountRequest'
        required: true
      responses:
        '201':
          description: Created
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateAccountResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '409':
          $ref: '#/components/responses/ProblemConflict'
        '422':
          $ref: '#/components/responses/ProblemInvalidParameters'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
    get:
      tags:
        - Accounts
      summary: List Accounts
      operationId: list_accounts
      security:
        - OAuth:
            - accounts:read
        - OAuth:
            - accounts:read_write
      parameters:
        - in: query
          name: sort
          schema:
            type: string
          description: |
            Sorting. Comma-separated list indicating the sorting order for results.
            The format is **field_name:sort_mode** where
            * field_name is the name of the field to sort. Available field names are: `legal_name`.
            * sort_mode is **asc** for ascendant or **desc** for descendant.
          example: legal_name:desc
        - $ref: '#/components/parameters/PaginationFirst'
        - $ref: '#/components/parameters/PaginationAfter'
        - in: query
          name: id
          schema:
            type: array
            items:
              $ref: '#/components/schemas/AccountId'
            example:
              - acc_44678r08jtm8zbt227tzhc4nw5
              - acc_47252596b36e4004a03cfa82c5
          description: Filtering. Exact match of a list of account IDs.
        - in: query
          name: reference
          schema:
            $ref: '#/components/schemas/Reference'
          description: |
            Filtering. Your reference for the account.
        - in: query
          name: country
          schema:
            $ref: '#/components/schemas/Country'
          description: |
            Filtering. The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2).
        - in: query
          name: intraorganizational
          schema:
            $ref: '#/components/schemas/Intraorganizational'
          description: |
            Filtering. Indicates whether the account belongs to the requestor's organization.
        - in: query
          name: legal_name
          schema:
            type: string
            example: getpaid autos S.L.
          description: |-
            Filtering. It applies `contains` operator to the legal name.
            The operator is not case-sensitive and it ignores diacritic and special characters, it means, it replaces all characters but `[A-Za-z0-9 ]`.
        - in: query
          name: capability
          schema:
            type: array
            items:
              $ref: '#/components/schemas/CapabilityName'
            example:
              - manage_resources
              - issue_invoices
          description: |
            Filtering. Exact match of a list of capabilities.

            **Note:** This parameter cannot be used together with `capability_to`.
        - in: query
          name: capability_status
          schema:
            type: array
            items:
              $ref: '#/components/schemas/CapabilityStatus'
            example:
              - information_due
              - active
          description: |
            Filtering. Exact match of a list of capability statuses.
        - in: query
          name: manage_resources_from
          schema:
            $ref: '#/components/schemas/DateTime'
            example: '2023-01-01T01:01:00.000Z'
          description: |
            Filtering. Initial date and time (inclusive) of the range where the account had `manage_resources` capability activated.
            Using [ISO 8601](https://www.w3.org/TR/NOTE-datetime) standard for the combined date and time in UTC.

            Minimum: 2 years before the current date and time.

            Maximum: the date and time set in `manage_resources_to` parameter.
        - in: query
          name: manage_resources_to
          schema:
            $ref: '#/components/schemas/DateTime'
            example: '2023-01-01T01:01:00.000Z'
          description: |
            Filtering. Last date and time (inclusive) of the range where the account had `manage_resources` capability activated.
            Using [ISO 8601](https://www.w3.org/TR/NOTE-datetime) standard for the combined date and time in UTC.

            Minimum: the date and time set in `manage_resources_from` parameter.

            **Note:** This parameter cannot be used together with `capability`.
        - in: query
          name: issue_invoices_from
          schema:
            $ref: '#/components/schemas/DateTime'
            example: '2023-01-01T01:01:00.000Z'
          description: |
            Filtering. Initial date and time (inclusive) of the range where the account had `issue_invoices` capability activated.
            Using [ISO 8601](https://www.w3.org/TR/NOTE-datetime) standard for the combined date and time in UTC.

            Minimum: 2 years before the current date and time.

            Maximum: the date and time set in `issue_invoices_to` parameter.
        - in: query
          name: issue_invoices_to
          schema:
            $ref: '#/components/schemas/DateTime'
            example: '2023-01-01T01:01:00.000Z'
          description: |
            Filtering. Last date and time (inclusive) of the range where the account had `issue_invoices` capability activated.
            Using [ISO 8601](https://www.w3.org/TR/NOTE-datetime) standard for the combined date and time in UTC.

            Minimum: the date and time set in `issue_invoices_from` parameter.

            **Note:** This parameter cannot be used together with `capability`.
        - in: query
          name: receive_invoices_from
          schema:
            $ref: '#/components/schemas/DateTime'
            example: '2023-01-01T01:01:00.000Z'
          description: |
            Filtering. Initial date and time (inclusive) of the range where the account had `receive_invoices` capability activated.
            Using [ISO 8601](https://www.w3.org/TR/NOTE-datetime) standard for the combined date and time in UTC.

            Minimum: 2 years before the current date and time.

            Maximum: the date and time set in `receive_invoices_to` parameter.
        - in: query
          name: receive_invoices_to
          schema:
            $ref: '#/components/schemas/DateTime'
            example: '2023-01-01T01:01:00.000Z'
          description: |
            Filtering. Last date and time (inclusive) of the range where the account had `receive_invoices` capability activated.
            Using [ISO 8601](https://www.w3.org/TR/NOTE-datetime) standard for the combined date and time in UTC.

            Minimum: the date and time set in `receive_invoices_from` parameter.

            **Note:** This parameter cannot be used together with `capability`.
        - in: query
          name: label
          schema:
            type: array
            items:
              $ref: '#/components/schemas/LabelId'
            example:
              - lbl_44678r08jtm8zbt227tzhc4nw5
              - lbl_31672r10jtm6zvt127vzmc3sn2
          description: Filtering. Exact match of a list of label IDs.
      responses:
        '200':
          description: OK
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  cursor:
                    $ref: '#/components/schemas/PaginationCursor'
                  data:
                    allOf:
                      - $ref: '#/components/schemas/PaginationData'
                      - items:
                          $ref: '#/components/schemas/ListAccountsResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ProblemInvalidParameters'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /v2alpha1/accounts/{account_id}:
    get:
      tags:
        - Accounts
      summary: Get Account
      description: |
        Gets an account associated to the owner account.
      operationId: get_account
      security:
        - OAuth:
            - accounts:read
        - OAuth:
            - accounts:read_write
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/AccountId'
      responses:
        '200':
          description: OK
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetAccountResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/ProblemNotFound'
        '422':
          $ref: '#/components/responses/ProblemInvalidParameters'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
    patch:
      tags:
        - Accounts
      summary: Update Account
      description: |
        It applies partial modifications to an existing account. On this way, every field that is not provided will remain unchanged,
        and all the provided ones would be updated in our system. Please note that some fields might require some attention and can raise some
        additional checks required by any capability requirement.
      operationId: update_account
      security:
        - OAuth:
            - accounts:read_write
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/AccountId'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AccountRequest'
        required: true
      responses:
        '200':
          description: OK
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateAccountResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/ProblemNotFound'
        '422':
          $ref: '#/components/responses/ProblemInvalidParameters'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /v2alpha1/accounts/{account_id}/disable:
    post:
      tags:
        - Accounts
      summary: Disable Account
      description: It disables an existing account. Once an account is disabled, it will not be accessible anymore.
      operationId: disable_account
      security:
        - OAuth:
            - accounts:read_write
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
        - name: account_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/AccountId'
      responses:
        '204':
          $ref: '#/components/responses/NoContent'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/ProblemNotFound'
        '409':
          $ref: '#/components/responses/ProblemConflict'
        '422':
          $ref: '#/components/responses/ProblemInvalidParameters'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /v2alpha1/accounts/{account_id}/taxes:
    get:
      tags:
        - Taxes
      summary: List Taxes
      description: |
        List taxes associated to a specific account.
      operationId: list_account_taxes
      security:
        - OAuth:
            - accounts:read
            - accounts:read_write
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/AccountId'
      responses:
        '200':
          description: OK
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetTaxesResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/ProblemNotFound'
        '422':
          $ref: '#/components/responses/ProblemInvalidParameters'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /v2alpha1/accounts/bank_account_authorizations:
    post:
      tags:
        - Bank Account Authorizations
      summary: Create Bank Account Authorization
      description: |
        Creates a bank account authorizations associated to a specific account.
      operationId: create_account_bank_account_authorizations
      security:
        - OAuth:
            - bank_account_authorizations:read_write
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateBankAccountAuthorizationRequest'
        required: true
      responses:
        '201':
          description: Bank account authorization created successfully.
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateBankAccountAuthorizationResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/ProblemNotFound'
        '409':
          $ref: '#/components/responses/ProblemConflict'
        '422':
          $ref: '#/components/responses/ProblemInvalidParameters'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /v2alpha1/accounts/bank_account_authorizations/{bank_account_authorization_id}:
    get:
      tags:
        - Bank Account Authorizations
      summary: Get Bank Account Authorization
      description: |
        Gets a bank account authorizations associated to a specific account.
      operationId: get_account_bank_account_authorizations
      security:
        - OAuth:
            - bank_account_authorizations:read_write
      parameters:
        - name: bank_account_authorization_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/BankAccountAuthorizationId'
      responses:
        '200':
          description: OK
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetBankAccountAuthorizationResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/ProblemNotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
    delete:
      tags:
        - Bank Account Authorizations
      summary: Revoke Bank Account Authorization
      description: |
        Revokes the authorization associated with a specific bank account.
        Once an authorization is revoked, it cannot be re-enabled. A new authorization must be obtained to regain access.
      operationId: revoke_account_bank_account_authorizations
      security:
        - OAuth:
            - bank_account_authorizations:read_write
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
        - name: bank_account_authorization_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/BankAccountAuthorizationId'
      responses:
        '200':
          description: OK
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RevokeBankAccountAuthorizationResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/ProblemNotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /v2alpha1/accounts/bank_account_authorizations/{bank_account_authorization_id}/configure_redirect:
    post:
      tags:
        - Bank Account Authorizations
      summary: Configure Single Redirect Bank Account Authorization
      description: |
        Configure the authorization process to redirect the user to the provided URL.
      operationId: configure_redirect_account_bank_account_authorizations
      security:
        - OAuth:
            - bank_account_authorizations:read_write
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
        - name: bank_account_authorization_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/BankAccountAuthorizationId'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ConfigureRedirectBankAccountAuthorizationRequest'
        required: true
      responses:
        '200':
          description: OK
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConfigureRedirectBankAccountAuthorizationResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/ProblemNotFound'
        '409':
          $ref: '#/components/responses/ProblemConflict'
        '422':
          $ref: '#/components/responses/ProblemInvalidParameters'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /v2alpha1/accounts/bank_account_authorizations/{bank_account_authorization_id}/pass_credentials:
    post:
      tags:
        - Bank Account Authorizations
      summary: Pass User's Credentials Bank Account Authorization
      description: |
        Capture the user's credentials to allow them to login.
      operationId: pass_credentials_account_bank_account_authorizations
      security:
        - OAuth:
            - bank_account_authorizations:read_write
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
        - name: bank_account_authorization_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/BankAccountAuthorizationId'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PassCredentialsBankAccountAuthorizationRequest'
        required: true
      responses:
        '200':
          description: OK
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PassCredentialsBankAccountAuthorizationResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/ProblemNotFound'
        '409':
          $ref: '#/components/responses/ProblemConflict'
        '422':
          $ref: '#/components/responses/ProblemInvalidParameters'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /v2alpha1/accounts/bank_account_authorizations/{bank_account_authorization_id}/select_sca_method:
    post:
      tags:
        - Bank Account Authorizations
      summary: Select SCA Method For Bank Account Authorization
      description: |
        Select SCA method to receive a SCA code.
      operationId: select_sca_method_account_bank_account_authorizations
      security:
        - OAuth:
            - bank_account_authorizations:read_write
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
        - name: bank_account_authorization_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/BankAccountAuthorizationId'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SelectScaMethodBankAccountAuthorizationRequest'
      responses:
        '200':
          description: OK
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SelectScaMethodBankAccountAuthorizationResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/ProblemNotFound'
        '409':
          $ref: '#/components/responses/ProblemConflict'
        '422':
          $ref: '#/components/responses/ProblemInvalidParameters'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /v2alpha1/accounts/bank_account_authorizations/{bank_account_authorization_id}/pass_sca_code:
    post:
      tags:
        - Bank Account Authorizations
      summary: Pass SCA Code For Bank Account Authorization
      description: |
        Pass SCA code to complete the authorization.
      operationId: pass_sca_code_account_bank_account_authorizations
      security:
        - OAuth:
            - bank_account_authorizations:read_write
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
        - name: bank_account_authorization_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/BankAccountAuthorizationId'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PassScaCodeBankAccountAuthorizationRequest'
      responses:
        '200':
          description: OK
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PassScaCodeBankAccountAuthorizationResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/ProblemNotFound'
        '409':
          $ref: '#/components/responses/ProblemConflict'
        '422':
          $ref: '#/components/responses/ProblemInvalidParameters'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /v2alpha1/accounts/{account_id}/invoices_series:
    post:
      tags:
        - Invoices Series
      summary: Create Invoices Series
      description: |
        Creates new invoices series for the account.
      operationId: create_invoices_series
      security:
        - OAuth:
            - accounts:read_write
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
        - name: account_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/AccountId'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateInvoicesSeries'
        required: true
      responses:
        '201':
          description: Created
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateInvoicesSeriesResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/ProblemNotFound'
        '409':
          $ref: '#/components/responses/ProblemConflict'
        '422':
          $ref: '#/components/responses/ProblemInvalidParameters'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
    get:
      tags:
        - Invoices Series
      summary: List Invoices Series
      description: |
        Lists the existing invoices series.
      operationId: list_invoices_series
      security:
        - OAuth:
            - accounts:read
        - OAuth:
            - accounts:read_write
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/AccountId'
        - name: type
          in: query
          schema:
            $ref: '#/components/schemas/InvoiceType'
          description: Filtering. The type of the invoices series.
      responses:
        '200':
          description: OK
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListInvoicesSeriesResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /v2alpha1/accounts/{account_id}/invoices_series/{invoices_series_id}:
    get:
      tags:
        - Invoices Series
      summary: Get Invoices Series
      description: |
        Gets the invoices series details.
      operationId: get_invoices_series
      security:
        - OAuth:
            - accounts:read
        - OAuth:
            - accounts:read_write
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/AccountId'
        - name: invoices_series_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/InvoicesSeriesId'
      responses:
        '200':
          description: OK
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetInvoicesSeriesResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/ProblemNotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /v2alpha1/account_links:
    post:
      tags:
        - Account Links
      summary: Create Account Link
      operationId: create_account_link
      security:
        - OAuth:
            - accounts:read_write
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateAccountLinkRequest'
        required: true
      responses:
        '201':
          description: Created
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateAccountLinkResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/ProblemNotFound'
        '409':
          $ref: '#/components/responses/ProblemConflict'
        '422':
          $ref: '#/components/responses/ProblemInvalidParameters'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
    get:
      tags:
        - Account Links
      summary: List Account Links
      operationId: list_account_links
      security:
        - OAuth:
            - accounts:read
        - OAuth:
            - accounts:read_write
      parameters:
        - in: query
          name: sort
          schema:
            type: string
          description: |
            Sorting. Comma-separated list indicating the sorting order for results.
            The format is **field_name:sort_mode** where
            * field_name is the name of the field to sort. Available field names are: `type`, `source`, `destination`.
            * sort_mode is **asc** for ascendant or **desc** for descendant.

            By default: `source:asc`.
          example: source:asc
        - $ref: '#/components/parameters/PaginationFirst'
        - $ref: '#/components/parameters/PaginationAfter'
        - in: query
          name: type
          schema:
            type: string
            enum:
              - can_use
            example: can_use
          description: Filtering. The type of account link.
        - in: query
          name: source
          schema:
            type: array
            items:
              $ref: '#/components/schemas/AccountLinkId'
            example:
              - alk_397a1eb5c87a4f14bdf0924044
              - alk_4a874dd810c245b3bcf32f603d
          description: Filtering. Exact match of a list of account link IDs.
        - in: query
          name: destination
          schema:
            type: array
            items:
              $ref: '#/components/schemas/AccountLinkId'
            example:
              - alk_397a1eb5c87a4f14bdf0924044
              - alk_4a874dd810c245b3bcf32f603d
          description: Filtering. Exact match of a list of account link IDs.
      responses:
        '200':
          description: OK
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  cursor:
                    $ref: '#/components/schemas/PaginationCursor'
                  data:
                    allOf:
                      - $ref: '#/components/schemas/PaginationData'
                      - items:
                          $ref: '#/components/schemas/GetAccountLinkResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /v2alpha1/account_links/{account_link_id}:
    get:
      tags:
        - Account Links
      summary: Get Account Link
      description: |
        Gets an account link associated to the owner account.
      operationId: get_account_link
      security:
        - OAuth:
            - accounts:read
        - OAuth:
            - accounts:read_write
      parameters:
        - name: account_link_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/AccountLinkId'
      responses:
        '200':
          description: OK
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetAccountLinkResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/ProblemNotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
    delete:
      tags:
        - Account Links
      summary: Delete Account Link
      description: |
        Deletes an account link associated to the owner account.
      operationId: delete_account_link
      security:
        - OAuth:
            - accounts:read_write
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
        - name: account_link_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/AccountLinkId'
      responses:
        '204':
          $ref: '#/components/responses/NoContent'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/ProblemNotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /v2alpha1/bank_transactions:
    get:
      tags:
        - Bank Transactions
      summary: List Bank Transactions
      operationId: list_bank_transactions
      security:
        - OAuth:
            - bank_transactions:read
      parameters:
        - in: query
          name: sort
          schema:
            type: string
          description: |
            Sorting. Comma-separated list indicating the sorting order for results.
            The format is **field_name:sort_mode** where
            * **field_name** is the name of the field to sort. Available field names are: `booking_at`, `amount`, `counterparty_legal_name`.
            * **sort_mode** is `asc` for ascendant or `desc` for descendant.

            By default: `booking_at:desc`.
          example: booking_at:desc,amount:asc
        - $ref: '#/components/parameters/PaginationFirst'
        - $ref: '#/components/parameters/PaginationAfter'
        - in: query
          name: booking_at_from
          schema:
            $ref: '#/components/schemas/DateTime'
            example: '2023-01-01T01:01:00.000Z'
          description: |
            Filtering. Booking date and time (inclusive) of the first bank transaction to get. Using [ISO 8601](https://www.w3.org/TR/NOTE-datetime) standard for the combined date and time in UTC.

            Minimum: 2 years before the current date and time.

            Maximum: the date and time set in `booking_at_to` parameter.
        - in: query
          name: booking_at_to
          schema:
            $ref: '#/components/schemas/DateTime'
          description: |
            Filtering. Booking date and time (inclusive) of the last bank transaction to get. Using [ISO 8601](https://www.w3.org/TR/NOTE-datetime) standard for the combined date and time in UTC.

            Minimum: the date and time set in `booking_at_from` parameter.
        - in: query
          name: description
          schema:
            type: string
            example: INV88430
          description: Filtering. The description of the transaction.
        - in: query
          name: counterparty_legal_name
          schema:
            type: string
            example: Payer 1
          description: Filtering. The legal name of the counterparty.
        - in: query
          name: counterparty_account_number
          schema:
            type: string
            example: GB33BUKB20201575887264
          description: Filtering. The account number of the counterparty.
        - in: query
          name: seller_id
          schema:
            $ref: '#/components/schemas/AccountId'
          description: Filtering. The seller unique identifier.
        - in: query
          name: seller_bank_account_id
          schema:
            $ref: '#/components/schemas/PaymentInstrumentId'
          description: Filtering. The unique identifier of the seller's payment instrument.
      responses:
        '200':
          description: OK
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/Pagination'
                  - properties:
                      data:
                        items:
                          $ref: '#/components/schemas/BankTransaction'
              examples:
                transaction_example:
                  value:
                    cursor: Q3VyaW9zaXR5IEtpbGxlZCB0aGUgQ2F0Cg==
                    data:
                      - id: trx_3775b2af2e13402d919a1f3f64
                        booking_at: '2024-04-21T09:22:54.235Z'
                        amount: 128
                        currency: EUR
                        description: INV88430
                        seller:
                          id: acc_44678r08jtm8zbt227tzhc4nw5
                          legal_name: Seller 1
                          bank_account:
                            id: pai_4mjfmtdf13eg5bdvsky11fyqxm
                            account_number:
                              type: iban
                              value: GB33BUKB20201575887264
                        counterparty:
                          legal_name: Payer 1
                          bank_account:
                            account_number:
                              type: iban
                              value: GB33BUKB20201575887264
                        enrichment_status: not_enriched
                      - id: trx_89f4b2af2e13402d919a1f3f64
                        booking_at: '2024-05-11T10:45:33.235Z'
                        amount: 250
                        currency: USD
                        description: TRX99220
                        seller:
                          id: acc_44678r08jtm8zbt227tzhc4nw5
                          legal_name: Seller 2
                          bank_account:
                            id: pai_48jbc6wt1txfyfm2afxb6dc5np
                            account_number:
                              type: iban
                              value: US20WELLS20201575887264
                        counterparty:
                          legal_name: Payer 2
                          bank_account:
                            account_number:
                              type: iban
                              value: US20WELLS20201575887264
                        enrichment_status: not_enriched
                      - id: trx_23d9a2af2e13402d919a1f3f64
                        booking_at: '2024-06-15T12:15:47.235Z'
                        amount: 75
                        currency: GBP
                        description: TRX34567
                        seller:
                          id: acc_4b5zswqg8kshx9zxdxa5g5c4wm
                          legal_name: Seller 3
                          bank_account:
                            id: pai_4w5az89g1p9dy9st7qe3rgstm7
                            account_number:
                              type: iban
                              value: GB29NWBK60161331926819
                        counterparty:
                          legal_name: Payer 3
                          bank_account:
                            account_number:
                              type: iban
                              value: GB29NWBK60161331926819
                        enrichment_status: not_enriched
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /v2alpha1/bank_transactions/documents:
    post:
      tags:
        - Bank Transactions Enrichment
      summary: Upload Bank Transactions File
      description: |
        Upload a bank file to enrich the transactions extracted from the Open Banking connection.

        After the upload the file must be imported using the [Import Bank Transactions File](#operation/import_bank_transactions) endpoint.

        See the [file formats supported](#tag/Bank-Transactions-Enrichment/File-Formats) for the bank transactions files.
      operationId: upload_bank_transactions_document
      security:
        - OAuth:
            - bank_transactions:read_write
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/UploadBankTransactionsDocumentRequest'
            examples:
              default:
                $ref: '#/components/examples/UploadBankTransactionsDocument'
        required: true
      responses:
        '201':
          description: Created
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UploadBankTransactionsDocumentResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '409':
          $ref: '#/components/responses/ProblemConflict'
        '413':
          $ref: '#/components/responses/ContentTooLarge'
        '422':
          $ref: '#/components/responses/ProblemInvalidParameters'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /v2alpha1/bank_transactions/imports:
    post:
      tags:
        - Bank Transactions Enrichment
      summary: Import Bank Transactions File
      description: |
        Import a bank transactions file to enrich bank transactions.

        The file must be uploaded using the [Upload Bank Transactions File](#operation/upload_bank_transactions_document) endpoint.
      operationId: import_bank_transactions
      security:
        - OAuth:
            - bank_transactions:read_write
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ImportBankTransactionsDocumentRequest'
        required: true
      responses:
        '202':
          description: Accepted
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ImportBankTransactionsDocumentResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '409':
          $ref: '#/components/responses/ProblemConflict'
        '422':
          $ref: '#/components/responses/ProblemInvalidParameters'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
    get:
      tags:
        - Bank Transactions Enrichment
      summary: List Bank Import Jobs
      description: |
        Get the status of all the bank transactions files import jobs ordered by uploaded time in descending order.

        The import process is initiated using the [Upload Bank Transactions File](#operation/upload_bank_transactions_document) endpoint.
      operationId: list_bank_transactions_imports
      security:
        - OAuth:
            - bank_transactions:read
        - OAuth:
            - bank_transactions:read_write
      parameters:
        - $ref: '#/components/parameters/PaginationFirst'
        - $ref: '#/components/parameters/PaginationAfter'
      responses:
        '200':
          description: OK
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetBankTransactionsImportsResponse'
              examples:
                default:
                  $ref: '#/components/examples/GetBankTransactionsImportsResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /v2alpha1/bank_transactions/imports/{import_id}:
    get:
      tags:
        - Bank Transactions Enrichment
      summary: Get Bank Import Status
      description: |
        Get the status of an asynchronous import job.

        The import process is initiated using the [Upload Bank Transactions File](#operation/upload_bank_transactions_document) endpoint.
      operationId: get_bank_transactions_import
      security:
        - OAuth:
            - bank_transactions:read
        - OAuth:
            - bank_transactions:read_write
      parameters:
        - name: import_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/BankTransactionsImportId'
      responses:
        '200':
          description: OK
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetBankTransactionsImportResponse'
              examples:
                pending:
                  $ref: '#/components/examples/GetBankTransactionsImportPendingResponse'
                validated:
                  $ref: '#/components/examples/GetBankTransactionsImportValidatedResponse'
                completed:
                  $ref: '#/components/examples/GetBankTransactionsImportCompletedResponse'
                error:
                  $ref: '#/components/examples/GetBankTransactionsImportErrorResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/ProblemNotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /v2alpha1/invoices:
    post:
      tags:
        - Invoices
      summary: Create Invoice
      operationId: create_invoice
      security:
        - OAuth:
            - invoices:read_write
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateInvoiceRequest'
            examples:
              standard_with_provided_reference:
                $ref: '#/components/examples/CreateStandardInvoiceRequestProvidedCode'
              standard_with_generated_reference:
                $ref: '#/components/examples/CreateStandardInvoiceRequestGeneratedCode'
              corrective_with_provided_reference:
                $ref: '#/components/examples/CreateCorrectiveInvoiceRequestProvidedCode'
              corrective_with_generated_reference:
                $ref: '#/components/examples/CreateCorrectiveInvoiceRequestGeneratedCode'
              partial_corrective:
                $ref: '#/components/examples/CreatePartialCorrectiveInvoiceRequest'
        required: true
      responses:
        '201':
          description: Created
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateInvoiceResponse'
              examples:
                standard_with_provided_reference:
                  $ref: '#/components/examples/CreateStandardInvoiceResponseProvidedCode'
                standard_with_generated_reference:
                  $ref: '#/components/examples/CreateStandardInvoiceResponseGeneratedCode'
                corrective_with_provided_reference:
                  $ref: '#/components/examples/CreateCorrectiveInvoiceResponseProvidedCode'
                corrective_with_generated_reference:
                  $ref: '#/components/examples/CreateCorrectiveInvoiceResponseGeneratedCode'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '409':
          $ref: '#/components/responses/ProblemConflict'
        '422':
          $ref: '#/components/responses/ProblemInvalidParameters'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
    get:
      tags:
        - Invoices
      summary: List Invoices
      operationId: list_invoices
      security:
        - OAuth:
            - invoices:read
      parameters:
        - in: query
          name: sort
          schema:
            type: string
          description: |
            Sorting. Comma-separated list indicating the sorting order for results.
            The format is **field_name:sort_mode** where
            * **field_name** is the name of the field to sort. Available field names are: `due_at`, `issued_at` and `totals_total`.
            * **sort_mode** is `asc` for ascendant or `desc` for descendant.
          example: due_at:desc,issued_at:asc,totals_total:desc
        - $ref: '#/components/parameters/PaginationFirst'
        - $ref: '#/components/parameters/PaginationAfter'
        - in: query
          name: seller_id
          schema:
            $ref: '#/components/schemas/AccountId'
          description: Filtering. The seller unique identifier.
        - in: query
          name: buyer_id
          schema:
            $ref: '#/components/schemas/AccountId'
          description: Filtering. The buyer unique identifier.
        - in: query
          name: reference
          schema:
            $ref: '#/components/schemas/InvoiceReference'
          description: |
            Filtering. Your reference for the invoice.
        - in: query
          name: code
          schema:
            $ref: '#/components/schemas/InvoiceCode'
          description: |
            Filtering. The invoice code.
            It is usually used to identify this invoice in tax declarations.
        - in: query
          name: issued_at_from
          schema:
            $ref: '#/components/schemas/IssuedAt'
            example: '2023-01-01T01:01:00.000Z'
          description: |
            Filtering. Issue date and time (inclusive) of the first invoice to get. Using [ISO 8601](https://www.w3.org/TR/NOTE-datetime) standard for the combined date and time in UTC.

            Minimum: 2 years before the current date and time.

            Maximum: the date and time set in `issued_at_to` parameter.
        - in: query
          name: issued_at_to
          schema:
            $ref: '#/components/schemas/IssuedAt'
            example: '2024-01-01T01:01:00.000Z'
          description: |
            Filtering. Issue date and time (inclusive) of the last invoice to retrieve. Using [ISO 8601](https://www.w3.org/TR/NOTE-datetime) standard for the combined date and time in UTC.

            Minimum: the date and time set in `issued_at_from` parameter.

            Maximum: current date and time.
        - in: query
          name: due_at_from
          schema:
            $ref: '#/components/schemas/DateTime'
            example: '2023-01-01T01:01:00.000Z'
          description: |
            Filtering. Due date and time (inclusive) of the first invoice to retrieve. Using [ISO 8601](https://www.w3.org/TR/NOTE-datetime) standard for the combined date and time in UTC.

            Minimum: 2 years before the current date and time.

            Maximum: the date and time set in `due_at_to` parameter.
        - in: query
          name: due_at_to
          schema:
            $ref: '#/components/schemas/DateTime'
            example: '2024-01-01T01:01:00.000Z'
          description: |
            Filtering. Due date and time (inclusive) of the last invoice to get. Using [ISO 8601](https://www.w3.org/TR/NOTE-datetime) standard for the combined date and time in UTC.

            Minimum: the date and time set in `due_at_from` parameter.
        - in: query
          name: status
          schema:
            type: array
            items:
              $ref: '#/components/schemas/InvoiceStatus'
            example:
              - issued
              - cancelled
          description: |
            Filtering. Exact match of a list of invoice statuses.
        - in: query
          name: type
          schema:
            $ref: '#/components/schemas/InvoiceType'
          description: Filtering. The invoice type.
        - in: query
          name: subscription_id
          schema:
            $ref: '#/components/schemas/SubscriptionId'
          description: Filtering. The unique identifier of the subscription associated to the invoice.
        - in: query
          name: has_payment_advices
          schema:
            type: boolean
          description: Filtering. It indicates whether this invoice has payment advices linked or not.
      responses:
        '200':
          description: OK
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  cursor:
                    $ref: '#/components/schemas/PaginationCursor'
                  data:
                    allOf:
                      - $ref: '#/components/schemas/PaginationData'
                      - items:
                          $ref: '#/components/schemas/GetInvoicesResponse'
              examples:
                auto:
                  value:
                    cursor: Q3VyaW9zaXR5IEtpbGxlZCB0aGUgQ2F0Cg==
                    data:
                      - id: inv_4ehg1mkv3mvt3256vcn8dspb4h
                        code: INV-2024-0001
                        reference: 98f445bd-1316-4d6c-9243-f6b9d9192ef8
                        type: standard
                        status: issued
                        seller:
                          id: acc_44678r08jtm8zbt227tzhc4nw5
                          legal_name: getpaid autos
                        buyer:
                          id: acc_4w5az89g1p9dy9st7qe3rgstm7
                          legal_name: getpaid fleets
                        issued_at: '2023-09-01T22:05:48.479Z'
                        due_at: '2023-10-01T22:05:48.479Z'
                        currency: EUR
                        documents:
                          - type: invoice
                            id: doc_4wt0wrfqwz0vkatave0fkjg046
                            name: INV1000.pdf
                            format: pdf
                          - type: invoice_attachment
                            id: doc_4ttmf4m5hc96d6f9h93h55w3xf
                            name: details.xlsx
                            format: xlsx
                        totals:
                          tax: 2261
                          base: 10767
                          total: 13028
                        has_subsequents: false
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /v2alpha1/invoices/{invoice_id}:
    get:
      tags:
        - Invoices
      summary: Get Invoice
      operationId: get_invoice
      security:
        - OAuth:
            - invoices:read
      parameters:
        - name: invoice_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/InvoiceId'
      responses:
        '200':
          description: OK
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetInvoiceResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/ProblemNotFound'
        '409':
          $ref: '#/components/responses/ProblemConflict'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
    put:
      tags:
        - Invoices
      summary: Update Draft Invoice
      description: Updates an invoice. Only invoices on status `draft` can be updated.
      operationId: update_invoice
      security:
        - OAuth:
            - invoices:read_write
      parameters:
        - name: invoice_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/InvoiceId'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateInvoiceRequest'
        required: true
      responses:
        '200':
          description: OK
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdateInvoiceResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/ProblemNotFound'
        '422':
          $ref: '#/components/responses/ProblemInvalidParameters'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /v2alpha1/invoices/{invoice_id}/issue:
    post:
      tags:
        - Invoices
      summary: Issue Draft Invoice
      description: It issues a draft invoice. Please note that this operation is allowed only if the related infoice is in `draft` status.
      operationId: issue_draft_invoice
      security:
        - OAuth:
            - invoices:read_write
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
        - name: invoice_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/InvoiceId'
      responses:
        '204':
          $ref: '#/components/responses/NoContent'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/ProblemNotFound'
        '409':
          $ref: '#/components/responses/ProblemConflict'
        '422':
          $ref: '#/components/responses/ProblemInvalidParameters'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /v2alpha1/invoices/{invoice_id}/cancel:
    post:
      tags:
        - Invoices
      summary: Cancel Draft Invoice
      description: It cancels a draft invoice. Please note that this operation is allowed only if the related infoice is in `draft` status.
      operationId: cancel_draft_invoice
      security:
        - OAuth:
            - invoices:read_write
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
        - name: invoice_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/InvoiceId'
      responses:
        '204':
          $ref: '#/components/responses/NoContent'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/ProblemNotFound'
        '409':
          $ref: '#/components/responses/ProblemConflict'
        '422':
          $ref: '#/components/responses/ProblemInvalidParameters'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /v2alpha1/invoices/exports:
    post:
      tags:
        - Invoices Reports
      summary: Export Invoices
      description: |
        Request to export to a file a list of invoices with the specified filters.

        The export process is asynchronous. The response will contain the export unique identifier that can be used to check the status of the job using the [Get Invoices Export Status](#operation/get_invoices_export) endpoint.

        When the export is completed, the report file will be available for download at the URL provided in the response using [Get Invoice Report](#operation/get_invoices_report) endpoint.
      operationId: export_invoices
      security:
        - OAuth:
            - invoices:read
        - OAuth:
            - invoices:read_write
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExportInvoicesRequest'
        required: true
      responses:
        '202':
          description: Accepted
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExportInvoicesResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '409':
          $ref: '#/components/responses/ProblemConflict'
        '422':
          $ref: '#/components/responses/ProblemInvalidParameters'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /v2alpha1/invoices/exports/{export_id}:
    get:
      tags:
        - Invoices Reports
      summary: Get Invoices Export Status
      description: |
        Get the status of an asynchronous export job.

        The export process can be initiated using the [Export Invoices](#operation/export_invoices) endpoint.
      operationId: get_invoices_export
      security:
        - OAuth:
            - invoices:read
        - OAuth:
            - invoices:read_write
      parameters:
        - name: export_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/ExportId'
      responses:
        '200':
          description: OK
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetInvoicesExportResponse'
              examples:
                pending:
                  $ref: '#/components/examples/GetInvoicesExportPendingResponse'
                completed:
                  $ref: '#/components/examples/GetInvoicesExportCompletedResponse'
                error:
                  $ref: '#/components/examples/GetInvoicesExportErrorResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/ProblemNotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /v2alpha1/invoices/reports/{report_id}:
    get:
      tags:
        - Invoices Reports
      summary: Get Invoices Report
      description: Download the invoices report as a result of the export job. Check the status of the export job using the [Get Invoices Export Status](#operation/get_invoices_export) endpoint.
      operationId: get_invoices_report
      security:
        - OAuth:
            - invoices:read
        - OAuth:
            - invoices:read_write
      parameters:
        - name: report_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/ReportId'
      responses:
        '200':
          description: OK
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
            Content-Disposition:
              $ref: '#/components/headers/ContentDisposition'
              example: attachment; filename=invoices.20240530113200.csv; filename*=UTF-8''invoices.20240530113200.csv
          content:
            text/csv:
              schema:
                type: string
                format: binary
              example: |-
                series_prefix,code,reference,status,type,issued_at,due_at,seller_registration_number,seller_legal_name,buyer_registration_number,buyer_legal_name,total,base,tax,currency,taxes_0_type,taxes_0_reference,taxes_0_percent,taxes_0_base,taxes_0_tax,taxes_1_type,taxes_1_reference,taxes_1_percent,taxes_1_base,taxes_1_tax,taxes_2_type,taxes_2_reference,taxes_2_percent,taxes_2_base,taxes_2_tax,metadata_0_key,metadata_0_value,metadata_1_key,metadata_1_value
                ABC,INV_A2024000006,A2024000006,issued,standard,2023-10-06T00:00:00.000Z,2023-11-05T00:00:00.000Z,123456789A,legal name seller,987654321B,legal name buyer,4000,2000,300,EUR,percentage,other,5,1000,5,,,,,,,,,,,key_1,value 1,key_2,value 2
                ABC,INV_A2024000005,A2024000005,issued,standard,2023-10-05T00:00:00.000Z,2023-11-04T00:00:00.000Z,123456789A,legal name seller,987654321B,legal name buyer,5000,3000,500,EUR,percentage,other,5,1000,5,percentage,vat,25,2000,500,percentage,vat,10,2000,20,key_1,value 1,,
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/ProblemNotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /v2alpha1/invoices/documents:
    post:
      tags:
        - Invoice Documents
      summary: Upload Invoice Document
      description: |
        Upload an additional document to be attached to an invoice.

        After uploading the document, it can be linked to the invoice using the `id` of the document from the response in the [Create Invoice](#operation/create_invoice) endpoint.

        The format of the document uploaded must correspond to the MIME type in the `Content-Type` header. See the [corresponding MIME types to each kind of document](#section/Introduction/Files-MIME-Types).
      operationId: upload_invoice_document
      security:
        - OAuth:
            - invoices:read_write
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/UploadDocumentRequest'
            examples:
              default:
                $ref: '#/components/examples/UploadInvoiceDocument'
        required: true
      responses:
        '201':
          description: Created
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UploadDocumentResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '409':
          $ref: '#/components/responses/ProblemConflict'
        '413':
          $ref: '#/components/responses/ContentTooLarge'
        '422':
          $ref: '#/components/responses/ProblemInvalidParameters'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /v2alpha1/invoices/{invoice_id}/documents/{document_id}:
    get:
      tags:
        - Invoice Documents
      summary: Get Invoice Document
      operationId: get_invoice_document
      description: |
        Downloads a document related to an invoice.

        The document can be a file generated with the invoice data or a file uploaded by the user.
      security:
        - OAuth:
            - invoices:read
        - OAuth:
            - invoices:read_write
      parameters:
        - name: invoice_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/InvoiceId'
        - name: document_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/DocumentId'
      responses:
        '200':
          description: OK
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
            Content-Disposition:
              $ref: '#/components/headers/ContentDisposition'
          content:
            application/msword:
              schema:
                $ref: '#/components/schemas/DownloadDocumentResponse'
            application/pdf:
              schema:
                $ref: '#/components/schemas/DownloadDocumentResponse'
            application/vnd.ms-excel:
              schema:
                $ref: '#/components/schemas/DownloadDocumentResponse'
            application/vnd.openxmlformats-officedocument.spreadsheetml.sheet:
              schema:
                $ref: '#/components/schemas/DownloadDocumentResponse'
            application/vnd.openxmlformats-officedocument.wordprocessingml.document:
              schema:
                $ref: '#/components/schemas/DownloadDocumentResponse'
            image/jpeg:
              schema:
                $ref: '#/components/schemas/DownloadDocumentResponse'
            image/png:
              schema:
                $ref: '#/components/schemas/DownloadDocumentResponse'
            image/svg+xml:
              schema:
                $ref: '#/components/schemas/DownloadDocumentResponse'
            text/csv:
              schema:
                $ref: '#/components/schemas/DownloadDocumentResponse'
            text/markdown:
              schema:
                $ref: '#/components/schemas/DownloadDocumentResponse'
            text/plain:
              schema:
                $ref: '#/components/schemas/DownloadDocumentResponse'
            text/tab-separated-values:
              schema:
                $ref: '#/components/schemas/DownloadDocumentResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/ProblemNotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /v2alpha1/subscriptions:
    post:
      tags:
        - Subscriptions
      summary: Create Subscription
      description: |
        Create a subscription. All dates are to be considered in the seller's timezone.
      operationId: create_subscription
      security:
        - OAuth:
            - invoices:read_write
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateSubscriptionRequest'
            examples:
              custom:
                $ref: '#/components/examples/CreateSubscriptionCustom'
        required: true
      responses:
        '201':
          description: Created
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateSubscriptionResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '409':
          $ref: '#/components/responses/ProblemConflict'
        '422':
          $ref: '#/components/responses/ProblemInvalidParameters'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
    get:
      tags:
        - Subscriptions
      summary: List Subscriptions
      description: List the existing subscriptions.
      operationId: list_subscriptions
      security:
        - OAuth:
            - invoices:read
        - OAuth:
            - invoices:read_write
      parameters:
        - $ref: '#/components/parameters/PaginationFirst'
        - $ref: '#/components/parameters/PaginationAfter'
        - in: query
          name: seller_id
          schema:
            $ref: '#/components/schemas/AccountId'
          description: Filtering. The seller unique identifier.
        - in: query
          name: buyer_id
          schema:
            $ref: '#/components/schemas/AccountId'
          description: Filtering. The buyer unique identifier.
        - in: query
          name: name
          schema:
            $ref: '#/components/schemas/SubscriptionName'
          description: Filtering. The subscription name.
      responses:
        '200':
          description: OK
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListSubscriptionsResponse'
              examples:
                default:
                  $ref: '#/components/examples/ListSubscriptions'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ProblemInvalidParameters'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /v2alpha1/subscriptions/{subscription_id}:
    patch:
      tags:
        - Subscriptions
      summary: Update Subscription
      description: |
        Update a subscription. Buyer, seller and billing cycle cannot be updated. The updated subscription can be configured to be effective at a future date.
        If not provided, the update will take effect on the next issued invoice. The new configuration will replace the existing one. All dates are to be considered in the seller's timezone.
      operationId: update_subscription
      security:
        - OAuth:
            - invoices:read_write
      parameters:
        - name: subscription_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/SubscriptionId'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateSubscriptionRequest'
            examples:
              custom:
                $ref: '#/components/examples/UpdateSubscriptionCustom'
        required: true
      responses:
        '200':
          description: Updated
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdateSubscriptionResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/ProblemNotFound'
        '422':
          $ref: '#/components/responses/ProblemInvalidParameters'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
    get:
      tags:
        - Subscriptions
      summary: Get Subscription
      description: Get the subscription details.
      operationId: get_subscription
      security:
        - OAuth:
            - invoices:read
        - OAuth:
            - invoices:read_write
      parameters:
        - name: subscription_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/SubscriptionId'
      responses:
        '200':
          description: OK
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetSubscriptionResponse'
              examples:
                default:
                  $ref: '#/components/examples/GetSubscription'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/ProblemNotFound'
        '422':
          $ref: '#/components/responses/ProblemInvalidParameters'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /v2alpha1/labels:
    post:
      tags:
        - Labels
      summary: Create Label
      operationId: create_label
      security:
        - OAuth:
            - accounts:read_write
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateLabelRequest'
        required: true
      responses:
        '201':
          description: Created
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateLabelResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '409':
          $ref: '#/components/responses/ProblemConflict'
        '422':
          $ref: '#/components/responses/ProblemInvalidParameters'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
    get:
      tags:
        - Labels
      summary: List Labels
      operationId: list_labels
      security:
        - OAuth:
            - accounts:read
        - OAuth:
            - accounts:read_write
      parameters:
        - in: query
          name: sort
          schema:
            type: string
          description: |
            Sorting. Comma-separated list indicating the sorting order for results.
            The format is **field_name:sort_mode** where
            * field_name is the name of the field to sort. Available field name is: `name`.
            * sort_mode is **asc** for ascendant or **desc** for descendant.
          example: name:desc
      responses:
        '200':
          description: OK
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    type: array
                    description: The list of items.
                    items:
                      $ref: '#/components/schemas/GetLabelResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ProblemInvalidParameters'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /v2alpha1/labels/{label_id}:
    get:
      tags:
        - Labels
      summary: Get Label
      operationId: get_label
      security:
        - OAuth:
            - accounts:read_write
        - OAuth:
            - accounts:read
      parameters:
        - name: label_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/LabelId'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetLabelResponse'
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/ProblemNotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
    put:
      tags:
        - Labels
      summary: Update Label
      operationId: update_label
      security:
        - OAuth:
            - accounts:read_write
      parameters:
        - name: label_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/LabelId'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateLabelRequest'
        required: true
      responses:
        '200':
          description: OK
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateLabelResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '409':
          $ref: '#/components/responses/ProblemConflict'
        '422':
          $ref: '#/components/responses/ProblemInvalidParameters'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
    delete:
      tags:
        - Labels
      summary: Delete Label
      operationId: delete_label
      security:
        - OAuth:
            - accounts:read_write
      parameters:
        - name: label_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/LabelId'
        - $ref: '#/components/parameters/IdempotencyKey'
      responses:
        '204':
          description: No Content
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/ProblemNotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /v2alpha1/payment_advices/{payment_advice_id}:
    get:
      tags:
        - Payment Advices
      summary: Get Payment Advice
      operationId: get_payment_advice
      security:
        - OAuth:
            - invoices:read
      parameters:
        - name: payment_advice_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/PaymentAdviceId'
      responses:
        '200':
          description: OK
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetPaymentAdviceResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/ProblemNotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /v2alpha1/payment_advices/{payment_advice_id}/documents/{document_id}:
    get:
      tags:
        - Payment Advice Documents
      summary: Get Payment Advice Document
      operationId: get_payment_advice_document
      description: |
        Retrieves and downloads an attached document associated with a specific payment advice.
      security:
        - OAuth:
            - invoices:read
        - OAuth:
            - invoices:read_write
      parameters:
        - name: payment_advice_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/PaymentAdviceId'
        - name: document_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/DocumentId'
      responses:
        '200':
          description: OK
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
            Content-Disposition:
              $ref: '#/components/headers/ContentDisposition'
              example: attachment; filename=payment_advice.pdf; filename*=UTF-8''payment_advice.pdf
          content:
            application/pdf:
              schema:
                $ref: '#/components/schemas/DownloadDocumentResponse'
            text/plain:
              schema:
                $ref: '#/components/schemas/DownloadDocumentResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/ProblemNotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /v2alpha1/payment_instruments:
    post:
      tags:
        - Payment Instruments
      summary: Create Payment Instument
      operationId: create_payment_instrument
      security:
        - OAuth:
            - accounts:read_write
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePaymentInstrumentRequest'
        required: true
      responses:
        '201':
          description: Created
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreatePaymentInstrumentResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '409':
          $ref: '#/components/responses/ProblemConflict'
        '422':
          $ref: '#/components/responses/ProblemInvalidParameters'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
    get:
      tags:
        - Payment Instruments
      summary: List Payment Instruments
      description: |
        List payment instruments associated the specified accounts.
      operationId: list_account_payment_instruments
      security:
        - OAuth:
            - accounts:read
        - OAuth:
            - accounts:read_write
      parameters:
        - in: query
          name: sort
          schema:
            type: string
          description: |
            Sorting. Comma-separated list indicating the sorting order for results.
            The format is **field_name:sort_mode** where
            * field_name is the name of the field to sort. Available field names are: `account_number_value` and `bank_type`.
            * sort_mode is **asc** for ascendant or **desc** for descendant.

            By default: `account_number_value:asc`.
          example: account_number_value:desc
        - $ref: '#/components/parameters/PaginationFirst'
        - $ref: '#/components/parameters/PaginationAfter'
        - in: query
          name: account_id
          schema:
            type: array
            items:
              $ref: '#/components/schemas/AccountId'
            example:
              - acc_44678r08jtm8zbt227tzhc4nw5
              - acc_47252596b36e4004a03cfa82c5
          description: Filtering. Exact match of a list of account IDs.
        - in: query
          name: account_number_value
          schema:
            type: string
            example: 210031189
          description: Filtering. It applies `contains` operator to the value of the account number.
        - in: query
          name: type
          schema:
            type: string
            example: bank_account
            enum:
              - bank_account
          description: Filtering. The type of payment instrument.
        - in: query
          name: status
          schema:
            $ref: '#/components/schemas/PaymentInstrumentStatus'
            example: active,inactive
          description: |
            Filtering. Comma-separated list indicating the payment instrument status.
      responses:
        '200':
          description: OK
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/Pagination'
                  - $ref: '#/components/schemas/ListPaymentInstrumentsResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ProblemInvalidParameters'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /v2alpha1/payment_instruments/{payment_instrument_id}:
    get:
      tags:
        - Payment Instruments
      summary: Get Payment Instrument
      description: |
        Gets a payment instrument associated to the owner account.
      operationId: get_payment_instrument
      security:
        - OAuth:
            - accounts:read
        - OAuth:
            - accounts:read_write
      parameters:
        - name: payment_instrument_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/PaymentInstrumentId'
      responses:
        '200':
          description: OK
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetPaymentInstrumentResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/ProblemNotFound'
        '422':
          $ref: '#/components/responses/ProblemInvalidParameters'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /v2alpha1/payment_instruments/{payment_instrument_id}/disable:
    post:
      tags:
        - Payment Instruments
      summary: Disable Payment Instrument
      description: It disables an existing payment instrument.
      operationId: disable_payment_instrument
      security:
        - OAuth:
            - accounts:read_write
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
        - name: payment_instrument_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/PaymentInstrumentId'
      responses:
        '204':
          $ref: '#/components/responses/NoContent'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/ProblemNotFound'
        '409':
          $ref: '#/components/responses/ProblemConflict'
        '422':
          $ref: '#/components/responses/ProblemInvalidParameters'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /v2alpha1/payment_instruments/{payment_instrument_id}/enable:
    post:
      tags:
        - Payment Instruments
      summary: Enable Payment Instrument
      description: It enables a disabled payment instrument.
      operationId: enable_payment_instrument
      security:
        - OAuth:
            - accounts:read_write
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
        - name: payment_instrument_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/PaymentInstrumentId'
      responses:
        '204':
          $ref: '#/components/responses/NoContent'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/ProblemNotFound'
        '409':
          $ref: '#/components/responses/ProblemConflict'
        '422':
          $ref: '#/components/responses/ProblemInvalidParameters'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /v2alpha1/payment_terms:
    get:
      tags:
        - Payment Terms
      summary: List Payment Terms
      operationId: list_payment_terms
      security:
        - OAuth:
            - payment_terms:read
      parameters:
        - in: query
          name: sort
          schema:
            type: string
          description: |
            Sorting. Comma-separated list indicating the sorting order for results.
            The format is **field_name:sort_mode** where
            * **field_name** is the name of the field to sort. Available field names are: `due_at`, `amount`, `transaction_amount`.
            * **sort_mode** is `asc` for ascendant or `desc` for descendant.

            By default: `due_at:desc`.
          example: due_at:desc,paid_amount:asc
        - $ref: '#/components/parameters/PaginationFirst'
        - $ref: '#/components/parameters/PaginationAfter'
        - in: query
          name: id
          schema:
            $ref: '#/components/schemas/PaymentTermId'
        - in: query
          name: status
          schema:
            $ref: '#/components/schemas/PaymentTermStatus'
            example: unmatched
          description: |
            Filtering. The status of the payment term.
        - in: query
          name: buyer_id
          schema:
            $ref: '#/components/schemas/AccountId'
          description: |
            Filtering. The buyer account receving the invoice.
        - in: query
          name: seller_id
          schema:
            $ref: '#/components/schemas/AccountId'
            example: acc_4tfwx4hygbkwnepj8t8md13v5z
          description: |
            Filtering. The seller account issuing the invoice.
        - in: query
          name: invoice_code
          schema:
            $ref: '#/components/schemas/InvoiceCode'
          description: |
            Filtering. The code of the invoice.
        - in: query
          name: due_at_from
          schema:
            $ref: '#/components/schemas/DateTime'
            example: '2023-01-01T01:01:00.000Z'
          description: |
            Filtering. Due date and time (inclusive) of the first payment term to get. Using [ISO 8601](https://www.w3.org/TR/NOTE-datetime) standard for the combined date and time in UTC.

            Minimum: 2 years before the current date and time.

            Maximum: the date and time set in `due_at_to` parameter.
        - in: query
          name: due_at_to
          schema:
            $ref: '#/components/schemas/DateTime'
          description: |
            Filtering. Due date and time (inclusive) of the last payment term to get. Using [ISO 8601](https://www.w3.org/TR/NOTE-datetime) standard for the combined date and time in UTC.

            Minimum: the date and time set in `due_at_from` parameter.
        - in: query
          name: transaction_booking_at_from
          schema:
            $ref: '#/components/schemas/DateTime'
            example: '2023-01-01T01:01:00.000Z'
          description: |
            Filtering. Transaction date and time (inclusive) of the first payment term to get. Using [ISO 8601](https://www.w3.org/TR/NOTE-datetime) standard for the combined date and time in UTC.

            Minimum: 2 years before the current date and time.

            Maximum: the date and time set in `transaction_booking_at_to` parameter.
        - in: query
          name: transaction_booking_at_to
          schema:
            $ref: '#/components/schemas/DateTime'
          description: |
            Filtering. Transaction date and time (inclusive) of the last payment term to get. Using [ISO 8601](https://www.w3.org/TR/NOTE-datetime) standard for the combined date and time in UTC.

            Minimum: the date and time set in `transaction_booking_at_from` parameter.
        - in: query
          name: transaction_description
          schema:
            type: string
            example: INV88430
          description: Filtering. The description of the transaction.
      responses:
        '200':
          description: OK
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/Pagination'
                  - properties:
                      data:
                        items:
                          $ref: '#/components/schemas/PaymentTerm'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /v2alpha1/payment_terms/{payment_term_id}:
    get:
      tags:
        - Payment Terms
      summary: Get Payment Term
      operationId: get_payment_term
      security:
        - OAuth:
            - payment_terms:read
      parameters:
        - name: payment_term_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/PaymentTermId'
      responses:
        '200':
          description: OK
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetPaymentTermResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/ProblemNotFound'
        '422':
          $ref: '#/components/responses/ProblemInvalidParameters'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /v2alpha1/payment_terms/{payment_term_id}/transactions/{transaction_id}/confirm:
    post:
      tags:
        - Payment Terms
      summary: Confirm Payment Term Match
      operationId: confirm_payment_term_match
      security:
        - OAuth:
            - payment_terms:read_write
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
        - name: payment_term_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/PaymentTermId'
        - name: transaction_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/TransactionId'
      responses:
        '204':
          $ref: '#/components/responses/NoContent'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/ProblemNotFound'
        '409':
          $ref: '#/components/responses/ProblemConflict'
        '422':
          $ref: '#/components/responses/ProblemInvalidParameters'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /v2alpha1/payment_terms/{payment_term_id}/transactions/{transaction_id}/reject:
    post:
      tags:
        - Payment Terms
      summary: Reject Payment Term Match
      operationId: reject_payment_term_match
      security:
        - OAuth:
            - payment_terms:read_write
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
        - name: payment_term_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/PaymentTermId'
        - name: transaction_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/TransactionId'
      responses:
        '204':
          $ref: '#/components/responses/NoContent'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/ProblemNotFound'
        '409':
          $ref: '#/components/responses/ProblemConflict'
        '422':
          $ref: '#/components/responses/ProblemInvalidParameters'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /v2alpha1/chats:
    post:
      tags:
        - Chats
      summary: Create Chat
      description: Creates a chat to interact with the AI assistant.
      operationId: create_chat
      security:
        - OAuth:
            - chats:read_write
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  $ref: '#/components/schemas/ChatName'
                user:
                  $ref: '#/components/schemas/ChatUser'
        required: true
      responses:
        '201':
          description: Created
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
          content:
            application/json:
              schema:
                type: object
                required:
                  - id
                  - created_at
                properties:
                  id:
                    $ref: '#/components/schemas/ChatId'
                  created_at:
                    $ref: '#/components/schemas/CreatedAt'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '409':
          $ref: '#/components/responses/ProblemConflict'
        '422':
          $ref: '#/components/responses/ProblemInvalidParameters'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
    get:
      tags:
        - Chats
      summary: List Chats
      description: Gets a list of chats.
      operationId: list_chats
      security:
        - OAuth:
            - chats:read_write
      parameters:
        - in: query
          name: sort
          schema:
            type: string
          description: |
            Sorting. Comma-separated list indicating the sorting order for results.
            The format is **field_name:sort_mode** where
            * field_name is the name of the field to sort. Available field names are: `created_at`.
            * sort_mode is **asc** for ascendant or **desc** for descendant.

            By default: `created_at:desc`.
          example: created_at:desc
        - $ref: '#/components/parameters/PaginationFirst'
        - $ref: '#/components/parameters/PaginationAfter'
        - in: query
          name: user_reference
          schema:
            $ref: '#/components/schemas/UserReference'
          description: Filtering. Exact match of the user reference.
      responses:
        '200':
          description: OK
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  cursor:
                    $ref: '#/components/schemas/PaginationCursor'
                  data:
                    allOf:
                      - $ref: '#/components/schemas/PaginationData'
                      - items:
                          type: object
                          required:
                            - id
                            - created_at
                          properties:
                            id:
                              $ref: '#/components/schemas/ChatId'
                            created_at:
                              $ref: '#/components/schemas/CreatedAt'
                            name:
                              $ref: '#/components/schemas/ChatName'
                            user:
                              $ref: '#/components/schemas/ChatUser'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /v2alpha1/chats/{chat_id}/messages:
    get:
      tags:
        - Chats
      summary: List Messages
      description: Gets a list of messages related to a specific chat.
      operationId: list_chat_messages
      security:
        - OAuth:
            - chats:read_write
      parameters:
        - name: chat_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/ChatId'
        - in: query
          name: sort
          schema:
            type: string
          description: |
            Sorting. Comma-separated list indicating the sorting order for results.
            The format is **field_name:sort_mode** where
            * field_name is the name of the field to sort. Available field names are: `sent_at`.
            * sort_mode is **asc** for ascendant or **desc** for descendant.

            By default: `sent_at:desc`.
          example: sent_at:desc
        - $ref: '#/components/parameters/PaginationFirst'
        - $ref: '#/components/parameters/PaginationAfter'
      responses:
        '200':
          description: OK
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  cursor:
                    $ref: '#/components/schemas/PaginationCursor'
                  data:
                    allOf:
                      - $ref: '#/components/schemas/PaginationData'
                      - items:
                          type: object
                          required:
                            - type
                            - sent_at
                            - content
                          properties:
                            type:
                              $ref: '#/components/schemas/MessageType'
                            sent_at:
                              $ref: '#/components/schemas/SentAt'
                            content:
                              $ref: '#/components/schemas/MessageContent'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/ProblemNotFound'
        '422':
          $ref: '#/components/responses/ProblemInvalidParameters'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
    post:
      tags:
        - Chats
      summary: Send Message
      description: Sends a message to a the chat.
      operationId: send_chat_message
      security:
        - OAuth:
            - chats:read_write
      parameters:
        - name: chat_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/ChatId'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - content
              properties:
                content:
                  $ref: '#/components/schemas/MessageContent'
        required: true
      responses:
        '200':
          description: OK
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
          content:
            text/event-stream:
              schema:
                $ref: '#/components/schemas/MessageResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/ProblemNotFound'
        '422':
          $ref: '#/components/responses/ProblemInvalidParameters'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /v2alpha1/chats/{chat_id}/documents:
    post:
      tags:
        - Chats
      summary: Upload Chat Document
      description: |
        Upload a document to be attached to a chat. Please check the [supported MIME types](#tag/Chats/Supported-MIME-Types).
      operationId: upload_chat_document
      security:
        - OAuth:
            - chats:read_write
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
        - name: chat_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/ChatId'
      requestBody:
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/UploadDocumentRequest'
            examples:
              default:
                $ref: '#/components/examples/UploadChatDocument'
        required: true
      responses:
        '201':
          description: Created
          headers:
            Getpaid-Trace-Id:
              $ref: '#/components/headers/TraceId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UploadDocumentResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/ProblemNotFound'
        '409':
          $ref: '#/components/responses/ProblemConflict'
        '413':
          $ref: '#/components/responses/ContentTooLarge'
        '422':
          $ref: '#/components/responses/ProblemInvalidParameters'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
webhooks:
  invoice_draft_document_updated:
    post:
      summary: Invoice Draft Document Updated
      operationId: invoice_draft_document_updated
      description: The `invoice_draft_document_updated` webhook is sent when the invoice document is generated for a draft invoice.
      tags:
        - Invoice Webhooks
      parameters:
        - $ref: '#/components/parameters/TraceId'
      requestBody:
        content:
          application/json:
            schema:
              allOf:
                - $ref: '#/components/schemas/WebhookBaseRequest'
                - properties:
                    type:
                      const: invoice_draft_document_created
                    data:
                      type: object
                      required:
                        - id
                      properties:
                        id:
                          $ref: '#/components/schemas/InvoiceId'
                        reference:
                          $ref: '#/components/schemas/InvoiceReference'
                        document:
                          type: object
                          required:
                            - id
                            - name
                            - format
                            - url
                          properties:
                            id:
                              $ref: '#/components/schemas/DocumentId'
                            name:
                              type: string
                              maxLength: 100
                              description: The document name.
                              example: INV1000.pdf
                            format:
                              type: string
                              description: The format which the document is.
                              enum:
                                - pdf
                            url:
                              $ref: '#/components/schemas/Url'
                              description: The URL of the document.
                              example: https://api.getpaid.io/v2alpha1/invoices/inv_4ehg1mkv3mvt3256vcn8dspb4h/documents/doc_4ehg1mkv3mvt3256vcn8dspb4h
      responses:
        '429':
          description: The webhook action will be retried according to the workflow retry schedule
        2XX:
          description: Indicate success, the webhook will not be retried
        4XX:
          description: The webhook action will be disabled
        5XX:
          description: The webhook action will be retried according to the workflow retry schedule
  invoice_issued:
    post:
      summary: Invoice Issued
      operationId: invoice_issued
      description: |
        The `invoice_issued` webhook is sent when an invoice is issued: right after creation when the invoice is created with a provided code or when the code is generated if it is based on a series.
      tags:
        - Invoice Webhooks
      parameters:
        - $ref: '#/components/parameters/TraceId'
      requestBody:
        content:
          application/json:
            schema:
              allOf:
                - $ref: '#/components/schemas/WebhookBaseRequest'
                - properties:
                    type:
                      const: invoice_issued
                    data:
                      type: object
                      required:
                        - id
                        - code
                        - issued_at
                        - payment
                      properties:
                        id:
                          $ref: '#/components/schemas/InvoiceId'
                        reference:
                          $ref: '#/components/schemas/InvoiceReference'
                        code:
                          $ref: '#/components/schemas/InvoiceCode'
                        issued_at:
                          $ref: '#/components/schemas/InvoiceIssuedAt'
                        payment:
                          type: object
                          description: Payment conditions.
                          required:
                            - terms
                          properties:
                            terms:
                              $ref: '#/components/schemas/TermsIssued'
                        subscription:
                          $ref: '#/components/schemas/Subscription'
                          description: Available only for invoices issued for subscriptions.
      responses:
        '429':
          description: The webhook action will be retried according to the workflow retry schedule
        2XX:
          description: Indicate success, the webhook will not be retried
        4XX:
          description: The webhook action will be disabled
        5XX:
          description: The webhook action will be retried according to the workflow retry schedule
  invoice_document_created:
    post:
      summary: Invoice Document Created
      operationId: invoice_document_created
      description: |
        The `invoice_document_created` webhook is sent when the invoice document is generated.
      tags:
        - Invoice Webhooks
      parameters:
        - $ref: '#/components/parameters/TraceId'
      requestBody:
        content:
          application/json:
            schema:
              allOf:
                - $ref: '#/components/schemas/WebhookBaseRequest'
                - properties:
                    type:
                      const: invoice_document_created
                    data:
                      type: object
                      required:
                        - id
                      properties:
                        id:
                          $ref: '#/components/schemas/InvoiceId'
                        reference:
                          $ref: '#/components/schemas/InvoiceReference'
                        document:
                          type: object
                          description: The invoice document was generated.
                          required:
                            - id
                            - name
                            - format
                            - url
                          properties:
                            id:
                              $ref: '#/components/schemas/DocumentId'
                            name:
                              type: string
                              maxLength: 100
                              description: The document name.
                              example: INV1000.pdf
                            format:
                              type: string
                              description: The format which the document is.
                              enum:
                                - pdf
                            url:
                              $ref: '#/components/schemas/Url'
                              description: The URL of the document.
                              example: https://api.getpaid.io/v2alpha1/invoices/inv_4ehg1mkv3mvt3256vcn8dspb4h/documents/doc_4ehg1mkv3mvt3256vcn8dspb4h
      responses:
        '429':
          description: The webhook action will be retried according to the workflow retry schedule
        2XX:
          description: Indicate success, the webhook will not be retried
        4XX:
          description: The webhook action will be disabled
        5XX:
          description: The webhook action will be retried according to the workflow retry schedule
  invoice_buyer_notification_sent:
    post:
      summary: Invoice Buyer Notification Sent
      operationId: invoice_buyer_notification_sent
      description: |
        The `invoice_buyer_notification_sent` webhook is sent when the invoice notification is sent to the buyer.
      tags:
        - Invoice Webhooks
      parameters:
        - $ref: '#/components/parameters/TraceId'
      requestBody:
        content:
          application/json:
            schema:
              allOf:
                - $ref: '#/components/schemas/WebhookBaseRequest'
                - properties:
                    type:
                      const: invoice_buyer_notification_sent
                    data:
                      type: object
                      required:
                        - id
                      properties:
                        id:
                          $ref: '#/components/schemas/InvoiceId'
                        reference:
                          $ref: '#/components/schemas/InvoiceReference'
                        notification:
                          type: string
                          enum:
                            - email
      responses:
        '429':
          description: The webhook action will be retried according to the workflow retry schedule
        2XX:
          description: Indicate success, the webhook will not be retried
        4XX:
          description: The webhook action will be disabled
        5XX:
          description: The webhook action will be retried according to the workflow retry schedule
  invoice_match_suggested:
    post:
      summary: Invoice Match Suggested
      operationId: invoice_match_suggested
      description: |
        The `invoice_match_suggested` webhook is sent when a bank transaction has been suggested to match an invoice.
      tags:
        - Invoice Webhooks
      parameters:
        - $ref: '#/components/parameters/TraceId'
      requestBody:
        content:
          application/json:
            schema:
              allOf:
                - $ref: '#/components/schemas/WebhookBaseRequest'
                - properties:
                    type:
                      const: invoice_match_suggested
                    data:
                      type: object
                      required:
                        - id
                      properties:
                        id:
                          $ref: '#/components/schemas/InvoiceId'
                        reference:
                          $ref: '#/components/schemas/InvoiceReference'
                        match:
                          type: object
                          required:
                            - payment_term_id
                            - transaction_id
                          properties:
                            payment_term_id:
                              description: The payment term id of the suggested match.
                              $ref: '#/components/schemas/PaymentTermId'
                            transaction_id:
                              description: The transaction id of the suggested match.
                              $ref: '#/components/schemas/TransactionId'
      responses:
        '429':
          description: The webhook action will be retried according to the workflow retry schedule
        2XX:
          description: Indicate success, the webhook will not be retried
        4XX:
          description: The webhook action will be disabled
        5XX:
          description: The webhook action will be retried according to the workflow retry schedule
  bank_transaction_import_completed:
    post:
      summary: Bank Transactions Import Completed
      operationId: bank_transactions_import_completed
      description: |
        The `bank_transactions_import_completed` webhook is triggered when a bank transaction import is completed.
      tags:
        - Bank Transactions Enrichment Webhooks
      parameters:
        - $ref: '#/components/parameters/TraceId'
      requestBody:
        content:
          application/json:
            schema:
              allOf:
                - $ref: '#/components/schemas/WebhookBaseRequest'
                - properties:
                    type:
                      const: bank_transactions_import_completed
                    data:
                      type: object
                      required:
                        - id
                        - summary
                        - document
                      properties:
                        id:
                          $ref: '#/components/schemas/BankTransactionsImportId'
                        summary:
                          $ref: '#/components/schemas/BankTransactionImportSummary'
                        document:
                          $ref: '#/components/schemas/BankTransactionsValidDocument'
      responses:
        '429':
          description: The webhook action will be retried according to the workflow retry schedule
        2XX:
          description: Indicate success, the webhook will not be retried
        4XX:
          description: The webhook action will be disabled
        5XX:
          description: The webhook action will be retried according to the workflow retry schedule
  bank_transaction_import_error:
    post:
      summary: Bank Transactions Import Error
      operationId: bank_transactions_import_error
      description: |
        The `bank_transactions_import_error` webhook is triggered when a bank transaction import has failed.
      tags:
        - Bank Transactions Enrichment Webhooks
      parameters:
        - $ref: '#/components/parameters/TraceId'
      requestBody:
        content:
          application/json:
            schema:
              allOf:
                - $ref: '#/components/schemas/WebhookBaseRequest'
                - properties:
                    type:
                      const: bank_transactions_import_error
                    data:
                      type: object
                      required:
                        - id
                        - reason
                        - document
                      properties:
                        id:
                          $ref: '#/components/schemas/BankTransactionsImportId'
                        reason:
                          $ref: '#/components/schemas/BankTransactionsImportErrorReason'
                        document:
                          $ref: '#/components/schemas/BankTransactionsErrorDocument'
      responses:
        '429':
          description: The webhook action will be retried according to the workflow retry schedule
        2XX:
          description: Indicate success, the webhook will not be retried
        4XX:
          description: The webhook action will be disabled
        5XX:
          description: The webhook action will be retried according to the workflow retry schedule
  bank_transaction_import_validated:
    post:
      summary: Bank Transactions Import Validated
      operationId: bank_transactions_import_validated
      description: |
        The `bank_transactions_import_validated` webhook is triggered when a bank transaction import is validated.
      tags:
        - Bank Transactions Enrichment Webhooks
      parameters:
        - $ref: '#/components/parameters/TraceId'
      requestBody:
        content:
          application/json:
            schema:
              allOf:
                - $ref: '#/components/schemas/WebhookBaseRequest'
                - properties:
                    type:
                      const: bank_transactions_import_validated
                    data:
                      type: object
                      required:
                        - id
                        - document
                      properties:
                        id:
                          $ref: '#/components/schemas/BankTransactionsImportId'
                        document:
                          $ref: '#/components/schemas/BankTransactionsValidDocument'
      responses:
        '429':
          description: The webhook action will be retried according to the workflow retry schedule
        2XX:
          description: Indicate success, the webhook will not be retried
        4XX:
          description: The webhook action will be disabled
        5XX:
          description: The webhook action will be retried according to the workflow retry schedule
components:
  securitySchemes:
    OAuth:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: https://auth.getpaid.io/oauth/token
          scopes:
            accounts:read: Allows to read accounts.
            accounts:read_write: Allows to read and/or upsert accounts.
            bank_account_authorizations:read_write: Allows to read and/or create bank account authorizations.
            bank_transactions:read: Allows to read bank transactions.
            bank_transactions:read_write: Allows to read and/or upsert bank transactions.
            invoices:read: Allows to read invoices.
            invoices:read_write: Allows to read and/or upsert invoices.
            payment_terms:read: Allows to read payment terms.
            payment_terms:read_write: Allows to read and/or upsert payment terms.
            chats:read_write: Allows to read and/or upsert chats.
  schemas:
    OAuthTokenRequest:
      type: object
      properties:
        client_id:
          description: Your OAuth Client ID for the environment, Live or Sandbox, you are requesting the token for.
          type: string
          example: g6gWu46zeP0HH4jkW3i22yJ2shDrNxJ8
        client_secret:
          description: Your OAuth Client Secret for the environment, Live or Sandbox, you are requesting the token for.
          type: string
          example: S6gozTXzrS42OZ0cmxVJG133mOfuHhSfkIJkcH7FBm-0HyGrVZMLGJtyruTA4CQv
        audience:
          description: The API you wish to integrate with. Use this to switch between Sandbox and Live.
          type: string
          format: uri
          enum:
            - https://api.getpaid.io
            - https://api.sandbox.getpaid.io
        grant_type:
          description: The OAuth grant type
          type: string
          enum:
            - client_credentials
    OAuthTokenResponse:
      type: object
      properties:
        access_token:
          description: The OAuth Access token (JWT) used to authenticate to getpaid APIs
          type: string
          example: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImliVmVSLV...
        scope:
          description: The API scopes granted to the access token
          type: string
          example: payments
        expires_in:
          description: The duration (in seconds) until the access token expires
          type: integer
          example: 86400
        token_type:
          description: The type of token returned
          type: string
          enum:
            - Bearer
    Problem:
      type: object
      description: The Problem Details JSON Object [[RFC7807](https://tools.ietf.org/html/rfc7807)].
      required:
        - type
        - title
        - status
      properties:
        type:
          type: string
          description: A URI reference [[RFC3986](https://tools.ietf.org/html/rfc3986)] that identifies the problem type. It should provide human-readable documentation for the problem type. When this member is not present, its value is assumed to be "about:blank".
          format: uri
          example: https://docs.getpaid.io/ref/error-types#problem
        title:
          type: string
          description: A short, human-readable summary of the problem type. It SHOULD NOT change from occurrence to occurrence of the problem, except for purposes of localization.
          example: Invalid Request
        status:
          type: integer
          description: The HTTP status code.
          minimum: 400
          maximum: 599
        detail:
          type: string
          description: A human-readable explanation specific to this occurrence of the problem.
          example: The request body was invalid
    Id:
      type: string
      minLength: 30
      maxLength: 50
    AccountId:
      allOf:
        - $ref: '#/components/schemas/Id'
        - description: The unique identifier of the account.
          example: acc_44678r08jtm8zbt227tzhc4nw5
    Reference:
      type: string
      minLength: 1
      maxLength: 50
      example: merch-001
    Country:
      type: string
      format: iso-3166-alpha-2
      minLength: 2
      maxLength: 2
      description: The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2).
      example: DE
    Intraorganizational:
      type: boolean
      description: Indicates whether the account belongs to the requestor's organization.
    CapabilityName:
      type: string
      description: Account capability name.
      enum:
        - manage_resources
        - issue_invoices
        - receive_invoices
      example: manage_resources
    CapabilityStatus:
      type: string
      description: The state of the verification.
      enum:
        - information_due
        - verifying
        - active
        - inactive
      example: information_due
    DateTime:
      type: string
      format: date-time
      minLength: 24
      maxLength: 24
      example: '2023-09-01T22:05:48.479Z'
    LabelId:
      allOf:
        - $ref: '#/components/schemas/Id'
        - description: The unique identifier of the label.
          example: lbl_44678r08jtm8zbt227tzhc4nw5
    PaginationCursor:
      type: string
      description: The cursor to the last item.
      maxLength: 250
      example: Q3VyaW9zaXR5IEtpbGxlZCB0aGUgQ2F0Cg==
    PaginationData:
      type: array
      description: The list of items.
    EntityVersion:
      type: string
      description: The version of the entity.
      maxLength: 17
      example: '20240213150344583'
    AccountVersion:
      allOf:
        - description: The version of the account.
        - $ref: '#/components/schemas/EntityVersion'
    Capability:
      type: object
      description: An account capability.
      required:
        - enabled
      properties:
        enabled:
          type: boolean
          description: Defines whether the capability is enabled.
    CapabilityWithStatus:
      allOf:
        - $ref: '#/components/schemas/Capability'
        - required:
            - status
          properties:
            status:
              $ref: '#/components/schemas/CapabilityStatus'
    CapabilitiesWithStatus:
      type: object
      description: The statuses of the current capabilities for the account.
      properties:
        manage_resources:
          description: The status of the manage resources capability.
          $ref: '#/components/schemas/CapabilityWithStatus'
        issue_invoices:
          description: The status of the issue invoices capability.
          $ref: '#/components/schemas/CapabilityWithStatus'
        receive_invoices:
          description: The status of the receive invoices capability.
          $ref: '#/components/schemas/CapabilityWithStatus'
      example:
        manage_resources:
          enabled: true
          status: information_due
        issue_invoices:
          enabled: false
          status: inactive
        receive_invoices:
          enabled: true
          status: active
    GetCapabilityDatesResponse:
      type: object
      properties:
        from:
          $ref: '#/components/schemas/DateTime'
          description: The date of which the capability was activated.
          example: '2024-01-01T22:05:48.479Z'
        to:
          $ref: '#/components/schemas/DateTime'
          description: The date of which the capability was deactivated.
          example: '2024-10-01T22:05:48.479Z'
    ListCapabilitiesResponse:
      allOf:
        - properties:
            manage_resources:
              type: object
            issue_invoices:
              type: object
            receive_invoices:
              type: object
        - $ref: '#/components/schemas/CapabilitiesWithStatus'
        - required:
            - manage_resources
            - issue_invoices
            - receive_invoices
          properties:
            manage_resources:
              $ref: '#/components/schemas/GetCapabilityDatesResponse'
            issue_invoices:
              $ref: '#/components/schemas/GetCapabilityDatesResponse'
            receive_invoices:
              $ref: '#/components/schemas/GetCapabilityDatesResponse'
    AccountLegalName:
      type: string
      minLength: 2
      maxLength: 300
      description: The legal name of the business.
      example: Wildcat Pumps GmbH
    RegistrationNumber:
      type: string
      description: Your business registration number.
      example: '12345678'
      maxLength: 20
    ListAccountsResponse:
      type: object
      required:
        - id
        - version
        - capabilities
        - country
        - business_profile
        - intraorganizational
      properties:
        id:
          $ref: '#/components/schemas/AccountId'
        version:
          $ref: '#/components/schemas/AccountVersion'
        reference:
          description: Your reference for the account.
          $ref: '#/components/schemas/Reference'
        capabilities:
          $ref: '#/components/schemas/ListCapabilitiesResponse'
        country:
          $ref: '#/components/schemas/Country'
        business_profile:
          type: object
          description: The business profile details.
          required:
            - type
          properties:
            type:
              type: string
              description: The type of business.
            legal_name:
              $ref: '#/components/schemas/AccountLegalName'
            registration_number:
              $ref: '#/components/schemas/RegistrationNumber'
        intraorganizational:
          $ref: '#/components/schemas/Intraorganizational'
        labels:
          type: array
          description: The list of labels applied to the account.
          items:
            $ref: '#/components/schemas/LabelId'
          maxItems: 10
    PaymentInstrumentId:
      allOf:
        - $ref: '#/components/schemas/Id'
        - description: The unique identifier of the payment instrument.
          example: pai_1a6po0p7zqv1q2arfsyr9548q
    NotificationConfigurationBase:
      type: object
      required:
        - type
      description: Mechanism to notify when an invoice is created.
      properties:
        type:
          type: string
          description: |
            Type of notification.
    EmailAddress:
      type: string
      format: email
      maxLength: 320
    IssueInvoicesEmailNotificationConfig:
      allOf:
        - $ref: '#/components/schemas/NotificationConfigurationBase'
        - type: object
          properties:
            to:
              type: array
              maxItems: 10
              description: List of addresses for the primary recipients of the email. Required if the other fields are not present.
              items:
                $ref: '#/components/schemas/EmailAddress'
            cc:
              type: array
              maxItems: 10
              description: List of addresses which receive a copy of the email. Required if the other fields are not present.
              items:
                $ref: '#/components/schemas/EmailAddress'
            bcc:
              type: array
              maxItems: 10
              description: |
                List of addresses which receive a copy of the email. Required if the other fields are not present.
                Recipients in the BCC field are not visible to other recipients of the email.
              items:
                $ref: '#/components/schemas/EmailAddress'
    IssueInvoicesNotificationsConfig:
      type: array
      description: |
        Default mechanisms to notify when an invoice is created using this account as seller.
        This default configuration is used only when the `all_defaults` discriminator is configured
        on the invoice/subscription.
      maxItems: 1
      items:
        anyOf:
          - $ref: '#/components/schemas/IssueInvoicesEmailNotificationConfig'
        discriminator:
          propertyName: type
          mapping:
            email: '#/components/schemas/IssueInvoicesEmailNotificationConfig'
    CapabilityIssueInvoices:
      allOf:
        - $ref: '#/components/schemas/Capability'
        - properties:
            settings:
              type: object
              description: Settings related to the capability configuration.
              properties:
                payment_instruments:
                  type: array
                  description: Details of the payment instruments involved in invoice issuing.
                  maxItems: 100
                  uniqueItems: true
                  items:
                    type: object
                    required:
                      - id
                    properties:
                      id:
                        $ref: '#/components/schemas/PaymentInstrumentId'
                      features:
                        type: array
                        description: |
                          A list of features supported by the payment instrument within the capability.

                          For example, this can indicate whether the instrument supports invoice reconciliation or can act as a payment method for invoicing.
                        minItems: 1
                        uniqueItems: true
                        items:
                          type: string
                          enum:
                            - reconciliation
                            - payment_method
                notifications:
                  $ref: '#/components/schemas/IssueInvoicesNotificationsConfig'
    ReceiveInvoicesEmailNotificationConfig:
      allOf:
        - $ref: '#/components/schemas/NotificationConfigurationBase'
        - type: object
          required:
            - to
          properties:
            to:
              type: array
              maxItems: 10
              description: List of addresses for the primary recipients of the email.
              items:
                $ref: '#/components/schemas/EmailAddress'
            cc:
              type: array
              maxItems: 10
              description: List of addresses which receive a copy of the email.
              items:
                $ref: '#/components/schemas/EmailAddress'
            bcc:
              type: array
              maxItems: 10
              description: |
                List of addresses which receive a copy of the email.
                Recipients in the BCC field are not visible to other recipients of the email.
              items:
                $ref: '#/components/schemas/EmailAddress'
    ReceiveInvoicesNotificationsConfig:
      type: array
      description: |
        Default mechanisms to notify when an invoice is created using this account as buyer.
        This default configuration is used only when the `all_defaults` discriminator is configured
        on the invoice/subscription.
      maxItems: 1
      items:
        anyOf:
          - $ref: '#/components/schemas/ReceiveInvoicesEmailNotificationConfig'
        discriminator:
          propertyName: type
          mapping:
            email: '#/components/schemas/ReceiveInvoicesEmailNotificationConfig'
    CapabilityReceiveInvoices:
      allOf:
        - $ref: '#/components/schemas/Capability'
        - properties:
            settings:
              type: object
              description: Settings related to the capability configuration.
              properties:
                notifications:
                  $ref: '#/components/schemas/ReceiveInvoicesNotificationsConfig'
                  description: |
                    Default mechanisms to notify when an invoice is created using this account as buyer.
                    This default configuration is used only when the `all_defaults` discriminator is configured
                    on the invoice/subscription.
    Capabilities:
      type: object
      description: The available capabilities for the account.
      properties:
        manage_resources:
          description: Manage resources capability.
          $ref: '#/components/schemas/Capability'
        issue_invoices:
          description: Issue invoices capability.
          $ref: '#/components/schemas/CapabilityIssueInvoices'
        receive_invoices:
          description: Receive invoices capability.
          $ref: '#/components/schemas/CapabilityReceiveInvoices'
      example:
        manage_resources:
          enabled: true
        issue_invoices:
          enabled: false
        receive_invoices:
          enabled: true
    Address:
      type: object
      description: A complete address.
      required:
        - line_one
        - city
        - zip
      properties:
        line_one:
          type: string
          minLength: 1
          maxLength: 300
          description: Line one of the address.
          example: Oststrabe 35
        line_two:
          type: string
          maxLength: 300
          description: Line two of the address.
          example: Floor 2, Unit 2
        city:
          type: string
          minLength: 2
          maxLength: 300
          description: The city.
          example: Düsseldorf
        state:
          type: string
          maxLength: 300
          description: The state or county.
          example: North Rhine-Westphalia
        zip:
          type: string
          minLength: 1
          maxLength: 16
          description: The zip or postal code.
          example: '18187'
    BusinessProfileBase:
      type: object
      description: The business profile details.
      required:
        - type
      properties:
        type:
          type: string
          description: The type of business.
        legal_name:
          $ref: '#/components/schemas/AccountLegalName'
        trading_name:
          type: string
          minLength: 2
          maxLength: 300
          description: The operating name of your company if it's different from the `legal_name`.
        registration_number:
          $ref: '#/components/schemas/RegistrationNumber'
        registered_address:
          description: The registered address of the business.
          $ref: '#/components/schemas/Address'
        phone_number:
          type: object
          description: The business phone number.
          required:
            - country_calling_code
            - number
          properties:
            country_calling_code:
              type: string
              description: The international calling code for the country following [E.123](https://en.wikipedia.org/wiki/E.123) and [E.164](https://www.itu.int/dms_pub/itu-t/opb/sp/T-SP-E.164D-11-2011-PDF-E.pdf) standards.
              example: '+49'
            number:
              type: string
              format: string
              minLength: 3
              maxLength: 16
              description: The phone number. This must only contain numeric characters and can't contain only zeros.
              example: '555666698'
        email:
          $ref: '#/components/schemas/EmailAddress'
          description: The business email address.
    CompanyProfile:
      allOf:
        - $ref: '#/components/schemas/BusinessProfileBase'
    BusinessProfile:
      type: object
      description: The business profile details.
      anyOf:
        - $ref: '#/components/schemas/CompanyProfile'
      discriminator:
        propertyName: type
        mapping:
          company: '#/components/schemas/CompanyProfile'
    Url:
      type: string
      format: uri
      maxLength: 1024
    AccountUrls:
      type: object
      description: URLs that are used throughout the application process.
      properties:
        webhook:
          $ref: '#/components/schemas/Url'
          description: |
            The webhook endpoint to which events for this account will be sent to.

            If omitted, webhooks will not be sent.
    AccountRequest:
      type: object
      properties:
        reference:
          description: Your reference for the account.
          $ref: '#/components/schemas/Reference'
        capabilities:
          $ref: '#/components/schemas/Capabilities'
        business_profile:
          $ref: '#/components/schemas/BusinessProfile'
        intraorganizational:
          $ref: '#/components/schemas/Intraorganizational'
        metadata:
          type: object
          description: Some data to provide context for the account. Keys with a length greater than 100 characters are not supported.
          maxProperties: 5
          additionalProperties:
            type: string
            maxLength: 250
          example:
            type: buyer
        urls:
          $ref: '#/components/schemas/AccountUrls'
        labels:
          type: array
          description: |
            The list of labels to apply to the account.
          items:
            $ref: '#/components/schemas/LabelId'
          maxItems: 10
    CreateCompanyProfile:
      allOf:
        - type: object
          required:
            - legal_name
        - $ref: '#/components/schemas/CompanyProfile'
    CreateBusinessProfile:
      type: object
      description: The business profile details.
      anyOf:
        - $ref: '#/components/schemas/CreateCompanyProfile'
      discriminator:
        propertyName: type
        mapping:
          company: '#/components/schemas/CreateCompanyProfile'
    CreateAccountRequest:
      allOf:
        - properties:
            reference:
              type: string
            capabilities:
              type: object
            country:
              type: string
        - $ref: '#/components/schemas/AccountRequest'
        - required:
            - capabilities
            - country
            - business_profile
          properties:
            country:
              $ref: '#/components/schemas/Country'
            business_profile:
              $ref: '#/components/schemas/CreateBusinessProfile'
    CapabilityRequirement:
      type: object
      required:
        - reason
      properties:
        reason:
          type: string
          description: The reason for the requirement.
          example: required
          maxLength: 250
    CapabilitiesRequirements:
      type: object
      description: The requirements requested by the enabled capabilities.
      properties:
        manage_resources:
          description: The requirement of the manage resources capability.
          $ref: '#/components/schemas/CapabilityRequirement'
        issue_invoices:
          description: The requirement of the issue invoices capability.
          $ref: '#/components/schemas/CapabilityRequirement'
        receive_invoices:
          description: The requirement of the receive invoices capability.
          $ref: '#/components/schemas/CapabilityRequirement'
      example:
        receive_invoices:
          reason: required
    RequirementsDue:
      type: array
      description: |
        The requirements that are currently due for the account. These are
        requirements that need to be satisfied before a capability can be
        fully activated.
      minItems: 0
      uniqueItems: true
      items:
        type: object
        required:
          - field
          - requested_by
        properties:
          field:
            type: string
            description: The path to the field with a requirement due.
            maxLength: 150
            example: business_profile.registration_number
          requested_by:
            $ref: '#/components/schemas/CapabilitiesRequirements'
    CreateAccountResponse:
      type: object
      required:
        - id
        - version
        - capabilities
        - requirements_due
      properties:
        id:
          $ref: '#/components/schemas/AccountId'
        capabilities:
          $ref: '#/components/schemas/CapabilitiesWithStatus'
        requirements_due:
          $ref: '#/components/schemas/RequirementsDue'
        version:
          $ref: '#/components/schemas/AccountVersion'
    GetAccountResponse:
      allOf:
        - properties:
            id:
              type: string
            version:
              type: string
            reference:
              type: string
            capabilities:
              type: object
              properties:
                manage_resources:
                  type: object
                issue_invoices:
                  type: object
                  properties:
                    enabled:
                      type: boolean
                    status:
                      type: string
                    from:
                      type: string
                    to:
                      type: string
                receive_invoices:
                  type: object
                  properties:
                    enabled:
                      type: boolean
                    status:
                      type: string
                    from:
                      type: string
                    to:
                      type: string
            country:
              type: string
            business_profile:
              type: object
            intraorganizational:
              type: boolean
            metadata:
              type: object
            requirements_due:
              type: array
            urls:
              type: object
        - $ref: '#/components/schemas/CreateAccountRequest'
        - $ref: '#/components/schemas/CreateAccountResponse'
        - properties:
            capabilities:
              allOf:
                - $ref: '#/components/schemas/ListCapabilitiesResponse'
                - $ref: '#/components/schemas/Capabilities'
            requirements_due:
              $ref: '#/components/schemas/RequirementsDue'
    TaxBase:
      type: object
      description: The tax applied to the line.
      required:
        - type
        - reference
      properties:
        type:
          type: string
          description: |
            The type of tax.
             * `percentage` - A tax defined as a percentage of the line amount.
             * `exempt` - A tax that is exempted from the line amount.
          enum:
            - percentage
            - exempt
        reference:
          type: string
          description: Your reference for the tax.
          minLength: 1
          maxLength: 50
          example: iva
        name:
          type: string
          description: Localized name to display to the user. If it is not present, `reference` is used.
          maxLength: 100
          example: IVA
    PercentageTax:
      allOf:
        - $ref: '#/components/schemas/TaxBase'
        - description: Tax defined as an amount percentage.
          required:
            - percent
          properties:
            percent:
              type: number
              format: double
              description: Percentage amount to apply.
              minimum: 0
              maximum: 100
              example: 21
    ExemptTax:
      allOf:
        - $ref: '#/components/schemas/TaxBase'
        - description: Tax defined as an exemption.
    GetTaxesResponse:
      type: object
      required:
        - data
      properties:
        data:
          type: array
          description: The taxes related to the account.
          items:
            anyOf:
              - $ref: '#/components/schemas/PercentageTax'
              - $ref: '#/components/schemas/ExemptTax'
            discriminator:
              propertyName: type
              mapping:
                percentage: '#/components/schemas/PercentageTax'
                exempt: '#/components/schemas/ExemptTax'
    BankAccountConsentPermissions:
      type: array
      description: The features for which the user provided consent when requested access to their account information.
      minItems: 1
      uniqueItems: true
      items:
        type: string
        enum:
          - read_transactions
    CreateBankAccountAuthorizationRequest:
      type: object
      required:
        - payment_instruments
      properties:
        payment_instruments:
          type: array
          description: List of payment instruments to get the bank account authorization with its account unique identifier.
          minItems: 1
          uniqueItems: true
          items:
            type: object
            required:
              - account_id
              - ids
            properties:
              account_id:
                $ref: '#/components/schemas/AccountId'
              ids:
                type: array
                description: List of payment instruments unique identifiers.
                items:
                  $ref: '#/components/schemas/PaymentInstrumentId'
        permissions:
          description: |
            It is used to precisely define the features for which the user will provide consent when requesting access to their account information.

            If omitted, all scopes are set.
          $ref: '#/components/schemas/BankAccountConsentPermissions'
    CreateBankAccountAuthorizationResponseNextStep:
      allOf:
        - properties:
            id:
              type: string
            status:
              type: string
            next_step:
              type: object
        - $ref: '#/components/schemas/CreateBankAccountAuthorizationResponseBase'
        - required:
            - next_step
          properties:
            next_step:
              anyOf:
                - $ref: '#/components/schemas/BankAccountAuthorizationNextStepConfigureRedirect'
                - $ref: '#/components/schemas/BankAccountAuthorizationNextStepPassCredentials'
              discriminator:
                propertyName: type
                mapping:
                  configure_redirect: '#/components/schemas/BankAccountAuthorizationNextStepConfigureRedirect'
                  pass_credentials: '#/components/schemas/BankAccountAuthorizationNextStepPassCredentials'
    CreateBankAccountAuthorizationResponseFailed:
      allOf:
        - properties:
            id:
              type: string
            status:
              type: string
            reason:
              type: string
              description: The reason for the fail.
              example: Internal error.
              maxLength: 250
        - $ref: '#/components/schemas/CreateBankAccountAuthorizationResponseBase'
    BankAccountAuthorizationId:
      allOf:
        - $ref: '#/components/schemas/Id'
        - description: The unique identifier of the bank account authorization.
          example: baa_6f98522fe59341108bb967fa4f
    BankAccountAuthorizationStatus:
      type: string
      description: The bank account authorization status.
      enum:
        - completed
        - next_step_required
        - awaiting
        - rejected
        - failed
    CreateBankAccountAuthorizationResponseBase:
      type: object
      required:
        - id
        - status
      properties:
        id:
          $ref: '#/components/schemas/BankAccountAuthorizationId'
        status:
          $ref: '#/components/schemas/BankAccountAuthorizationStatus'
    BaseNextStep:
      type: object
      description: Next action to perform to complete the operation.
      required:
        - type
      properties:
        type:
          type: string
          description: Type of action to perform in the next step.
          example: redirect
    BankAccountAuthorizationNextStepConfigureRedirect:
      allOf:
        - properties:
            type:
              const: configure_redirect
              example: configure_redirect
        - $ref: '#/components/schemas/BaseNextStep'
    BankAccountAuthorizationNextStepPassCredentials:
      allOf:
        - properties:
            type:
              const: pass_credentials
              example: pass_credentials
        - $ref: '#/components/schemas/BaseNextStep'
    CreateBankAccountAuthorizationResponse:
      anyOf:
        - $ref: '#/components/schemas/CreateBankAccountAuthorizationResponseNextStep'
        - $ref: '#/components/schemas/CreateBankAccountAuthorizationResponseFailed'
      discriminator:
        propertyName: status
        mapping:
          next_step_required: '#/components/schemas/CreateBankAccountAuthorizationResponseNextStep'
          failed: '#/components/schemas/CreateBankAccountAuthorizationResponseFailed'
    GetBankAccountAuthorizationResponseAwaiting:
      allOf:
        - properties:
            id:
              type: string
            status:
              type: string
            payment_instruments:
              type: array
        - $ref: '#/components/schemas/CreateBankAccountAuthorizationResponseBase'
        - $ref: '#/components/schemas/GetBankAccountAuthorizationResponsePaymentInstruments'
    GetBankAccountAuthorizationResponseCompleted:
      allOf:
        - required:
            - consent
          properties:
            id:
              type: string
            status:
              type: string
            payment_instruments:
              type: array
            consent:
              $ref: '#/components/schemas/BankAccountConsent'
        - $ref: '#/components/schemas/CreateBankAccountAuthorizationResponseBase'
        - $ref: '#/components/schemas/GetBankAccountAuthorizationResponsePaymentInstruments'
    GetBankAccountAuthorizationResponseNextStep:
      allOf:
        - properties:
            id:
              type: string
            status:
              type: string
            payment_instruments:
              type: array
            next_step:
              type: object
        - $ref: '#/components/schemas/CreateBankAccountAuthorizationResponseBase'
        - $ref: '#/components/schemas/GetBankAccountAuthorizationResponsePaymentInstruments'
        - required:
            - next_step
          properties:
            next_step:
              allOf:
                - $ref: '#/components/schemas/Redirect'
                - $ref: '#/components/schemas/BankAccountAuthorizationNextStepConfigureRedirect'
                - $ref: '#/components/schemas/BankAccountAuthorizationNextStepPassCredentials'
                - $ref: '#/components/schemas/BankAccountAuthorizationNextStepPassScaCode'
                - $ref: '#/components/schemas/BankAccountAuthorizationNextStepSelectScaMethod'
                - $ref: '#/components/schemas/BankAccountAuthorizationNextStepPoll'
              discriminator:
                propertyName: type
                mapping:
                  redirect: '#/components/schemas/Redirect'
                  configure_redirect: '#/components/schemas/BankAccountAuthorizationNextStepConfigureRedirect'
                  pass_credentials: '#/components/schemas/BankAccountAuthorizationNextStepPassCredentials'
                  pass_sca_code: '#/components/schemas/BankAccountAuthorizationNextStepPassScaCode'
                  select_sca_method: '#/components/schemas/BankAccountAuthorizationNextStepSelectScaMethod'
                  poll: '#/components/schemas/BankAccountAuthorizationNextStepPoll'
    GetBankAccountAuthorizationResponseRejected:
      allOf:
        - properties:
            id:
              type: string
            status:
              type: string
            payment_instruments:
              type: array
            reason:
              type: string
              description: The reason for the fail.
              example: Internal error.
              maxLength: 250
        - $ref: '#/components/schemas/CreateBankAccountAuthorizationResponseBase'
        - $ref: '#/components/schemas/GetBankAccountAuthorizationResponsePaymentInstruments'
    GetBankAccountAuthorizationResponseFailed:
      allOf:
        - properties:
            id:
              type: string
            status:
              type: string
            payment_instruments:
              type: array
            reason:
              type: string
              description: The reason for the fail.
              example: Internal error.
              maxLength: 250
        - $ref: '#/components/schemas/CreateBankAccountAuthorizationResponseBase'
        - $ref: '#/components/schemas/GetBankAccountAuthorizationResponsePaymentInstruments'
    GetBankAccountAuthorizationResponsePaymentInstruments:
      type: object
      required:
        - payment_instruments
      properties:
        payment_instruments:
          type: array
          description: List of payment instruments to get the bank account authorization with its account unique identifier.
          items:
            type: object
            required:
              - account_id
              - ids
            properties:
              account_id:
                $ref: '#/components/schemas/AccountId'
              ids:
                type: array
                description: List of payment instruments to get the bank account authorization.
                items:
                  type: object
                  required:
                    - id
                    - status
                  properties:
                    id:
                      $ref: '#/components/schemas/PaymentInstrumentId'
                    status:
                      type: string
                      example: authorized
                      description: |
                        The authorization status for the payment instrument.

                        * `pending` - The payment instrument is pending to be authorized.
                        * `authorized` - The payment instrument is authorized.
                        * `unauthorized` - The payment instrument is not authorized.
                      enum:
                        - pending
                        - authorized
                        - unauthorized
    BankAccountConsentId:
      allOf:
        - $ref: '#/components/schemas/Id'
        - description: The unique identifier of the bank account consent.
          example: tok_6f98522fe59341108bb967fa4f
    BankAccountConsent:
      type: object
      description: |
        The consent given by a user to access their bank account information.

        This consent allows the system to perform operations on behalf of the user, such as viewing transaction history or account balances, within the permissions specified.
      required:
        - id
        - updated_at
        - expires_at
        - renewal_at
        - permissions
      properties:
        id:
          $ref: '#/components/schemas/BankAccountConsentId'
        updated_at:
          $ref: '#/components/schemas/DateTime'
          description: The timestamp indicating when the feature was last updated.
        expires_at:
          $ref: '#/components/schemas/DateTime'
          description: |
            The timestamp indicating when the feature is set to expire.

            This date signifies when the feature will no longer be active unless renewed.
        renewal_at:
          $ref: '#/components/schemas/DateTime'
          description: |
            The timestamp indicating when the feature is scheduled for renewal.

            This date signifies when the feature's status and configuration will be reviewed and potentially extended.
        permissions:
          $ref: '#/components/schemas/BankAccountConsentPermissions'
    Redirect:
      allOf:
        - required:
            - href
            - method
          properties:
            type:
              example: redirect
            href:
              type: string
              description: The link URL.
              maxLength: 50
              example: authenticate
            method:
              type: string
              description: The HTTP method to use for the redirection.
              enum:
                - GET
                - POST
              example: POST
            params:
              type: array
              description: The list of fields to pass in the body to the redirection when `method` is `POST`.
              items:
                type: object
                required:
                  - name
                  - value
                properties:
                  name:
                    type: string
                    description: The name of the field to pass in the body to the redirection.
                    example: amount
                  value:
                    type: string
                    description: The value of the field to pass in the body to the redirection.
                    example: '10000'
        - $ref: '#/components/schemas/BaseNextStep'
    ScaMethod:
      type: object
      description: The selected SCA methods by the user to authenticate.
      required:
        - code
        - type
      properties:
        code:
          type: string
          description: The code of the SCA method provided by the bank.
          example: 942
        type:
          type: string
          description: The list of SCA methods available for the user to authenticate.
          enum:
            - sms
            - push
            - chip
          example: push
        description:
          type: string
          description: The description of the SCA method.
          example: SecureGo
        information:
          type: string
          description: Additional information from the institution to assist the PSU with the selected SCA method. The language is set by the institution and may differ.
          example: Please confirm the process in your SecureGo app
    BankAccountAuthorizationNextStepPassScaCode:
      allOf:
        - required:
            - selected_sca_method
          properties:
            type:
              const: pass_sca_code
              example: pass_sca_code
            selected_sca_method:
              $ref: '#/components/schemas/ScaMethod'
        - $ref: '#/components/schemas/BaseNextStep'
    BankAccountAuthorizationNextStepSelectScaMethod:
      allOf:
        - required:
            - sca_methods
          properties:
            type:
              const: select_sca_method
              example: select_sca_method
            sca_methods:
              type: array
              description: The list of SCA methods available for the user to authenticate.
              items:
                $ref: '#/components/schemas/ScaMethod'
        - $ref: '#/components/schemas/BaseNextStep'
    BankAccountAuthorizationNextStepPoll:
      allOf:
        - properties:
            type:
              const: poll
              example: poll
            selected_sca_method:
              $ref: '#/components/schemas/ScaMethod'
        - $ref: '#/components/schemas/BaseNextStep'
    GetBankAccountAuthorizationResponse:
      anyOf:
        - $ref: '#/components/schemas/GetBankAccountAuthorizationResponseAwaiting'
        - $ref: '#/components/schemas/GetBankAccountAuthorizationResponseCompleted'
        - $ref: '#/components/schemas/GetBankAccountAuthorizationResponseNextStep'
        - $ref: '#/components/schemas/GetBankAccountAuthorizationResponseRejected'
        - $ref: '#/components/schemas/GetBankAccountAuthorizationResponseFailed'
      discriminator:
        propertyName: status
        mapping:
          awaiting: '#/components/schemas/GetBankAccountAuthorizationResponseAwaiting'
          completed: '#/components/schemas/GetBankAccountAuthorizationResponseCompleted'
          next_step_required: '#/components/schemas/GetBankAccountAuthorizationResponseNextStep'
          rejected: '#/components/schemas/GetBankAccountAuthorizationResponseRejected'
          failed: '#/components/schemas/GetBankAccountAuthorizationResponseFailed'
    RevokeBankAccountAuthorizationResponse:
      type: object
      required:
        - id
        - payment_instruments
      properties:
        id:
          $ref: '#/components/schemas/BankAccountAuthorizationId'
        payment_instruments:
          type: array
          description: List of payment instruments to get the bank account authorization with its account unique identifier.
          items:
            type: object
            required:
              - account_id
              - ids
            properties:
              account_id:
                $ref: '#/components/schemas/AccountId'
              ids:
                type: array
                description: List of payment instruments to get the bank account authorization.
                items:
                  type: object
                  required:
                    - id
                    - status
                  properties:
                    id:
                      $ref: '#/components/schemas/PaymentInstrumentId'
                    status:
                      type: string
                      const: unauthorized
                      description: The payment instrument is not authorized.
    ConfigureRedirectBankAccountAuthorizationRequest:
      type: object
      required:
        - urls
      properties:
        urls:
          type: object
          description: URLs that are used throughout the bank account authorization process.
          required:
            - redirect
          properties:
            redirect:
              $ref: '#/components/schemas/Url'
              description: |
                Redirection URL once the bank account authorization is completed.
    ConfigureRedirectBankAccountAuthorizationResponseNextStep:
      allOf:
        - required:
            - next_step
          properties:
            id:
              type: string
            status:
              type: string
            next_step:
              $ref: '#/components/schemas/Redirect'
        - $ref: '#/components/schemas/CreateBankAccountAuthorizationResponseBase'
    ConfigureRedirectBankAccountAuthorizationResponse:
      anyOf:
        - $ref: '#/components/schemas/ConfigureRedirectBankAccountAuthorizationResponseNextStep'
        - $ref: '#/components/schemas/CreateBankAccountAuthorizationResponseFailed'
      discriminator:
        propertyName: status
        mapping:
          next_step_required: '#/components/schemas/ConfigureRedirectBankAccountAuthorizationResponseNextStep'
          failed: '#/components/schemas/CreateBankAccountAuthorizationResponseFailed'
    PassCredentialsBankAccountAuthorizationRequest:
      type: object
      required:
        - username
        - password
      properties:
        username:
          type: string
          description: The username for the bank.
          maxLength: 50
          example: '6154057725'
        password:
          type: string
          description: The password for the user for the bank.
          maxLength: 50
          example: PISPWD12
    PassCredentialsBankAccountAuthorizationResponseNextStep:
      allOf:
        - required:
            - next_step
          properties:
            id:
              type: string
            status:
              type: string
            next_step:
              type: object
              description: Next action to perform to complete the operation.
              anyOf:
                - $ref: '#/components/schemas/BankAccountAuthorizationNextStepSelectScaMethod'
                - $ref: '#/components/schemas/BankAccountAuthorizationNextStepPassScaCode'
                - $ref: '#/components/schemas/BankAccountAuthorizationNextStepPoll'
              discriminator:
                propertyName: type
                mapping:
                  select_sca_method: '#/components/schemas/BankAccountAuthorizationNextStepSelectScaMethod'
                  pass_sca_code: '#/components/schemas/BankAccountAuthorizationNextStepPassScaCode'
                  poll: '#/components/schemas/BankAccountAuthorizationNextStepPoll'
        - $ref: '#/components/schemas/CreateBankAccountAuthorizationResponseBase'
    PassCredentialsBankAccountAuthorizationResponse:
      anyOf:
        - $ref: '#/components/schemas/PassCredentialsBankAccountAuthorizationResponseNextStep'
        - $ref: '#/components/schemas/CreateBankAccountAuthorizationResponseFailed'
      discriminator:
        propertyName: status
        mapping:
          next_step_required: '#/components/schemas/PassCredentialsBankAccountAuthorizationResponseNextStep'
          failed: '#/components/schemas/CreateBankAccountAuthorizationResponseFailed'
    SelectScaMethodBankAccountAuthorizationRequest:
      type: object
      required:
        - sca_method_code
      properties:
        sca_method_code:
          type: string
          description: The SCA method chosen by the user for the bank. If the user has multiple SCA methods configured, the bank will allow the user to choose from these options.
          example: push
    SelectScaMethodBankAccountAuthorizationResponseNextStep:
      allOf:
        - required:
            - next_step
          properties:
            id:
              type: string
            status:
              type: string
            next_step:
              type: object
              description: Next action to perform to complete the operation.
              anyOf:
                - $ref: '#/components/schemas/BankAccountAuthorizationNextStepPassScaCode'
                - $ref: '#/components/schemas/BankAccountAuthorizationNextStepPoll'
              discriminator:
                propertyName: type
                mapping:
                  pass_sca_code: '#/components/schemas/BankAccountAuthorizationNextStepPassScaCode'
                  poll: '#/components/schemas/BankAccountAuthorizationNextStepPoll'
        - $ref: '#/components/schemas/CreateBankAccountAuthorizationResponseBase'
    SelectScaMethodBankAccountAuthorizationResponse:
      anyOf:
        - $ref: '#/components/schemas/SelectScaMethodBankAccountAuthorizationResponseNextStep'
        - $ref: '#/components/schemas/CreateBankAccountAuthorizationResponseFailed'
      discriminator:
        propertyName: status
        mapping:
          next_step_required: '#/components/schemas/SelectScaMethodBankAccountAuthorizationResponseNextStep'
          failed: '#/components/schemas/CreateBankAccountAuthorizationResponseFailed'
    PassScaCodeBankAccountAuthorizationRequest:
      type: object
      required:
        - sca_code
      properties:
        sca_code:
          type: string
          description: The SCA code provided by the user to authorize the bank account.
          example: '123456'
    PassScaCodeBankAccountAuthorizationResponse:
      anyOf:
        - $ref: '#/components/schemas/GetBankAccountAuthorizationResponseCompleted'
        - $ref: '#/components/schemas/CreateBankAccountAuthorizationResponseFailed'
      discriminator:
        propertyName: status
        mapping:
          completed: '#/components/schemas/GetBankAccountAuthorizationResponseCompleted'
          failed: '#/components/schemas/CreateBankAccountAuthorizationResponseFailed'
    InvoiceType:
      type: string
      description: |
        Type of invoice document subject to the requirements of the local tax regime.
        * `standard` - A regular invoice exchanged between a seller and a buyer in a commercial transaction.
        * `corrective` - A corrected invoice that completely replaces the preceding document.
      enum:
        - standard
        - corrective
      example: standard
    InvoicesSeriesId:
      allOf:
        - $ref: '#/components/schemas/Id'
        - description: The unique identifier of the invoices series.
          example: ser_4ehg1mkv3mvt3256vcn8dspb4h
    InvoicesSeriesName:
      type: string
      description: The name of the series.
      maxLength: 100
      example: Marketplace sales
    ListInvoicesSeriesResponse:
      type: object
      required:
        - data
      properties:
        data:
          description: The list of invoices series.
          type: array
          items:
            type: object
            required:
              - id
              - name
            properties:
              id:
                $ref: '#/components/schemas/InvoicesSeriesId'
              name:
                $ref: '#/components/schemas/InvoicesSeriesName'
    CreateInvoicesSeries:
      type: object
      required:
        - prefix
        - name
        - padding
        - valid_from
        - valid_to
        - type
      properties:
        name:
          $ref: '#/components/schemas/InvoicesSeriesName'
        prefix:
          type: string
          minLength: 2
          maxLength: 45
          description: The prefix of the invoice generated number.
          example: INV-2024-
        suffix:
          type: string
          maxLength: 43
          description: The suffix of the invoice generated number.
          example: MARKETPLACE
        padding:
          type: integer
          minimum: 5
          maximum: 20
          description: The number of digits to pad the invoice generated number with.
          example: 5
        valid_from:
          allOf:
            - $ref: '#/components/schemas/DateTime'
            - type: string
              description: The utc date from which the series is valid.
              example: '2024-01-01T00:00:00Z'
        valid_to:
          allOf:
            - $ref: '#/components/schemas/DateTime'
            - type: string
              description: The utc date until which the series is valid.
              example: '2024-12-31T23:59:59Z'
        type:
          type: string
          description: The type of the invoices supported by the series.
          enum:
            - standard
            - corrective
    CreateInvoicesSeriesResponse:
      type: object
      required:
        - id
      properties:
        id:
          $ref: '#/components/schemas/InvoicesSeriesId'
    InvoicesSeries:
      type: object
      required:
        - id
        - prefix
        - name
        - padding
        - valid_from
        - valid_to
        - type
      allOf:
        - type: object
          properties:
            id:
              $ref: '#/components/schemas/InvoicesSeriesId'
        - $ref: '#/components/schemas/CreateInvoicesSeries'
    GetInvoicesSeriesResponse:
      type: object
      allOf:
        - $ref: '#/components/schemas/InvoicesSeries'
    AccountLinkId:
      allOf:
        - $ref: '#/components/schemas/Id'
        - description: The unique identifier of the account link.
          example: alk_397a1eb5c87a4f14bdf0924044
    CreateAccountLinkRequest:
      type: object
      required:
        - type
        - source
        - destination
      properties:
        type:
          type: string
          description: The type of the account link.
          enum:
            - can_use
        source:
          allOf:
            - description: The unique identifier that represents the account that is the source of the relationship.
            - $ref: '#/components/schemas/AccountId'
            - example: acc_44678r08jtm8zbt227tzhc4nw4
        destination:
          allOf:
            - description: The unique identifier that represents the account that is the destination of the relationship.
            - $ref: '#/components/schemas/AccountId'
            - example: acc_4zjjxn0nm1tnweqbttedkvnsc8
    CreateAccountLinkResponse:
      type: object
      required:
        - id
      properties:
        id:
          $ref: '#/components/schemas/AccountLinkId'
    GetAccountLinkResponse:
      allOf:
        - $ref: '#/components/schemas/CreateAccountLinkRequest'
        - $ref: '#/components/schemas/CreateAccountLinkResponse'
    Pagination:
      type: object
      required:
        - data
      properties:
        cursor:
          $ref: '#/components/schemas/PaginationCursor'
        data:
          $ref: '#/components/schemas/PaginationData'
    BankTransactionId:
      allOf:
        - $ref: '#/components/schemas/Id'
        - description: The unique identifier of the bank transaction.
          example: trx_78a998dda9404e36b179b074b
    AmountMinor:
      type: number
      format: amount-minor
      description: The payment amount in the minor currency unit (e.g. 100 cents for 1 EUR).
      example: 1000
    AmountMinorOne:
      allOf:
        - $ref: '#/components/schemas/AmountMinor'
        - minimum: 1
    Currency:
      type: string
      format: iso-4217
      minLength: 3
      maxLength: 3
      description: The processing currency code according to the [ISO-4217 standard](https://en.wikipedia.org/wiki/ISO_4217)
      example: EUR
    BankAccountNumber:
      type: object
      description: The bank account.
      required:
        - type
        - value
      properties:
        type:
          type: string
          description: The type of the bank account number.
          enum:
            - iban
        value:
          type: string
          description: The bank account number.
          maxLength: 34
          example: DE75512108001245126199
    BankTransactionParty:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/AccountId'
        legal_name:
          $ref: '#/components/schemas/AccountLegalName'
        bank_account:
          type: object
          description: The bank account of the party.
          required:
            - account_number
          properties:
            id:
              $ref: '#/components/schemas/PaymentInstrumentId'
            account_number:
              $ref: '#/components/schemas/BankAccountNumber'
    BankTransactionEnrichmentStatus:
      type: string
      description: The status of the bank transaction enrichment whether the transaction has been enriched with additional information or not.
      enum:
        - enriched
        - not_enriched
      example: enriched
    BankTransactionCategoryAeb43:
      allOf:
        - $ref: '#/components/schemas/BankTransactionCategoryBase'
        - required:
            - family
            - subfamily
          properties:
            family:
              type: object
              description: The transaction type 1 to which the transaction belongs.
              required:
                - code
                - description
              properties:
                code:
                  type: string
                  minLength: 2
                  maxLength: 2
                  description: The transaction family code in AEB43 format.
                  example: '01'
                description:
                  type: string
                  description: The transaction family human-friendly description in AEB43 format.
                  example: Checks - withdrawals
            subfamily:
              type: object
              description: The transaction type 2 to which the transaction belongs.
              required:
                - code
                - description
              properties:
                code:
                  type: string
                  minLength: 3
                  maxLength: 3
                  description: The transaction subfamily code in AEB43 format.
                  example: '000'
                description:
                  type: string
                  description: The transaction subfamily human-friendly description in AEB43 format.
                  example: Cash deposit
    BankTransactionCategoryCamt053:
      allOf:
        - $ref: '#/components/schemas/BankTransactionCategoryBase'
        - required:
            - family
            - subfamily
          properties:
            family:
              type: object
              description: The family to which the transaction belongs.
              required:
                - code
                - description
              properties:
                code:
                  type: string
                  minLength: 4
                  maxLength: 4
                  description: The transaction family code in ISO 20022 camt.053 format.
                  example: CNTR
                description:
                  type: string
                  description: The transaction family human-friendly description in ISO 20022 camt.053 format.
                  example: Counter Transactions
            subfamily:
              type: object
              description: The subfamily to which the transaction belongs.
              required:
                - code
                - description
              properties:
                code:
                  type: string
                  minLength: 4
                  maxLength: 4
                  description: The transaction subfamily code in ISO 20022 camt.053 format.
                  example: BCDP
                description:
                  type: string
                  description: The transaction subfamily human-friendly description in ISO 20022 camt.053 format.
                  example: Branch Deposit
    BankTransactionCategoryBase:
      type: object
      description: The transaction category.
      required:
        - type
      properties:
        type:
          type: string
          description: The criteria to classify the transaction type, its family and subfamily.
    BankTransactionCategory:
      allOf:
        - $ref: '#/components/schemas/BankTransactionCategoryAeb43'
        - $ref: '#/components/schemas/BankTransactionCategoryCamt053'
      discriminator:
        propertyName: type
        mapping:
          aeb43: '#/components/schemas/BankTransactionCategoryAeb43'
          iso20022_camt053: '#/components/schemas/BankTransactionCategoryCamt053'
    BankTransaction:
      type: object
      required:
        - id
        - booking_at
        - amount
        - currency
        - seller
        - enrichment_status
        - direction
      properties:
        id:
          $ref: '#/components/schemas/BankTransactionId'
        booking_at:
          $ref: '#/components/schemas/DateTime'
          description: The date and time when the bank transaction was booked.
        amount:
          $ref: '#/components/schemas/AmountMinorOne'
        currency:
          $ref: '#/components/schemas/Currency'
        direction:
          description: The flow of funds relative to the transaction.
          type: string
          enum:
            - inbound
            - outbound
          example: inbound
        description:
          type: string
          example: TRX88430
          description: The description for the bank transaction.
        description_extended:
          type: string
          example: Transfer from John Doe
          description: The extended description for the bank transaction.
        seller:
          allOf:
            - description: The taxable entity receiving the funds.
              required:
                - id
                - bank_account
                - legal_name
              properties:
                id:
                  description: The seller unique identifier.
                legal_name:
                  description: The legal name of the seller.
                bank_account:
                  description: The bank account of the seller.
                  required:
                    - id
            - $ref: '#/components/schemas/BankTransactionParty'
        counterparty:
          allOf:
            - description: The entity making the payment.
              properties:
                id:
                  description: The counterparty unique identifier if identified.
                legal_name:
                  description: The legal name of the counterparty.
                bank_account:
                  description: The bank account of the counterparty.
                  properties:
                    id:
                      description: The unique identifier of the payment instrument if identified.
                    account_number:
                      type: object
            - $ref: '#/components/schemas/BankTransactionParty'
        enrichment_status:
          $ref: '#/components/schemas/BankTransactionEnrichmentStatus'
        category:
          $ref: '#/components/schemas/BankTransactionCategory'
    UploadBankTransactionsDocumentRequest:
      type: object
      required:
        - file
      properties:
        file:
          type: string
          format: binary
          description: |
            The file to upload. The maximum file size is 2MB.

            It must include the headers:

            * `Content-Disposition`: with the `filename` of the document. `filename` maximum length is 100 characters.
    DocumentId:
      allOf:
        - $ref: '#/components/schemas/Id'
        - description: The unique identifier of the document.
          example: doc_4wt0wrfqwz0vkatave0fkjg046
    UploadBankTransactionsDocumentResponse:
      type: object
      required:
        - id
      properties:
        id:
          $ref: '#/components/schemas/DocumentId'
    GetBankTransactionsImportPendingResponse:
      allOf:
        - $ref: '#/components/schemas/GetBankTransactionsImportBaseResponse'
    GetBankTransactionsImportValidatedResponse:
      type: object
      required:
        - id
        - status
        - document
      properties:
        id:
          $ref: '#/components/schemas/DocumentId'
        status:
          $ref: '#/components/schemas/ImportStatus'
        document:
          $ref: '#/components/schemas/BankTransactionsValidDocument'
    GetBankTransactionsImportCompletedResponse:
      type: object
      required:
        - id
        - status
        - summary
        - document
      properties:
        id:
          $ref: '#/components/schemas/DocumentId'
        status:
          $ref: '#/components/schemas/ImportStatus'
        summary:
          $ref: '#/components/schemas/BankTransactionImportSummary'
        document:
          $ref: '#/components/schemas/BankTransactionsValidDocument'
    GetBankTransactionsImportErrorResponse:
      allOf:
        - required:
            - reason
          properties:
            id:
              type: string
            status:
              type: string
            reason:
              $ref: '#/components/schemas/BankTransactionsImportErrorReason'
            document:
              $ref: '#/components/schemas/BankTransactionsErrorDocument'
        - $ref: '#/components/schemas/GetBankTransactionsImportBaseResponse'
    ImportStatus:
      type: string
      description: The status of the export job.
      enum:
        - pending
        - validated
        - completed
        - error
    BankTransactionsBaseDocument:
      type: object
      description: The uploaded document to extract the bank transactions.
      required:
        - id
        - name
        - uploaded_at
      properties:
        id:
          $ref: '#/components/schemas/DocumentId'
        name:
          type: string
          description: The name of the uploaded document.
          maxLength: 100
          example: AEB43_20240802.csv
        uploaded_at:
          type: string
          format: date-time
          description: The date and time the document was uploaded.
          example: '2024-08-06T17:24:32.563Z'
    GetBankTransactionsImportBaseResponse:
      type: object
      required:
        - id
        - status
        - document
      properties:
        id:
          $ref: '#/components/schemas/DocumentId'
        status:
          $ref: '#/components/schemas/ImportStatus'
        document:
          $ref: '#/components/schemas/BankTransactionsBaseDocument'
    BankTransactionsDocumentFormat:
      type: string
      description: The format of the bank transactions file. See the [supported file formats](#tag/Bank-Transactions-Enrichment/File-Formats) for further details.
      example: aeb43
    BankTransactionsDocumentDate:
      type: string
      format: date
      description: The date of the transactions included in the document.
      example: '2024-08-02'
    BankTransactionsValidDocument:
      allOf:
        - $ref: '#/components/schemas/BankTransactionsBaseDocument'
        - required:
            - format
            - transactions_date
          properties:
            format:
              $ref: '#/components/schemas/BankTransactionsDocumentFormat'
            transactions_date:
              $ref: '#/components/schemas/BankTransactionsDocumentDate'
    BankTransactionImportMatched:
      type: integer
      description: The number of transactions that were matched to existing transactions.
      minimum: 0
      example: 95
    BankTransactionImportUnmatched:
      type: integer
      description: The number of transactions that were not matched to existing transactions.
      minimum: 0
      example: 5
    BankTransactionImportTotal:
      type: integer
      description: The total number of transactions in the document.
      minimum: 0
      example: 100
    BankTransactionImportSummary:
      type: object
      description: The result of the bank transactions processed.
      required:
        - matched
        - unmatched
        - total
      properties:
        matched:
          $ref: '#/components/schemas/BankTransactionImportMatched'
        unmatched:
          $ref: '#/components/schemas/BankTransactionImportUnmatched'
        total:
          $ref: '#/components/schemas/BankTransactionImportTotal'
    Reason:
      type: object
      description: A detailed reason for the status.
      required:
        - code
        - description
      properties:
        code:
          type: string
          description: Unique identifier of the status reason.
          maxLength: 50
        description:
          type: string
          description: A human-readable description of the reason code.
          maxLength: 250
    BankTransactionsImportErrorReason:
      allOf:
        - properties:
            code:
              description: Unique identifier of the status reason. See the possible [reason codes per status](#tag/Bank-Transactions-Enrichment/Status-Reasons) for further details.
              example: file_integrity_failed
            description:
              example: The bank transactions file is not in the correct format.
        - $ref: '#/components/schemas/Reason'
    BankTransactionsErrorDocument:
      allOf:
        - $ref: '#/components/schemas/BankTransactionsBaseDocument'
        - properties:
            format:
              $ref: '#/components/schemas/BankTransactionsDocumentFormat'
            transactions_date:
              $ref: '#/components/schemas/BankTransactionsDocumentDate'
    GetBankTransactionsImportResponse:
      anyOf:
        - $ref: '#/components/schemas/GetBankTransactionsImportPendingResponse'
        - $ref: '#/components/schemas/GetBankTransactionsImportValidatedResponse'
        - $ref: '#/components/schemas/GetBankTransactionsImportCompletedResponse'
        - $ref: '#/components/schemas/GetBankTransactionsImportErrorResponse'
      discriminator:
        propertyName: status
        mapping:
          pending: '#/components/schemas/GetBankTransactionsImportPendingResponse'
          validated: '#/components/schemas/GetBankTransactionsImportValidatedResponse'
          completed: '#/components/schemas/GetBankTransactionsImportCompletedResponse'
          error: '#/components/schemas/GetBankTransactionsImportErrorResponse'
    GetBankTransactionsImportsResponse:
      allOf:
        - $ref: '#/components/schemas/Pagination'
        - properties:
            data:
              items:
                $ref: '#/components/schemas/GetBankTransactionsImportResponse'
    ImportBankTransactionsDocumentRequest:
      type: object
      required:
        - document
      properties:
        document:
          type: object
          description: The uploaded document to import.
          required:
            - id
          properties:
            id:
              $ref: '#/components/schemas/DocumentId'
              description: |
                The unique identifier of the document to import.

                It must be uploaded before importing using the [Upload Bank Transactions File](#tag/Bank-Transactions-Enrichment/operation/upload_bank_transactions_document) endpoint.
            format:
              $ref: '#/components/schemas/BankTransactionsDocumentFormat'
              description: |
                The format of the bank transactions file. See the [supported file formats](#tag/Bank-Transactions-Enrichment/File-Formats) for further details.

                If not provided, the format will be inferred from the file extension and structure.
        payment_instruments:
          type: array
          description: |
            By default, payment instruments are not required as they are auto-detected.

            However, if the same IBAN is used for multiple payment instruments, they must be provided to uniquely identify the account.
          maxItems: 1
          uniqueItems: true
          items:
            type: object
            required:
              - account_id
              - id
            properties:
              account_id:
                $ref: '#/components/schemas/AccountId'
              id:
                $ref: '#/components/schemas/PaymentInstrumentId'
        urls:
          type: object
          description: URLs that are used throughout the import bank transactions process.
          properties:
            webhook:
              $ref: '#/components/schemas/Url'
              description: |
                The webhook endpoint to which events for this import bank transactions process will be sent to.

                If omitted, webhooks will not be sent.
    BankTransactionsImportId:
      allOf:
        - $ref: '#/components/schemas/Id'
        - description: The unique identifier of the bank transactions import job.
          example: bti_4ehg1mkv3mvt3256vcn8dspb4h
    ImportBankTransactionsDocumentResponse:
      type: object
      required:
        - id
        - status
        - document
      properties:
        id:
          $ref: '#/components/schemas/BankTransactionsImportId'
          description: The unique identifier of the import job. This is used to track the progress.
        status:
          $ref: '#/components/schemas/ImportStatus'
          const: pending
        document:
          $ref: '#/components/schemas/BankTransactionsBaseDocument'
    InvoiceReference:
      allOf:
        - $ref: '#/components/schemas/Reference'
        - description: Your reference for the invoice. This is a unique identifier for the invoice provided by you. It can be used to reference the invoice in your system. We will include this value in all invoice related webhooks.
          example: 634533f5-1050-4f30-b2a1-4aab2401a78b
    InvoiceCode:
      type: string
      description: The code of the invoice. It can be provided by you during creation or generated by us based on the selected series.
      example: INV-2024-0001
    IssuedAt:
      allOf:
        - $ref: '#/components/schemas/DateTime'
        - description: The date when the invoice was issued.
    InvoiceStatus:
      type: string
      description: The [status](#tag/Invoices/Statuses) of the invoice.
      enum:
        - draft
        - cancelled
        - issued
    SubscriptionId:
      allOf:
        - $ref: '#/components/schemas/Id'
        - description: The unique identifier of the subscription.
          example: sub_4mk9y6c2v46953j37qkc0vranw
    GetStandardInvoicesResponse:
      allOf:
        - $ref: '#/components/schemas/GetInvoicesBaseResponse'
        - type: object
          required:
            - has_subsequents
          properties:
            subscription:
              $ref: '#/components/schemas/Subscription'
            has_subsequents:
              type: boolean
              description: A value indicating whether this invoice has subsequent invoices.
    GetCorrectiveInvoicesResponse:
      allOf:
        - $ref: '#/components/schemas/GetInvoicesBaseResponse'
    InvoiceId:
      type: string
      description: The unique identifier of the invoice.
      example: inv_4ehg1mkv3mvt3256vcn8dspb4h
      minLength: 30
      maxLength: 50
    AccountRef:
      type: object
      required:
        - id
        - legal_name
        - version
      properties:
        id:
          example: acc_4b5zswqg8kshx9zxdxa5g5c4wm
          $ref: '#/components/schemas/AccountId'
        version:
          $ref: '#/components/schemas/AccountVersion'
        legal_name:
          type: string
          minLength: 2
          maxLength: 300
          description: The operating name of your company.
    AmountMinorZero:
      allOf:
        - $ref: '#/components/schemas/AmountMinor'
        - minimum: 0
    GetInvoicesInvoicesSeries:
      type: object
      description: The invoices series details.
      required:
        - name
        - prefix
      properties:
        name:
          $ref: '#/components/schemas/InvoicesSeriesName'
        prefix:
          type: string
          minLength: 2
          maxLength: 45
          description: The prefix of the invoice generated number.
          example: INV-2024-
        suffix:
          type: string
          maxLength: 43
          description: The suffix of the invoice generated number.
          example: MARKETPLACE
    GetInvoiceDocument:
      allOf:
        - properties:
            type:
              description: Document that will be generated using the data in the request.
            name:
              description: The name of the generated invoice document.
              example: INV-20240119-0001.pdf
            format:
              $ref: '#/components/schemas/InvoiceDocumentFormat'
        - $ref: '#/components/schemas/GetInvoiceDocumentBase'
    GetInvoiceAttachmentDocument:
      allOf:
        - properties:
            type:
              description: Attach a file to the invoice. The file must be previously uploaded using the [Upload Invoice Document](#tag/Invoice-Documents/operation/upload_invoice_document) endpoint.
            name:
              description: The name of the attached document related to the invoice.
              example: 2024-00736.xlsx
            format:
              type: string
              description: The format of the attached document related to the invoice.
              enum:
                - csv
                - doc
                - docx
                - jpeg
                - md
                - pdf
                - png
                - svg
                - tsv
                - txt
                - xls
                - xlsx
              example: xls
        - $ref: '#/components/schemas/GetInvoiceDocumentBase'
    InvoiceDocumentFormat:
      type: string
      description: The format of the document to generate.
      enum:
        - pdf
    InvoiceDocumentType:
      type: string
      description: The type of the invoice document.
      enum:
        - invoice
        - invoice_attachment
      example: invoice
    GetInvoiceDocumentBase:
      type: object
      required:
        - type
        - id
        - name
        - format
      properties:
        type:
          $ref: '#/components/schemas/InvoiceDocumentType'
          default: invoice
        id:
          $ref: '#/components/schemas/DocumentId'
        name:
          type: string
          maxLength: 100
        format:
          type: string
    GetInvoiceDocuments:
      type: array
      description: The documents associated to the invoice. It can contain both the document automatically generated from the invoice data or the attachments uploaded using the [Upload Invoice Document](#tag/Invoice-Documents/operation/upload_invoice_document) endpoint.
      uniqueItems: true
      items:
        anyOf:
          - $ref: '#/components/schemas/GetInvoiceDocument'
          - $ref: '#/components/schemas/GetInvoiceAttachmentDocument'
        discriminator:
          propertyName: type
          mapping:
            invoice: '#/components/schemas/GetInvoiceDocument'
            invoice_attachment: '#/components/schemas/GetInvoiceAttachmentDocument'
    InvoiceBaseResponse:
      type: object
      required:
        - id
        - type
        - status
        - code
        - issued_at
        - due_at
        - currency
      properties:
        id:
          $ref: '#/components/schemas/InvoiceId'
        type:
          $ref: '#/components/schemas/InvoiceType'
        reference:
          $ref: '#/components/schemas/InvoiceReference'
        code:
          $ref: '#/components/schemas/InvoiceCode'
        issued_at:
          $ref: '#/components/schemas/IssuedAt'
        due_at:
          $ref: '#/components/schemas/DateTime'
          description: The date when the invoice has to be paid.
        currency:
          $ref: '#/components/schemas/Currency'
        documents:
          $ref: '#/components/schemas/GetInvoiceDocuments'
    GetInvoicesBaseResponse:
      allOf:
        - type: object
          required:
            - id
            - code
            - seller
            - buyer
            - totals
            - has_payment_advices
          properties:
            id:
              $ref: '#/components/schemas/InvoiceId'
            type:
              type: string
            status:
              $ref: '#/components/schemas/InvoiceStatus'
            reference:
              type: string
            code:
              $ref: '#/components/schemas/InvoiceCode'
            seller:
              $ref: '#/components/schemas/AccountRef'
            buyer:
              $ref: '#/components/schemas/AccountRef'
            issued_at:
              type: string
            due_at:
              type: string
            currency:
              type: string
            documents:
              type: array
            totals:
              type: object
              description: Summary of all the invoice totals, including taxes (calculated).
              required:
                - base
                - total
              properties:
                tax:
                  $ref: '#/components/schemas/AmountMinor'
                  description: Total amount of tax to apply to the invoice.
                base:
                  $ref: '#/components/schemas/AmountMinor'
                  description: Sum of all line sums minus the discounts, plus the charges, without tax.
                total:
                  $ref: '#/components/schemas/AmountMinorZero'
                  description: Grand total after all taxes have been applied.
            subscription:
              type: object
            series:
              $ref: '#/components/schemas/GetInvoicesInvoicesSeries'
            has_payment_advices:
              type: boolean
              description: A value indicating whether this invoice has payment advices linked or not.
        - $ref: '#/components/schemas/InvoiceBaseResponse'
    SubscriptionVersion:
      type: string
      description: The version of the subscription.
      maxLength: 17
      example: '20240213150344583'
    SubscriptionName:
      type: string
      description: The name of the subscription, used for descriptive purposes.
      maxLength: 250
    Subscription:
      type: object
      description: The subscription if the invoice was issued as part of it.
      required:
        - id
        - version
        - name
      properties:
        id:
          $ref: '#/components/schemas/SubscriptionId'
        version:
          $ref: '#/components/schemas/SubscriptionVersion'
        name:
          $ref: '#/components/schemas/SubscriptionName'
    GetInvoicesResponse:
      anyOf:
        - $ref: '#/components/schemas/GetStandardInvoicesResponse'
        - $ref: '#/components/schemas/GetCorrectiveInvoicesResponse'
      discriminator:
        propertyName: type
        mapping:
          standard: '#/components/schemas/GetStandardInvoicesResponse'
          corrective: '#/components/schemas/GetCorrectiveInvoicesResponse'
    CreateStandardInvoiceRequest:
      allOf:
        - type: object
          properties:
            type:
              type: string
            status:
              type: string
        - $ref: '#/components/schemas/UpdateStandardInvoiceRequest'
        - $ref: '#/components/schemas/CreateInvoiceBaseRequest'
    CreateCorrectiveInvoiceRequest:
      allOf:
        - type: object
          properties:
            type:
              type: string
            status:
              type: string
        - $ref: '#/components/schemas/UpdateCorrectiveInvoiceRequest'
        - $ref: '#/components/schemas/CreateInvoiceBaseRequest'
    InvoiceAccountMetadata:
      type: object
      description: |
        Any additional semi-structured information that does not fit into the rest of the account.
        This will never be displayed to end users.
      maxProperties: 5
      additionalProperties:
        type: string
        maxLength: 250
    BaseSeller:
      type: object
      description: |
        The taxable entity supplying the goods or services.

        **Note:** The related account needs to have `issue_invoices` capability activated.
      properties:
        metadata:
          $ref: '#/components/schemas/InvoiceAccountMetadata'
    StandardSeller:
      allOf:
        - type: object
          properties:
            id:
              example: acc_4b5zswqg8kshx9zxdxa5g5c4wm
              $ref: '#/components/schemas/AccountId'
        - $ref: '#/components/schemas/BaseSeller'
    UpdateStandardSeller:
      allOf:
        - type: object
          required:
            - id
        - $ref: '#/components/schemas/StandardSeller'
    NotificationType:
      type: string
      enum:
        - email
        - all_defaults
      description: |
        * `email` - Sends an email based on the configuration provided.
        * `all_defaults` - Uses the default notification settings configured both at seller level and buyer level.
      example: email
    NotificationBase:
      type: object
      required:
        - type
      description: Mechanism to notify when an invoice is created.
      properties:
        type:
          $ref: '#/components/schemas/NotificationType'
    EmailNotification:
      allOf:
        - $ref: '#/components/schemas/NotificationBase'
        - type: object
          required:
            - to
          properties:
            to:
              type: array
              maxItems: 10
              description: List of addresses for the primary recipients of the email.
              items:
                $ref: '#/components/schemas/EmailAddress'
            cc:
              type: array
              maxItems: 10
              description: List of addresses which receive a copy of the email.
              items:
                $ref: '#/components/schemas/EmailAddress'
            bcc:
              type: array
              maxItems: 10
              description: |
                List of addresses which receive a copy of the email.
                Recipients in the BCC field are not visible to other recipients of the email.
              items:
                $ref: '#/components/schemas/EmailAddress'
    NotificationAllDefaults:
      allOf:
        - $ref: '#/components/schemas/NotificationBase'
        - type: object
    InvoiceBuyerNotifications:
      type: array
      description: |
        Mechanisms to notify when an invoice is created.
        When a notification is present, it requires at least one document type in `documents` array.
      maxItems: 1
      items:
        anyOf:
          - $ref: '#/components/schemas/EmailNotification'
        discriminator:
          propertyName: type
          mapping:
            email: '#/components/schemas/EmailNotification'
            all_defaults: '#/components/schemas/NotificationAllDefaults'
    BaseBuyer:
      type: object
      description: |
        The legal entity receiving the goods or services.

        **Note:** The related account needs to have `receive_invoices` capability activated.
      properties:
        notifications:
          $ref: '#/components/schemas/InvoiceBuyerNotifications'
        metadata:
          $ref: '#/components/schemas/InvoiceAccountMetadata'
    StandardBuyer:
      allOf:
        - type: object
          properties:
            id:
              example: acc_4w5az89g1p9dy9st7qe3rgstm7
              $ref: '#/components/schemas/AccountId'
        - $ref: '#/components/schemas/BaseBuyer'
    UpdateStandardBuyer:
      allOf:
        - type: object
          required:
            - id
        - $ref: '#/components/schemas/StandardBuyer'
    InvoiceCodeRequest:
      type: object
      description: The code can be directly set or it can be generated based on a pre-defined invoices series.
      discriminator:
        propertyName: type
        mapping:
          provided: '#/components/schemas/InvoiceProvidedCode'
          generated: '#/components/schemas/InvoiceGeneratedCode'
      required:
        - type
      properties:
        type:
          type: string
          description: The type of the code.
          enum:
            - provided
            - generated
    InvoiceProvidedCode:
      type: object
      required:
        - value
      allOf:
        - $ref: '#/components/schemas/InvoiceCodeRequest'
        - type: object
          properties:
            value:
              type: string
              description: |
                The code value to be used for the invoice.
                It is usually used to identify this invoice in tax declarations.
              example: INV-2024-0001
    InvoiceGeneratedCode:
      type: object
      required:
        - series_id
      allOf:
        - $ref: '#/components/schemas/InvoiceCodeRequest'
        - type: object
          properties:
            series_id:
              type: string
              description: The unique identifier of the invoices series to be used to generate the reference.
              example: ser_4ehg1mkv3mvt3256vcn8dspb4h
    AdjustmentBase:
      type: object
      required:
        - type
      description: The adjustments applied to this line.
      properties:
        type:
          type: string
          description: The type of adjustment.
        reference:
          type: string
          description: Your reference for the adjustment.
          maxLength: 50
        name:
          type: string
          description: Localized name to display to the user. If it is not present, `reference` is used.
          maxLength: 100
    AdjustmentFixed:
      allOf:
        - $ref: '#/components/schemas/AdjustmentBase'
        - type: object
          required:
            - amount
          properties:
            amount:
              allOf:
                - $ref: '#/components/schemas/AmountMinorOne'
                - description: Fixed amount to apply.
    AdjustmentPercentage:
      allOf:
        - $ref: '#/components/schemas/AdjustmentBase'
        - type: object
          required:
            - percent
          properties:
            percent:
              type: number
              format: double
              description: Percentage amount to apply.
              minimum: 0
              maximum: 100
    Taxes:
      type: array
      minItems: 1
      description: List of applied taxes and used in the invoice totals.
      items:
        anyOf:
          - $ref: '#/components/schemas/ExemptTax'
          - $ref: '#/components/schemas/PercentageTax'
        discriminator:
          propertyName: type
          mapping:
            percentage: '#/components/schemas/PercentageTax'
            exempt: '#/components/schemas/ExemptTax'
    InvoiceNotes:
      type: array
      maxItems: 10
      description: Unstructured information that is relevant to the invoice, such as correction or additional legal details.
      items:
        type: string
        description: Free text of additional information that may be added to a document.
        maxLength: 250
    CreateInvoiceLines:
      type: array
      description: List of invoice lines representing each of the items sold to the buyer.
      items:
        type: object
        required:
          - item
          - quantity
          - taxes
        description: Line is a single row in an invoice.
        properties:
          item:
            type: object
            required:
              - name
              - amount
              - unit
            description: Item is used to describe a single product or service.
            properties:
              reference:
                type: string
                description: |
                  Primary reference code that identifies this item.
                  Additional codes can be provided in the `metadata` property.
                maxLength: 50
              name:
                type: string
                description: Brief name of the item.
                maxLength: 100
              amount:
                allOf:
                  - $ref: '#/components/schemas/AmountMinor'
                  - description: The amount of a single unit to be sold in the minor currency unit (e.g., 100 cents for 1 EUR).
              unit:
                type: string
                description: The unit of measure.
                enum:
                  - metre
                  - litre
                  - hour
                  - kit
                  - service
                  - item
                  - other
                example: metre
              metadata:
                type: object
                description: |
                  Some data to provide context for the item.
                  Keys with a length greater than 100 characters are not supported.
                  This will never be displayed to end users.
                maxProperties: 5
                additionalProperties:
                  type: string
                  maxLength: 250
                example:
                  ext-id: id-1099320
          quantity:
            type: number
            format: double
            description: Number of items.
          discounts:
            type: array
            description: Discounts applied to this line.
            items:
              type: object
              description: The amount deducted from the line, and will be applied before taxes.
              anyOf:
                - $ref: '#/components/schemas/AdjustmentFixed'
                - $ref: '#/components/schemas/AdjustmentPercentage'
              discriminator:
                propertyName: type
                mapping:
                  fixed: '#/components/schemas/AdjustmentFixed'
                  percentage: '#/components/schemas/AdjustmentPercentage'
          charges:
            type: array
            description: Charges applied to this line.
            items:
              type: object
              description: The amount added to the line, and will be applied before taxes.
              anyOf:
                - $ref: '#/components/schemas/AdjustmentFixed'
                - $ref: '#/components/schemas/AdjustmentPercentage'
              discriminator:
                propertyName: type
                mapping:
                  fixed: '#/components/schemas/AdjustmentFixed'
                  percentage: '#/components/schemas/AdjustmentPercentage'
          taxes:
            $ref: '#/components/schemas/Taxes'
          notes:
            $ref: '#/components/schemas/InvoiceNotes'
    CreateInvoiceGroups:
      type: array
      description: List of invoice lines grouped by property representing each of the items sold to the buyer.
      items:
        type: object
        required:
          - reference
          - name
          - lines
        properties:
          reference:
            type: string
            description: Your reference for the group. This will never be displayed to end users.
            maxLength: 50
          name:
            type: string
            description: Brief name of the group.
            maxLength: 100
          lines:
            $ref: '#/components/schemas/CreateInvoiceLines'
    TermsDueDateType:
      type: string
      description: Due on specific date/s.
    DueDateBaseRequest:
      type: object
      description: The amount that should be paid by the given date.
      properties:
        amount:
          $ref: '#/components/schemas/AmountMinorOne'
          description: How much needs to be paid by the date. The amount is allowed to be unspecified for only a single due date. If not supplied, the outstanding balance of the total invoice amount is due on that specific date.
    TermsBase:
      type: object
      required:
        - type
      description: Payment terms or conditions.
      properties:
        type:
          type: string
        notes:
          $ref: '#/components/schemas/InvoiceNotes'
    TermsDueDate:
      allOf:
        - type: object
          required:
            - due_dates
          properties:
            type:
              $ref: '#/components/schemas/TermsDueDateType'
            due_dates:
              type: array
              description: Set of dates for agreed payments.
              minItems: 1
              uniqueItems: true
              items:
                allOf:
                  - required:
                      - due_at
                    properties:
                      due_at:
                        $ref: '#/components/schemas/DateTime'
                        description: When the payment is due.
                  - $ref: '#/components/schemas/DueDateBaseRequest'
        - $ref: '#/components/schemas/TermsBase'
    TermsDeferredType:
      type: string
      description: Deferred after an amount of days.
    TermsDeferredDays:
      type: integer
      description: Number of days after the issue date when the payment must be made. The minimum value, `1`, represents the same issue day.
      minimum: 1
      maximum: 180
    TermsDeferred:
      allOf:
        - required:
            - due_dates
          properties:
            type:
              $ref: '#/components/schemas/TermsDeferredType'
            due_dates:
              type: array
              description: Set of dates for agreed payments.
              minItems: 1
              uniqueItems: true
              items:
                allOf:
                  - required:
                      - days
                    properties:
                      days:
                        $ref: '#/components/schemas/TermsDeferredDays'
                  - $ref: '#/components/schemas/DueDateBaseRequest'
        - $ref: '#/components/schemas/TermsBase'
    PaymentMethodsExternalBankTransfer:
      allOf:
        - $ref: '#/components/schemas/PaymentMethodsBase'
        - type: object
          required:
            - payment_instrument_id
          properties:
            payment_instrument_id:
              $ref: '#/components/schemas/PaymentInstrumentId'
              description: The unique identifier of the seller's payment instrument where the transfer must be made.
    PaymentMethodsExternalDirectDebit:
      allOf:
        - type: object
          required:
            - payment_instrument_id
          properties:
            type:
              description: |
                The type of payment method.

                If payment method is `external_direct_debit`, the payment will be made by debiting the buyer's account directly so other payment methods are not compatible.
            payment_instrument_id:
              $ref: '#/components/schemas/PaymentInstrumentId'
              description: The unique identifier of the seller's payment instrument where the debit will be deposited.
        - $ref: '#/components/schemas/PaymentMethodsBase'
    PaymentMethodsBase:
      type: object
      required:
        - type
      description: The details on how payment should be made.
      properties:
        type:
          type: string
          description: The type of payment method.
    PaymentMethods:
      type: array
      description: Details on how payment should be made.
      minItems: 1
      uniqueItems: true
      items:
        type: object
        anyOf:
          - $ref: '#/components/schemas/PaymentMethodsExternalBankTransfer'
          - $ref: '#/components/schemas/PaymentMethodsExternalDirectDebit'
        discriminator:
          propertyName: type
          mapping:
            external_bank_transfer: '#/components/schemas/PaymentMethodsExternalBankTransfer'
            external_direct_debit: '#/components/schemas/PaymentMethodsExternalDirectDebit'
    PaymentRequest:
      type: object
      description: Information on when, how, and to whom the invoice should be paid.
      properties:
        terms:
          type: object
          description: |
            Payment terms or conditions.

            * `due_date` - Due on specific date/s.
            * `deferred` - Deferred after an amount of days.
          anyOf:
            - $ref: '#/components/schemas/TermsDueDate'
            - $ref: '#/components/schemas/TermsDeferred'
          discriminator:
            propertyName: type
            mapping:
              due_date: '#/components/schemas/TermsDueDate'
              deferred: '#/components/schemas/TermsDeferred'
        methods:
          $ref: '#/components/schemas/PaymentMethods'
    InvoiceDocument:
      allOf:
        - required:
            - format
          properties:
            type:
              description: Document that will be generated using the data in the request.
            format:
              $ref: '#/components/schemas/InvoiceDocumentFormat'
        - $ref: '#/components/schemas/InvoiceDocumentBase'
    InvoiceAttachmentDocument:
      allOf:
        - required:
            - type
            - id
          properties:
            type:
              description: Attach a file to the invoice. The file must be previously uploaded using the [Upload Invoice Document](#tag/Invoice-Documents/operation/upload_invoice_document) endpoint.
            id:
              $ref: '#/components/schemas/DocumentId'
        - $ref: '#/components/schemas/InvoiceDocumentBase'
    InvoiceDocumentBase:
      type: object
      properties:
        type:
          $ref: '#/components/schemas/InvoiceDocumentType'
          default: invoice
    InvoiceDocuments:
      type: array
      description: The documents associated to the invoice. It can contain both the document automatically generated from the invoice data or the attachments uploaded using the [Upload Invoice Document](#tag/Invoice-Documents/operation/upload_invoice_document) endpoint.
      uniqueItems: true
      items:
        anyOf:
          - $ref: '#/components/schemas/InvoiceDocument'
          - $ref: '#/components/schemas/InvoiceAttachmentDocument'
        discriminator:
          propertyName: type
          mapping:
            invoice: '#/components/schemas/InvoiceDocument'
            invoice_attachment: '#/components/schemas/InvoiceAttachmentDocument'
    InvoiceExternalLinks:
      type: array
      description: List of links to additional information related to the invoice that are included in the invoice document.
      minItems: 1
      maxItems: 10
      uniqueItems: true
      items:
        type: object
        description: Link to additional information related to the invoice.
        required:
          - name
          - url
        properties:
          name:
            type: string
            description: The text of the link.
            maxLength: 100
            example: Order
          url:
            $ref: '#/components/schemas/Url'
            description: The URL of the external link.
            example: https://seller.com/orders/98f445bd-1316-4d6c-9243-f6b9d9192ef8
    InvoiceMetadata:
      type: object
      description: |
        Some data to provide context for the invoice.
        Keys with a length greater than 100 characters are not supported.
        This will never be displayed to end users.
      maxProperties: 5
      additionalProperties:
        type: string
        maxLength: 250
    Urls:
      type: object
      description: URLs that are used throughout the invoice process.
      properties:
        webhook:
          $ref: '#/components/schemas/Url'
          description: |
            The webhook endpoint to which events for this invoice will be sent to.

            If omitted, webhooks will not be sent.
    InvoiceBaseRequest:
      type: object
      required:
        - type
      properties:
        type:
          $ref: '#/components/schemas/InvoiceType'
          default: standard
        reference:
          $ref: '#/components/schemas/InvoiceReference'
        code:
          $ref: '#/components/schemas/InvoiceCodeRequest'
        seller:
          $ref: '#/components/schemas/BaseSeller'
        buyer:
          $ref: '#/components/schemas/BaseBuyer'
        groups:
          $ref: '#/components/schemas/CreateInvoiceGroups'
        lines:
          $ref: '#/components/schemas/CreateInvoiceLines'
        payment:
          $ref: '#/components/schemas/PaymentRequest'
        documents:
          $ref: '#/components/schemas/InvoiceDocuments'
        external_links:
          $ref: '#/components/schemas/InvoiceExternalLinks'
        metadata:
          $ref: '#/components/schemas/InvoiceMetadata'
        notes:
          $ref: '#/components/schemas/InvoiceNotes'
        urls:
          $ref: '#/components/schemas/Urls'
    StandardInvoiceRequest:
      allOf:
        - type: object
          properties:
            type:
              type: string
            reference:
              type: string
            code:
              type: object
            seller:
              $ref: '#/components/schemas/StandardSeller'
            buyer:
              $ref: '#/components/schemas/StandardBuyer'
            currency:
              $ref: '#/components/schemas/Currency'
        - $ref: '#/components/schemas/InvoiceBaseRequest'
    Date:
      type: string
      format: date
      minLength: 10
      maxLength: 10
      example: '2023-09-01'
    BillingCycle:
      type: object
      required:
        - starts_at
        - ends_at
      description: Defines the biling cycle for an invoice.
      properties:
        starts_at:
          $ref: '#/components/schemas/Date'
          description: The start date of the billing cycle.
        ends_at:
          $ref: '#/components/schemas/Date'
          description: The end date of the billing cycle.
    UpdateInvoiceBaseRequest:
      allOf:
        - type: object
          required:
            - type
            - code
            - payment
          properties:
            type:
              type: string
              default: standard
            reference:
              type: string
            billing_cycle:
              $ref: '#/components/schemas/BillingCycle'
            code:
              type: object
            seller:
              type: object
            buyer:
              type: object
            groups:
              type: array
            lines:
              type: array
            payment:
              type: object
              required:
                - terms
                - methods
        - $ref: '#/components/schemas/InvoiceBaseRequest'
    UpdateStandardInvoiceRequest:
      allOf:
        - type: object
          required:
            - seller
            - buyer
            - payment
          properties:
            type:
              type: string
            reference:
              type: string
            code:
              type: object
            seller:
              $ref: '#/components/schemas/UpdateStandardSeller'
            buyer:
              $ref: '#/components/schemas/UpdateStandardBuyer'
        - $ref: '#/components/schemas/StandardInvoiceRequest'
        - $ref: '#/components/schemas/UpdateInvoiceBaseRequest'
    InvoiceDraftStatus:
      type: string
      description: The [status](#tag/Invoices/Statuses) of the invoice.
      enum:
        - draft
    CreateInvoiceBaseRequest:
      allOf:
        - type: object
          properties:
            type:
              type: string
            status:
              $ref: '#/components/schemas/InvoiceDraftStatus'
        - $ref: '#/components/schemas/UpdateInvoiceBaseRequest'
    CorrectionOptions:
      type: object
      required:
        - type
      description: The options for correcting an invoice.
      properties:
        type:
          type: string
          description: |
            The type of correction.
            - `complete` - The invoice corrects all the data of the preceding invoice.
            - `partial` - The invoice corrects only some of the data of the preceding invoice.
          enum:
            - complete
            - partial
          example: complete
    CorrectiveInvoiceRequest:
      allOf:
        - type: object
          properties:
            type:
              type: string
            reference:
              type: string
            correction_options:
              $ref: '#/components/schemas/CorrectionOptions'
            precedings:
              type: array
              description: |
                List of invoices that are being corrected by this invoice.
                All original invoices must:
                - be of type `standard`,
                - been issued by the same `seller` and to the same `buyer`,
                - and have the same `currency`.
              items:
                type: object
                required:
                  - id
                  - reason
                properties:
                  id:
                    $ref: '#/components/schemas/InvoiceId'
                    description: The unique identifier of the invoice that is being corrected.
                  reason:
                    type: string
                    description: The reason why the invoice is being corrected.
                    maxLength: 250
        - $ref: '#/components/schemas/InvoiceBaseRequest'
    UpdateCorrectiveInvoiceRequest:
      allOf:
        - type: object
          required:
            - correction_options
            - precedings
          properties:
            type:
              type: string
            reference:
              type: string
            correction_options:
              type: object
            precedings:
              type: array
        - $ref: '#/components/schemas/UpdateInvoiceBaseRequest'
        - $ref: '#/components/schemas/CorrectiveInvoiceRequest'
    CreateInvoiceRequest:
      anyOf:
        - $ref: '#/components/schemas/CreateStandardInvoiceRequest'
        - $ref: '#/components/schemas/CreateCorrectiveInvoiceRequest'
      discriminator:
        propertyName: type
        mapping:
          standard: '#/components/schemas/CreateStandardInvoiceRequest'
          corrective: '#/components/schemas/CreateCorrectiveInvoiceRequest'
    InvoiceStatusCreateResponse:
      type: string
      description: The [status](#tag/Invoices/Statuses) of the invoice.
      enum:
        - draft
        - initiated
        - issued
    NotificationBaseResponse:
      type: object
      required:
        - type
      description: Mechanism to notify when an invoice is created.
      properties:
        type:
          type: string
          description: |
            Type of notification.
    EmailNotificationResponse:
      allOf:
        - $ref: '#/components/schemas/NotificationBaseResponse'
        - type: object
          required:
            - to
          properties:
            to:
              type: array
              description: List of addresses for the primary recipients of the email.
              items:
                $ref: '#/components/schemas/EmailAddress'
            cc:
              type: array
              description: List of addresses which receive a copy of the email.
              items:
                $ref: '#/components/schemas/EmailAddress'
            bcc:
              type: array
              description: |
                List of addresses which receive a copy of the email.
                Recipients in the BCC field are not visible to other recipients of the email.
              items:
                $ref: '#/components/schemas/EmailAddress'
    AllDefaultsNotificationResponse:
      allOf:
        - $ref: '#/components/schemas/NotificationBaseResponse'
        - type: object
          required:
            - defaults
          properties:
            defaults:
              type: array
              minItems: 1
              description: List of notifications calculated from `all_defaults` notification configuration.
              items:
                anyOf:
                  - $ref: '#/components/schemas/EmailNotificationResponse'
                discriminator:
                  propertyName: type
                  mapping:
                    email: '#/components/schemas/EmailNotificationResponse'
    CreateInvoiceResponseBuyer:
      type: object
      description: The buyer information for the invoice.
      required:
        - notifications
      properties:
        notifications:
          type: array
          description: Mechanisms to notify when an invoice is created. Only present if the `buyer.notifications[].type` field was `all_defaults` in the request.
          minItems: 1
          uniqueItems: true
          items:
            type: object
            anyOf:
              - $ref: '#/components/schemas/AllDefaultsNotificationResponse'
            discriminator:
              propertyName: type
              mapping:
                all_defaults: '#/components/schemas/AllDefaultsNotificationResponse'
    InvoiceLineResponse:
      type: object
      required:
        - item
        - base
        - total
      description: Line is a single row in an invoice.
      properties:
        item:
          type: object
          required:
            - name
          description: Item is used to describe a single product or service.
          properties:
            reference:
              type: string
              description: Primary reference code that identifies this item.
              maxLength: 50
            name:
              type: string
              description: Brief name of the item.
              maxLength: 100
        tax:
          allOf:
            - $ref: '#/components/schemas/AmountMinor'
            - description: |
                Amount of tax to apply to the line.

                **Note:** This value is generated following [getpaid rounding](https://docs.getpaid.io/v2alpha1.23dde092-df9a-4cdb-8646-3b2a4e5fe756/invoices/rounding).
        base:
          allOf:
            - $ref: '#/components/schemas/AmountMinor'
            - description: |
                Amount per quantity minus the discounts, plus the charges, without tax.

                **Note:** This value is generated following [getpaid rounding](https://docs.getpaid.io/v2alpha1.23dde092-df9a-4cdb-8646-3b2a4e5fe756/invoices/rounding).
        total:
          allOf:
            - $ref: '#/components/schemas/AmountMinor'
            - description: Grand total after all taxes have been applied.
    CreateInvoiceResponseGroups:
      type: array
      description: List of invoice lines grouped by property representing each of the items sold to the buyer.
      items:
        type: object
        required:
          - reference
          - lines
        properties:
          reference:
            type: string
            maxLength: 50
            description: Your reference for the group. This will never be displayed to end users.
          lines:
            type: array
            description: List of invoice lines representing each of the items sold to the buyer.
            items:
              $ref: '#/components/schemas/InvoiceLineResponse'
    CreateInvoiceResponseLines:
      type: array
      description: List of invoice lines (that does not belong to any group) representing each of the items sold to the buyer.
      items:
        $ref: '#/components/schemas/InvoiceLineResponse'
    TermsDueDateResponse:
      allOf:
        - required:
            - due_dates
          properties:
            type:
              $ref: '#/components/schemas/TermsDueDateType'
            due_dates:
              $ref: '#/components/schemas/DueDatesBaseResponse'
        - $ref: '#/components/schemas/TermsBaseResponse'
    TermsDeferredResponse:
      allOf:
        - required:
            - due_dates
          properties:
            type:
              $ref: '#/components/schemas/TermsDeferredType'
            due_dates:
              allOf:
                - items:
                    required:
                      - days
                    properties:
                      id:
                        type: string
                      number:
                        type: integer
                      days:
                        $ref: '#/components/schemas/TermsDeferredDays'
                - $ref: '#/components/schemas/DueDatesBaseResponse'
        - $ref: '#/components/schemas/TermsBaseResponse'
    PaymentTermId:
      allOf:
        - $ref: '#/components/schemas/Id'
        - description: The unique identifier of the payment term.
          example: ptm_4tfwx4hygbkwnepj8t8md13v5z
    DueDatesBaseResponse:
      type: array
      description: Set of dates for agreed payments.
      minItems: 1
      uniqueItems: true
      items:
        type: object
        description: The amount that should be paid by the given date.
        required:
          - id
          - number
          - amount
        properties:
          id:
            $ref: '#/components/schemas/PaymentTermId'
          number:
            type: integer
            minimum: 1
            description: The payment term number based on due dates.
            example: 1
          due_at:
            $ref: '#/components/schemas/DateTime'
            description: When the payment is due.
          amount:
            $ref: '#/components/schemas/AmountMinorOne'
            description: How much needs to be paid by the date.
    TermsBaseResponse:
      type: object
      required:
        - type
      description: Payment terms or conditions.
      properties:
        type:
          type: string
    TermsResponse:
      type: object
      description: |
        Payment terms or conditions.

        * `due_date` - Due on specific date/s.
        * `deferred` - Deferred after an amount of days.
      anyOf:
        - $ref: '#/components/schemas/TermsDueDateResponse'
        - $ref: '#/components/schemas/TermsDeferredResponse'
      discriminator:
        propertyName: type
        mapping:
          due_date: '#/components/schemas/TermsDueDateResponse'
          deferred: '#/components/schemas/TermsDeferredResponse'
    PaymentResponse:
      type: object
      required:
        - terms
      description: Information on when, and which amount should be paid when the amount of a due date was not provided or the due dates are calculated based on the issue date.
      properties:
        terms:
          $ref: '#/components/schemas/TermsResponse'
    TaxResponseBase:
      type: object
      description: The tax applied to the line.
      required:
        - type
        - base
      properties:
        type:
          type: string
          description: |
            The type of tax.
             * `percentage` - A tax defined as a percentage of the line amount.
             * `exempt` - A tax that is exempted from the line amount.
          enum:
            - percentage
            - exempt
        base:
          allOf:
            - $ref: '#/components/schemas/AmountMinor'
            - description: Sum of all line sums minus the discounts, plus the charges, without tax.
    PercentageTaxResponse:
      allOf:
        - $ref: '#/components/schemas/TaxResponseBase'
        - description: Tax defined as an amount percentage.
          required:
            - percent
          properties:
            percent:
              type: number
              format: double
              description: Percentage amount applied.
              minimum: 0
              maximum: 100
            tax:
              allOf:
                - $ref: '#/components/schemas/AmountMinor'
                - description: Total amount of tax to apply.
    ExemptTaxResponse:
      allOf:
        - $ref: '#/components/schemas/TaxResponseBase'
        - description: Tax defined as an exemption.
    Totals:
      type: object
      description: |
        Summary of all the invoice totals, including taxes (calculated).

        **Note:** This value is generated following [getpaid rounding](https://docs.getpaid.io/v2alpha1.23dde092-df9a-4cdb-8646-3b2a4e5fe756/invoices/rounding).
        In this scenario, totals are generated line-by-line and this property is summarizing those totals.
      required:
        - taxes
        - base
        - total
      properties:
        tax:
          allOf:
            - $ref: '#/components/schemas/AmountMinor'
            - description: Total amount of tax to apply to the invoice.
        taxes:
          type: array
          minItems: 1
          description: Summary of all the taxes included in the invoice.
          items:
            type: object
            required:
              - reference
              - percentages
            description: Grouping of all the taxes by their reference.
            properties:
              reference:
                type: string
                maxLength: 50
                description: Primary reference code that identifies this group.
              percentages:
                type: array
                items:
                  anyOf:
                    - $ref: '#/components/schemas/PercentageTaxResponse'
                    - $ref: '#/components/schemas/ExemptTaxResponse'
                  discriminator:
                    propertyName: type
                    mapping:
                      percentage: '#/components/schemas/PercentageTaxResponse'
                      exempt: '#/components/schemas/ExemptTaxResponse'
              sum:
                allOf:
                  - $ref: '#/components/schemas/AmountMinor'
                  - description: Sum of all line item sums.
        base:
          allOf:
            - $ref: '#/components/schemas/AmountMinor'
            - description: Sum of all line sums minus the discounts, plus the charges, without tax.
        total:
          allOf:
            - $ref: '#/components/schemas/AmountMinorZero'
            - description: Grand total after all taxes have been applied.
    CreateInvoiceResponse:
      type: object
      required:
        - id
        - type
        - status
        - payment
        - totals
      properties:
        id:
          $ref: '#/components/schemas/InvoiceId'
        type:
          $ref: '#/components/schemas/InvoiceType'
        status:
          $ref: '#/components/schemas/InvoiceStatusCreateResponse'
        issued_at:
          $ref: '#/components/schemas/DateTime'
          description: The date when the invoice was issued. Only present if the `code.type` field was `provided` so it is issued synchronously.
        buyer:
          $ref: '#/components/schemas/CreateInvoiceResponseBuyer'
        groups:
          $ref: '#/components/schemas/CreateInvoiceResponseGroups'
        lines:
          $ref: '#/components/schemas/CreateInvoiceResponseLines'
        payment:
          $ref: '#/components/schemas/PaymentResponse'
        totals:
          $ref: '#/components/schemas/Totals'
    GetStandardInvoiceResponse:
      allOf:
        - $ref: '#/components/schemas/GetInvoiceBaseResponse'
        - type: object
          required:
            - subsequents
          properties:
            subsequents:
              type: array
              description: List of invoices that are correcting this invoice.
              items:
                $ref: '#/components/schemas/RelatedInvoice'
    GetCorrectiveInvoiceResponse:
      allOf:
        - $ref: '#/components/schemas/GetInvoiceBaseResponse'
        - type: object
          required:
            - precedings
          properties:
            precedings:
              type: array
              description: List of invoices that this invoice is correcting.
              minItems: 1
              items:
                $ref: '#/components/schemas/RelatedInvoice'
    TermsDueDateIssued:
      allOf:
        - properties:
            type:
              type: string
            due_dates:
              items:
                required:
                  - due_at
        - $ref: '#/components/schemas/TermsDueDateResponse'
    TermsDeferredIssued:
      allOf:
        - properties:
            type:
              type: string
            due_dates:
              items:
                required:
                  - due_at
        - $ref: '#/components/schemas/TermsDeferredResponse'
    TermsIssued:
      type: object
      description: |
        Payment terms or conditions.

        * `due_date` - Due on specific date/s.
        * `deferred` - Deferred after an amount of days.
      anyOf:
        - $ref: '#/components/schemas/TermsDueDateIssued'
        - $ref: '#/components/schemas/TermsDeferredIssued'
      discriminator:
        propertyName: type
        mapping:
          due_date: '#/components/schemas/TermsDueDateIssued'
          deferred: '#/components/schemas/TermsDeferredIssued'
    EventId:
      type: string
      description: The unique identifier of the event.
      example: evt_227tzhc4nw544678r08jtm8zbt01
      maxLength: 50
    OccurredAt:
      type: string
      format: date-time
      description: Date and time of the event.
      example: '2023-02-10T14:16:07.6962864Z'
    InvoiceEventBase:
      type: object
      required:
        - type
        - id
        - occurred_at
      description: The events of the invoice.
      properties:
        type:
          type: string
          description: |
            Type of terms to be applied:

            * `initiated` - The invoice has been initiated.
            * `draft_document_updated` - The draft document has been updated.
            * `draft_completed` - The draft is completed.
            * `draft_cancelled` - The draft is cancelled.
            * `document_created` - The invoice document is generated.
            * `buyer_notification_sent` - The invoice notification is sent to the buyer.
            * `issued` - The invoice has been created.
        id:
          $ref: '#/components/schemas/EventId'
        occurred_at:
          $ref: '#/components/schemas/OccurredAt'
    InvoiceEventInvoiceInitiated:
      allOf:
        - $ref: '#/components/schemas/InvoiceEventBase'
        - properties:
            status:
              type: string
              description: |
                The status of the invoice.

                * `draft` - The invoice is a draft and can suffer changes.
              enum:
                - draft
    InvoiceEventDraftDocumentUpdated:
      allOf:
        - $ref: '#/components/schemas/InvoiceEventBase'
        - properties:
            document:
              $ref: '#/components/schemas/GetInvoiceDocument'
              description: The draft document that is being updated. Only present on the last event of the sequence of the current type.
    InvoiceEventDraftCompleted:
      allOf:
        - $ref: '#/components/schemas/InvoiceEventBase'
    InvoiceEventDraftCancelled:
      allOf:
        - $ref: '#/components/schemas/InvoiceEventBase'
    InvoiceEventInvoiceIssued:
      allOf:
        - $ref: '#/components/schemas/InvoiceEventBase'
    InvoiceEventInvoiceDocumentCreated:
      allOf:
        - $ref: '#/components/schemas/InvoiceEventBase'
        - required:
            - document
          properties:
            document:
              $ref: '#/components/schemas/GetInvoiceDocument'
              description: The invoice document generated.
    InvoiceEventInvoiceBuyerNotificationSent:
      allOf:
        - $ref: '#/components/schemas/InvoiceEventBase'
        - required:
            - notification
          properties:
            notification:
              type: object
              description: The notification sent to the buyer.
              anyOf:
                - $ref: '#/components/schemas/EmailNotificationResponse'
              discriminator:
                propertyName: type
                mapping:
                  email: '#/components/schemas/EmailNotificationResponse'
    GetInvoiceBaseResponse:
      allOf:
        - type: object
          required:
            - buyer
            - seller
            - payment
            - totals
            - events
          properties:
            id:
              type: string
            type:
              type: string
            status:
              $ref: '#/components/schemas/InvoiceStatus'
            reference:
              type: string
            billing_cycle:
              $ref: '#/components/schemas/BillingCycle'
            code:
              type: string
            seller:
              $ref: '#/components/schemas/AccountRef'
            buyer:
              allOf:
                - $ref: '#/components/schemas/AccountRef'
                - properties:
                    notifications:
                      type: array
                      description: Mechanisms to notify when an invoice is created.
                      maxItems: 1
                      items:
                        anyOf:
                          - $ref: '#/components/schemas/EmailNotificationResponse'
                          - $ref: '#/components/schemas/AllDefaultsNotificationResponse'
                        discriminator:
                          propertyName: type
                          mapping:
                            email: '#/components/schemas/EmailNotificationResponse'
                            all_defaults: '#/components/schemas/AllDefaultsNotificationResponse'
            issued_at:
              type: string
            due_at:
              type: string
            currency:
              type: string
            groups:
              allOf:
                - $ref: '#/components/schemas/CreateInvoiceGroups'
                - $ref: '#/components/schemas/CreateInvoiceResponseGroups'
            lines:
              allOf:
                - $ref: '#/components/schemas/CreateInvoiceLines'
                - $ref: '#/components/schemas/CreateInvoiceResponseLines'
            payment:
              type: object
              required:
                - terms
                - methods
              description: Information on when, how, and to whom the invoice should be paid.
              properties:
                terms:
                  $ref: '#/components/schemas/TermsIssued'
                methods:
                  type: array
                  description: Details on how payment should be made.
                  items:
                    anyOf:
                      - $ref: '#/components/schemas/PaymentMethodsExternalBankTransfer'
                      - $ref: '#/components/schemas/PaymentMethodsExternalDirectDebit'
                    discriminator:
                      propertyName: type
                      mapping:
                        external_bank_transfer: '#/components/schemas/PaymentMethodsExternalBankTransfer'
                        external_direct_debit: '#/components/schemas/PaymentMethodsExternalDirectDebit'
            documents:
              type: array
            external_links:
              $ref: '#/components/schemas/InvoiceExternalLinks'
            metadata:
              type: object
              description: |
                Some data to provide context for the invoice.
                Keys with a length greater than 100 characters are not supported.
                This will never be displayed to end users.
              maxProperties: 5
              additionalProperties:
                type: string
                maxLength: 250
            notes:
              $ref: '#/components/schemas/InvoiceNotes'
            totals:
              type: object
              description: Summary of all the invoice totals, including taxes (calculated).
              required:
                - taxes
                - base
                - total
              properties:
                tax:
                  $ref: '#/components/schemas/AmountMinor'
                  description: Total amount of tax to apply to the invoice.
                taxes:
                  type: array
                  minItems: 1
                  description: Summary of all the taxes included in the invoice.
                  items:
                    type: object
                    required:
                      - reference
                      - percentages
                      - sum
                    description: Grouping of all the taxes by their reference.
                    properties:
                      reference:
                        type: string
                        description: Primary reference code that identifies this group.
                        maxLength: 50
                      percentages:
                        type: array
                        items:
                          anyOf:
                            - $ref: '#/components/schemas/PercentageTaxResponse'
                            - $ref: '#/components/schemas/ExemptTaxResponse'
                          discriminator:
                            propertyName: type
                            mapping:
                              percentage: '#/components/schemas/PercentageTaxResponse'
                              exempt: '#/components/schemas/ExemptTaxResponse'
                      sum:
                        $ref: '#/components/schemas/AmountMinor'
                        description: Sum of all line item sums.
                base:
                  $ref: '#/components/schemas/AmountMinor'
                  description: Sum of all line sums minus the discounts, plus the charges, without tax.
                total:
                  $ref: '#/components/schemas/AmountMinorZero'
                  description: Grand total after all taxes have been applied.
            subscription:
              $ref: '#/components/schemas/Subscription'
            series:
              $ref: '#/components/schemas/GetInvoicesInvoicesSeries'
            subsequents:
              type: array
            events:
              type: array
              description: The events of the payment.
              items:
                anyOf:
                  - $ref: '#/components/schemas/InvoiceEventInvoiceInitiated'
                  - $ref: '#/components/schemas/InvoiceEventDraftDocumentUpdated'
                  - $ref: '#/components/schemas/InvoiceEventDraftCompleted'
                  - $ref: '#/components/schemas/InvoiceEventDraftCancelled'
                  - $ref: '#/components/schemas/InvoiceEventInvoiceIssued'
                  - $ref: '#/components/schemas/InvoiceEventInvoiceDocumentCreated'
                  - $ref: '#/components/schemas/InvoiceEventInvoiceBuyerNotificationSent'
                discriminator:
                  propertyName: type
                  mapping:
                    initiated: '#/components/schemas/InvoiceEventInvoiceInitiated'
                    draft_document_updated: '#/components/schemas/InvoiceEventDraftDocumentUpdated'
                    draft_completed: '#/components/schemas/InvoiceEventDraftCompleted'
                    draft_cancelled: '#/components/schemas/InvoiceEventDraftCancelled'
                    issued: '#/components/schemas/InvoiceEventInvoiceIssued'
                    document_created: '#/components/schemas/InvoiceEventInvoiceDocumentCreated'
                    buyer_notification_sent: '#/components/schemas/InvoiceEventInvoiceBuyerNotificationSent'
            payment_advices:
              type: array
              description: List of payment advices.
              items:
                type: object
                description: The payment advice.
                required:
                  - id
                properties:
                  id:
                    type: string
                    description: The unique identifier of the payment advice.
                    example: pad_4ehg1mkv3mvt3256vcn8dspb4h
        - $ref: '#/components/schemas/InvoiceBaseResponse'
    RelatedInvoice:
      type: object
      description: An invoice related to another invoice.
      required:
        - id
        - code
        - issued_at
        - reason
      properties:
        id:
          $ref: '#/components/schemas/InvoiceId'
          description: The identifier of the related invoice.
        code:
          $ref: '#/components/schemas/InvoiceCode'
        issued_at:
          $ref: '#/components/schemas/IssuedAt'
        reason:
          type: string
          description: The reason of the relationship between the invoices.
          example: Wrong taxes calculation
    GetInvoiceResponse:
      anyOf:
        - $ref: '#/components/schemas/GetStandardInvoiceResponse'
        - $ref: '#/components/schemas/GetCorrectiveInvoiceResponse'
      discriminator:
        propertyName: type
        mapping:
          standard: '#/components/schemas/GetStandardInvoiceResponse'
          corrective: '#/components/schemas/GetCorrectiveInvoiceResponse'
    UpdateInvoiceRequest:
      anyOf:
        - $ref: '#/components/schemas/UpdateStandardInvoiceRequest'
        - $ref: '#/components/schemas/UpdateCorrectiveInvoiceRequest'
      discriminator:
        propertyName: type
        mapping:
          standard: '#/components/schemas/UpdateStandardInvoiceRequest'
          corrective: '#/components/schemas/UpdateCorrectiveInvoiceRequest'
    UpdateInvoiceResponse:
      type: object
      required:
        - id
        - type
        - status
        - payment
        - totals
      properties:
        id:
          $ref: '#/components/schemas/InvoiceId'
        type:
          $ref: '#/components/schemas/InvoiceType'
        status:
          $ref: '#/components/schemas/InvoiceDraftStatus'
        buyer:
          $ref: '#/components/schemas/CreateInvoiceResponseBuyer'
        groups:
          $ref: '#/components/schemas/CreateInvoiceResponseGroups'
        lines:
          $ref: '#/components/schemas/CreateInvoiceResponseLines'
        payment:
          allOf:
            - $ref: '#/components/schemas/PaymentResponse'
            - properties:
                terms:
                  $ref: '#/components/schemas/TermsIssued'
        totals:
          $ref: '#/components/schemas/Totals'
    ExportInvoicesRequest:
      type: object
      properties:
        filters:
          type: object
          description: Criteria to decide which invoices to export.
          properties:
            issued_at:
              type: object
              description: The period to retrieve when invoices were issued.
              properties:
                from:
                  $ref: '#/components/schemas/DateTime'
                  description: |
                    The start date of the period when invoices were issued.

                    By default, the start date is the current date minus 2 years.

                    Minimum: the current date minus 2 years.

                    Maximum: the date and time set in the `to` parameter.
                  example: '2023-09-01T22:05:48.479Z'
                to:
                  $ref: '#/components/schemas/DateTime'
                  description: |
                    The end date of the period when invoices were issued.

                    By default, the start date is the current date.

                    Minimum: the date and time set in the `from` parameter.

                    Maximum: the current date.
                  example: '2023-10-01T22:05:48.479Z'
            seller:
              type: object
              description: The seller associated to the invoice.
              required:
                - id
              properties:
                id:
                  $ref: '#/components/schemas/AccountId'
                  description: The unique identifier of the seller account.
                  example: acc_4ehg1mkv3mvt3256vcn8dspb4h
            buyer:
              type: object
              description: The buyer associated to the invoice.
              required:
                - id
              properties:
                id:
                  $ref: '#/components/schemas/AccountId'
                  description: The unique identifier of the buyer account.
                  example: acc_4ehg1mkv3mvt3256vcn8dspb4h
            reference:
              $ref: '#/components/schemas/InvoiceReference'
              description: |
                The invoices' reference.

                It is filtered by a contains operation.
            code:
              $ref: '#/components/schemas/InvoiceCode'
              description: |
                The invoices' code.

                It is filtered by a contains operation.
            due_at:
              type: object
              description: The period to retrieve when invoices are due.
              properties:
                from:
                  $ref: '#/components/schemas/DateTime'
                  description: |
                    The start date of the period of invoices due.

                    Minimum: the current date minus 2 years.

                    Maximum: the date and time set in the `to` parameter.
                  example: '2023-09-01T22:05:48.479Z'
                to:
                  $ref: '#/components/schemas/DateTime'
                  description: |
                    The end date of the period of invoices due.

                    Minimum: the date and time set in the `from` parameter.
                  example: '2023-10-01T22:05:48.479Z'
            statuses:
              type: array
              description: The statuses of the invoices.
              items:
                $ref: '#/components/schemas/InvoiceStatus'
            types:
              type: array
              description: |
                Types of invoice document subject to the requirements of the local tax regime.
                * `standard` - A regular invoice exchanged between a seller and a buyer in a commercial transaction.
                * `corrective` - A corrected invoice that completely replaces the preceding document.
              items:
                $ref: '#/components/schemas/InvoiceType'
              example:
                - standard
            subscription:
              type: object
              description: The subscription associated to the invoice.
              required:
                - id
              properties:
                id:
                  $ref: '#/components/schemas/SubscriptionId'
            has_payment_advices:
              type: boolean
              description: A value indicating whether the invoices have payment advices linked or not.
    ExportId:
      allOf:
        - $ref: '#/components/schemas/Id'
        - description: The unique identifier of the export job.
          example: xpt_4ehg1mkv3mvt3256vcn8dspb4h
    ExportStatus:
      type: string
      description: The status of the export job.
      enum:
        - pending
        - completed
        - error
    ExportInvoicesResponse:
      type: object
      required:
        - id
        - status
      properties:
        id:
          $ref: '#/components/schemas/ExportId'
          description: The unique identifier of the export job. This is used to track the progress.
        status:
          $ref: '#/components/schemas/ExportStatus'
          const: pending
    GetInvoicesExportPendingResponse:
      allOf:
        - $ref: '#/components/schemas/GetInvoicesExportBaseResponse'
    GetInvoicesExportCompletedResponse:
      allOf:
        - required:
            - id
            - status
            - report
          properties:
            id:
              type: string
            status:
              type: string
            report:
              type: object
              description: The report that contains the exported invoices.
              required:
                - id
                - url
                - expires_at
              properties:
                id:
                  $ref: '#/components/schemas/ReportId'
                url:
                  allOf:
                    - $ref: '#/components/schemas/Url'
                    - description: The URL to download the file that contains the report file.
                      example: https://api.getpaid.io/v2alpha1/invoices/export/xpt_4ehg1mkv3mvt3256vcn8dspb4h/download
                expires_at:
                  allOf:
                    - $ref: '#/components/schemas/DateTime'
                    - description: The date and time when the export URL expires.
                      example: '2023-09-01T22:05:48.479Z'
        - $ref: '#/components/schemas/GetInvoicesExportBaseResponse'
    GetInvoicesExportErrorResponse:
      allOf:
        - $ref: '#/components/schemas/GetInvoicesExportBaseResponse'
    GetInvoicesExportBaseResponse:
      type: object
      required:
        - id
        - status
      properties:
        id:
          $ref: '#/components/schemas/ExportId'
        status:
          $ref: '#/components/schemas/ExportStatus'
    ReportId:
      allOf:
        - $ref: '#/components/schemas/Id'
        - description: The unique identifier of the report.
          example: rpt_4ehg1mkv3mvt3256vcn8dspb4h
    GetInvoicesExportResponse:
      anyOf:
        - $ref: '#/components/schemas/GetInvoicesExportPendingResponse'
        - $ref: '#/components/schemas/GetInvoicesExportCompletedResponse'
        - $ref: '#/components/schemas/GetInvoicesExportErrorResponse'
      discriminator:
        propertyName: status
        mapping:
          pending: '#/components/schemas/GetInvoicesExportPendingResponse'
          completed: '#/components/schemas/GetInvoicesExportCompletedResponse'
          error: '#/components/schemas/GetInvoicesExportErrorResponse'
    UploadDocumentRequest:
      type: object
      required:
        - file
      properties:
        file:
          type: string
          format: binary
          description: |
            The file to upload. The maximum file size is 2MB.

            It must include the headers:

            * `Content-Disposition`: with the `filename` of the document. `filename` maximum length is 100 characters.
            * `Content-Type`: with the [corresponding MIME types to each kind of document](#section/Introduction/Files-MIME-Types).
    UploadDocumentResponse:
      type: object
      required:
        - id
      properties:
        id:
          $ref: '#/components/schemas/DocumentId'
    DownloadDocumentResponse:
      type: string
      format: binary
    SubscriptionType:
      type: string
      description: |
        The type of the subscription:

        - `custom`: The subscription is custom and all information is provided in the request.
      enum:
        - custom
    SubscriptionStartsAt:
      allOf:
        - description: The date on which the subscription starts or will start. The value is aligned with the billing cycle, it is the first day of any future occurrence of the billing cycle.
        - $ref: '#/components/schemas/Date'
    SubscriptionEndsAt:
      allOf:
        - $ref: '#/components/schemas/Date'
        - description: The date on which the subscription will end. The value is aligned with the billing cycle, and it is the last day of any future occurrence of the billing cycle. If not present, the subscription will continue indefinitely.
    SubscriptionNextIssueAt:
      allOf:
        - $ref: '#/components/schemas/Date'
        - description: The next date on which the subscription will be raised.
    GetIntervalCycle:
      allOf:
        - required:
            - expression
            - step
            - count
          properties:
            type:
              description: The billing cycle set in monthly or yearly intervals.
            expression:
              type: string
              format: crontab
              description: The computed full cron expression that defines the custom cycle. The format includes `{second} {minute} {hour} {day_of_month} {month_of_year} {day_of_week}[ {year}]`.
              example: 0 0 0 1 */1 ?
            step:
              type: string
              description: |
                The interval of the billing cycle.

                - `month` - The billing cycle is based on a monthly interval, the invoice will be issued every `count` months at the beginning of the month.
                - `year` - The billing cycle is based on a yearly interval, the invoice will be issued every `count` years at the beginning of the year.
              enum:
                - month
                - year
            count:
              type: integer
              description: The number of intervals between each billing cycle.
              minimum: 1
        - $ref: '#/components/schemas/BillingCycleBase'
    GetCustomCycle:
      allOf:
        - required:
            - expression
            - day_of_month
            - month_of_year
          properties:
            type:
              description: The custom cycle for the billing cycle. It supports a subset of the cron syntax. Use `*` to indicate all values, `1,2,3` to indicate a list of values, and `1-3` to indicate a range of values.
            expression:
              type: string
              format: crontab
              description: The computed full cron expression that defines the custom cycle. The format includes `{second} {minute} {hour} {day_of_month} {month_of_year} {day_of_week}`.
              example: 0 0 0 1 5,9 *
            day_of_month:
              $ref: '#/components/schemas/CustomCycleDayOfMonth'
            month_of_year:
              $ref: '#/components/schemas/CustomCycleMonthOfYear'
        - $ref: '#/components/schemas/BillingCycleBase'
    BillingCycleBase:
      type: object
      required:
        - type
      properties:
        type:
          description: The type of the billing cycle.
          type: string
          enum:
            - interval
            - custom
    CustomCycleDayOfMonth:
      type: string
      description: The month or months of the year on which the invoices should be issued. It represents the month of a [crontab expression](https://en.wikipedia.org/wiki/Cron).
      example: 5,9
    CustomCycleMonthOfYear:
      type: string
      description: The day or days of the month on which the invoices should be issued. It represents the day of the month of a [crontab expression](https://en.wikipedia.org/wiki/Cron).
      example: '*'
    GetSubscriptionBillingCycle:
      description: |
        The billing cycle object, it is used to configure when an invoice should be issued.
        It allows to select the date on which the invoice should be issued, we garantee that the invoice will be issued on the selected date but not at any specified time.
        We support two types of billing cycles: `interval` and `custom`:

        - `interval`, the billing cycle is based on a fixed interval aligned with the 1st of January.
        - `custom`, the billing cycle is based on a custom schedule, define using [crontab expressions](https://en.wikipedia.org/wiki/Cron) and it can be aligned with any day of the year.
      anyOf:
        - $ref: '#/components/schemas/GetIntervalCycle'
        - $ref: '#/components/schemas/GetCustomCycle'
      discriminator:
        propertyName: type
        mapping:
          interval: '#/components/schemas/GetIntervalCycle'
          custom: '#/components/schemas/GetCustomCycle'
    GetSubscriptionBase:
      type: object
      required:
        - type
        - name
        - starts_at
      properties:
        type:
          $ref: '#/components/schemas/SubscriptionType'
        name:
          $ref: '#/components/schemas/SubscriptionName'
        starts_at:
          $ref: '#/components/schemas/SubscriptionStartsAt'
        ends_at:
          $ref: '#/components/schemas/SubscriptionEndsAt'
        next_issue_at:
          $ref: '#/components/schemas/SubscriptionNextIssueAt'
        billing_cycle:
          $ref: '#/components/schemas/GetSubscriptionBillingCycle'
        invoice_details:
          type: object
          description: The details of the invoice.
          required:
            - seller
            - buyer
          properties:
            seller:
              type: object
              description: The taxable entity supplying the goods or services.
              required:
                - id
                - legal_name
              properties:
                id:
                  example: acc_4b5zswqg8kshx9zxdxa5g5c4wm
                  $ref: '#/components/schemas/AccountId'
                legal_name:
                  example: ACME Corp.
                  $ref: '#/components/schemas/AccountLegalName'
            buyer:
              type: object
              description: The legal entity receiving the goods or services.
              required:
                - id
                - legal_name
              properties:
                id:
                  example: acc_4w5az89g1p9dy9st7qe3rgstm7
                  $ref: '#/components/schemas/AccountId'
                legal_name:
                  $ref: '#/components/schemas/AccountLegalName'
    ListSubscriptionsResponse:
      allOf:
        - $ref: '#/components/schemas/Pagination'
        - properties:
            data:
              items:
                allOf:
                  - type: object
                    required:
                      - id
                      - billing_cycle
                      - invoice_details
                    properties:
                      id:
                        $ref: '#/components/schemas/SubscriptionId'
                      type:
                        type: string
                      name:
                        type: string
                  - $ref: '#/components/schemas/GetSubscriptionBase'
    CreateSubscriptionRequestCustom:
      allOf:
        - type: object
          required:
            - billing_cycle
            - invoice_details
          properties:
            type:
              type: string
            name:
              type: string
            starts_at:
              type: string
            ends_at:
              type: string
            billing_cycle:
              type: object
            invoice_details:
              type: object
              required:
                - code
                - seller
                - buyer
                - payment
                - currency
        - $ref: '#/components/schemas/CreateSubscriptionRequestBase'
    CreateIntervalCycle:
      allOf:
        - required:
            - step
            - count
          properties:
            type:
              description: The billing cycle set in monthly or yearly intervals.
            step:
              type: string
              description: |
                The interval of the billing cycle.

                - `month` - The billing cycle is based on a monthly interval, the invoice will be issued every `count` months at the beginning of the month.
                - `year` - The billing cycle is based on a yearly interval, the invoice will be issued every `count` years at the beginning of the year.
              enum:
                - month
                - year
            count:
              type: integer
              description: The number of intervals between each billing cycle.
              minimum: 1
        - $ref: '#/components/schemas/BillingCycleBase'
    CreateCustomCycle:
      allOf:
        - required:
            - day_of_month
            - month_of_year
          properties:
            type:
              description: The custom cycle for the billing cycle. It supports a subset of the cron syntax. Use `*` to indicate all values, `1,2,3` to indicate a list of values, and `1-3` to indicate a range of values.
            day_of_month:
              $ref: '#/components/schemas/CustomCycleDayOfMonth'
            month_of_year:
              $ref: '#/components/schemas/CustomCycleMonthOfYear'
        - $ref: '#/components/schemas/BillingCycleBase'
    CreateSubscriptionBillingCycle:
      description: |
        The billing cycle object, it is used to configure when an invoice should be issued.
        It allows to select the date on which the invoice should be issued, we garantee that the invoice will be issued on the selected date but not at any specified time.
        We support two types of billing cycles: `interval` and `custom`:

        - `interval`, the billing cycle is based on a fixed interval aligned with the 1st of January.
        - `custom`, the billing cycle is based on a custom schedule, define using [crontab expressions](https://en.wikipedia.org/wiki/Cron) and it can be aligned with any day of the year.
      anyOf:
        - $ref: '#/components/schemas/CreateIntervalCycle'
        - $ref: '#/components/schemas/CreateCustomCycle'
      discriminator:
        propertyName: type
        mapping:
          interval: '#/components/schemas/CreateIntervalCycle'
          custom: '#/components/schemas/CreateCustomCycle'
    FixedSeries:
      type: object
      required:
        - series_id
      allOf:
        - $ref: '#/components/schemas/SubscriptionInvoiceCodeBase'
        - properties:
            series_id:
              $ref: '#/components/schemas/InvoicesSeriesId'
    SubscriptionInvoiceCodeBase:
      type: object
      description: The code configuration of the generated invoices. A fixed series unique identifier will allow to issue invoices up until the end of the validity date of the series.
      required:
        - type
      properties:
        type:
          type: string
          description: The type of the code configuration for the invoices.
          enum:
            - fixed_series
    SubscriptionInvoiceCode:
      allOf:
        - $ref: '#/components/schemas/FixedSeries'
      discriminator:
        propertyName: type
        mapping:
          fixed_series: '#/components/schemas/FixedSeries'
    SubscriptionTerms:
      description: |
        The terms of the subscription invoice.

        * `deferred` - Deferred after an amount of days.
      anyOf:
        - $ref: '#/components/schemas/TermsDeferred'
      discriminator:
        propertyName: type
        mapping:
          deferred: '#/components/schemas/TermsDeferred'
    InvoiceDetailsBase:
      type: object
      description: The details used to issue invoices as part of the subscription.
      properties:
        code:
          $ref: '#/components/schemas/SubscriptionInvoiceCode'
        seller:
          type: object
        buyer:
          type: object
        currency:
          $ref: '#/components/schemas/Currency'
        groups:
          $ref: '#/components/schemas/CreateInvoiceGroups'
        lines:
          $ref: '#/components/schemas/CreateInvoiceLines'
        payment:
          type: object
          required:
            - terms
            - methods
          description: Information on when, how, and to whom the invoice should be paid.
          properties:
            terms:
              $ref: '#/components/schemas/SubscriptionTerms'
            methods:
              $ref: '#/components/schemas/PaymentMethods'
        documents:
          type: array
          description: Invoice documents to generate.
          items:
            type: object
            description: Invoice document to generate.
            required:
              - type
              - format
            properties:
              type:
                type: string
                description: Document that will be generated using the data in the request.
                const: invoice
              format:
                $ref: '#/components/schemas/InvoiceDocumentFormat'
        external_links:
          $ref: '#/components/schemas/InvoiceExternalLinks'
        metadata:
          $ref: '#/components/schemas/InvoiceMetadata'
        notes:
          $ref: '#/components/schemas/InvoiceNotes'
        urls:
          type: object
          description: URLs that are used throughout the invoice process.
          properties:
            webhook:
              allOf:
                - $ref: '#/components/schemas/Url'
                - description: |
                    The webhook endpoint to which events for this subscription and all invoices issued for it will be sent to.

                    If omitted, webhooks will not be sent.
    CreateInvoiceDetails:
      allOf:
        - $ref: '#/components/schemas/InvoiceDetailsBase'
        - type: object
          properties:
            seller:
              type: object
              required:
                - id
              description: |
                The taxable entity supplying the goods or services.

                **Note:** The related account needs to have `issue_invoices` capability activated.
              properties:
                id:
                  example: acc_4b5zswqg8kshx9zxdxa5g5c4wm
                  $ref: '#/components/schemas/AccountId'
                metadata:
                  $ref: '#/components/schemas/InvoiceAccountMetadata'
            buyer:
              type: object
              required:
                - id
              description: |
                The legal entity receiving the goods or services.

                **Note:** The related account needs to have `receive_invoices` capability activated.
              properties:
                id:
                  example: acc_4w5az89g1p9dy9st7qe3rgstm7
                  $ref: '#/components/schemas/AccountId'
                notifications:
                  $ref: '#/components/schemas/InvoiceBuyerNotifications'
                metadata:
                  $ref: '#/components/schemas/InvoiceAccountMetadata'
    CreateSubscriptionRequestBase:
      type: object
      required:
        - type
        - name
      properties:
        type:
          $ref: '#/components/schemas/SubscriptionType'
        name:
          $ref: '#/components/schemas/SubscriptionName'
        starts_at:
          $ref: '#/components/schemas/SubscriptionStartsAt'
          description: The date on which the subscription should start. The value must be aligned with the billing cycle, it must be the first day of any future occurrence of the billing cycle. If not provided the value will be computed to be the first day of the next billing cycle.
        ends_at:
          $ref: '#/components/schemas/SubscriptionEndsAt'
          description: The date on which the subscription should end. The value must be aligned with the billing cycle, it must be the last day of any future occurrence of the billing cycle. If not provided the subscription will continue indefinitely.
        billing_cycle:
          $ref: '#/components/schemas/CreateSubscriptionBillingCycle'
        invoice_details:
          $ref: '#/components/schemas/CreateInvoiceDetails'
    CreateSubscriptionRequest:
      allOf:
        - $ref: '#/components/schemas/CreateSubscriptionRequestCustom'
      discriminator:
        propertyName: type
        mapping:
          custom: '#/components/schemas/CreateSubscriptionRequestCustom'
    DateTimeOffset:
      type: string
      format: date-time-offset
      description: Refer to RFC 3339 date-time with Time Zone Offset https://www.rfc-editor.org/rfc/rfc9557.html
      minLength: 25
      maxLength: 25
      example: '2023-09-01T22:05:48-08:00'
    CreateSubscriptionResponse:
      type: object
      required:
        - id
      properties:
        id:
          $ref: '#/components/schemas/SubscriptionId'
        starts_at:
          $ref: '#/components/schemas/DateTimeOffset'
          description: The date on which the subscription starts including the offset of the seller's timezone.
    GetSubscriptionResponseCustom:
      allOf:
        - required:
            - billing_cycle
            - invoice_details
          properties:
            type:
              type: string
            name:
              type: string
            version:
              type: string
            starts_at:
              type: string
            ends_at:
              type: string
            next_issue_at:
              type: string
            billing_cycle:
              type: object
            invoice_details:
              required:
                - code
                - seller
                - buyer
                - payment
                - currency
        - $ref: '#/components/schemas/GetSubscriptionResponseBase'
    GetInvoiceDetails:
      allOf:
        - $ref: '#/components/schemas/InvoiceDetailsBase'
        - type: object
          properties:
            seller:
              type: object
              required:
                - id
                - legal_name
              properties:
                id:
                  example: acc_4b5zswqg8kshx9zxdxa5g5c4wm
                  $ref: '#/components/schemas/AccountId'
                legal_name:
                  example: ACME Corp.
                  $ref: '#/components/schemas/AccountLegalName'
                metadata:
                  $ref: '#/components/schemas/InvoiceAccountMetadata'
            buyer:
              type: object
              required:
                - id
                - legal_name
              description: |
                The legal entity receiving the goods or services.

                **Note:** The related account needs to have `receive_invoices` capability activated.
              properties:
                id:
                  example: acc_4w5az89g1p9dy9st7qe3rgstm7
                  $ref: '#/components/schemas/AccountId'
                legal_name:
                  example: Wildcat Pumps Inc.
                  $ref: '#/components/schemas/AccountLegalName'
                notifications:
                  $ref: '#/components/schemas/InvoiceBuyerNotifications'
                metadata:
                  $ref: '#/components/schemas/InvoiceAccountMetadata'
    InvoiceIssuedAt:
      type: string
      format: date-time
      example: '2023-02-10T14:16:07.6962864Z'
      description: The date and time when the invoice was issued.
    GetSubscriptionResponseBase:
      allOf:
        - required:
            - type
            - name
            - version
            - starts_at
            - invoices
          properties:
            type:
              type: string
            name:
              type: string
            version:
              $ref: '#/components/schemas/EntityVersion'
              description: The version of the subscription.
            starts_at:
              type: string
            ends_at:
              type: string
            next_issue_at:
              type: string
            billing_cycle:
              type: object
            invoice_details:
              $ref: '#/components/schemas/GetInvoiceDetails'
            invoices:
              type: array
              description: List of invoices issued as part of the subscription.
              uniqueItems: true
              items:
                type: object
                required:
                  - id
                  - code
                  - issued_at
                properties:
                  id:
                    $ref: '#/components/schemas/InvoiceId'
                  code:
                    $ref: '#/components/schemas/InvoiceCode'
                  issued_at:
                    $ref: '#/components/schemas/InvoiceIssuedAt'
        - $ref: '#/components/schemas/GetSubscriptionBase'
    GetSubscriptionResponse:
      anyOf:
        - $ref: '#/components/schemas/GetSubscriptionResponseCustom'
      discriminator:
        propertyName: type
        mapping:
          custom: '#/components/schemas/GetSubscriptionResponseCustom'
    UpdateSubscriptionRequestCustom:
      allOf:
        - type: object
          properties:
            type:
              type: string
            name:
              type: string
            ends_at:
              type: string
            effective_at:
              description: |
                Date when the new configuration will take effect. If not provided, the update will take effect on the next issued invoice.
                This value is used only if `invoice_details` is provided.
            invoice_details:
              description: |
                Invoice details for the subscription. If not provided, the subscription will keep the current invoice details. If provided, old the details will override the current configuration.
              required:
                - code
                - currency
                - payment
        - $ref: '#/components/schemas/UpdateSubscriptionRequestBase'
    UpdateInvoiceDetails:
      allOf:
        - $ref: '#/components/schemas/InvoiceDetailsBase'
        - type: object
          properties:
            seller:
              type: object
              description: |
                The taxable entity supplying the goods or services. Only metadata is allowed to be updated.
              properties:
                metadata:
                  $ref: '#/components/schemas/InvoiceAccountMetadata'
            buyer:
              type: object
              description: |
                The legal entity receiving the goods or services. Only notifications and metadata are allowed to be updated.
              properties:
                notifications:
                  $ref: '#/components/schemas/InvoiceBuyerNotifications'
                metadata:
                  $ref: '#/components/schemas/InvoiceAccountMetadata'
    UpdateSubscriptionRequestBase:
      type: object
      required:
        - type
      properties:
        type:
          $ref: '#/components/schemas/SubscriptionType'
        name:
          description: |
            The name of the subscription, used for descriptive purposes.
            This value is not affected by the `effective_at` date and it will be updated immediately. If not provider or empty, the name will not be updated.
          $ref: '#/components/schemas/SubscriptionName'
        ends_at:
          $ref: '#/components/schemas/Date'
          description: |
            The date on which the subscription should end.
            The value must be aligned with the billing cycle, it must be the last day of any future occurrence of the billing cycle.
            If not provided the subscription will continue indefinitely.
            This value is not affected by the `effective_at` date and it will be updated immediately. If not provider or empty, the subscription `ends_at` will not be updated.
        effective_at:
          $ref: '#/components/schemas/Date'
          example: '2024-01-01'
          description: |
            The date on which the `invoice_details` update should take effect.
            If not provided the update will take effect on the next issued invoice.
        invoice_details:
          $ref: '#/components/schemas/UpdateInvoiceDetails'
          description: |
            Full invoice details for the subscription.
            This value is affected by the `effective_at` date and it will be used to issue invoices after the effective date.
    UpdateSubscriptionRequest:
      allOf:
        - $ref: '#/components/schemas/UpdateSubscriptionRequestCustom'
      discriminator:
        propertyName: type
        mapping:
          custom: '#/components/schemas/UpdateSubscriptionRequestCustom'
    UpdateSubscriptionResponse:
      type: object
      required:
        - id
        - effective_at
      properties:
        id:
          $ref: '#/components/schemas/SubscriptionId'
        effective_at:
          $ref: '#/components/schemas/DateTimeOffset'
          description: The date on which the update is effective including the offset of the seller's timezone.
    GetLabelResponse:
      type: object
      required:
        - id
        - name
        - color
        - text
      properties:
        id:
          $ref: '#/components/schemas/LabelId'
        name:
          type: string
          description: |
            The name of the label.
          maxLength: 50
          example: Garage
        color:
          type: string
          format: hex-color
          description: |
            The color of the label.
            A hexadecimal color code.
          example: '#FF0000'
        text:
          type: string
          format: hex-color
          description: |
            The text color of the label.
            A hexadecimal color code.
          example: '#FFFFFF'
        description:
          type: string
          description: The description of the label.
          maxLength: 250
          example: This is a label description.
    CreateLabelRequest:
      type: object
      required:
        - name
        - color
      properties:
        name:
          type: string
          description: |
            The name of the label.
          maxLength: 50
          example: Garage
        color:
          type: string
          format: hex-color
          description: |
            The color of the label.
            A hexadecimal color code.
          example: '#FF0000'
        description:
          type: string
          description: The description of the label.
          maxLength: 250
          example: This is a label description.
    CreateLabelResponse:
      type: object
      required:
        - id
        - text
      properties:
        id:
          $ref: '#/components/schemas/LabelId'
        text:
          type: string
          format: hex-color
          description: |
            The text color of the label.
            A hexadecimal color code.
          example: '#FFFFFF'
    PaymentAdviceId:
      type: string
      description: The unique identifier of the payment advice.
      example: pad_4ehg1mkv3mvt3256vcn8dspb4h
      minLength: 30
      maxLength: 50
    PaymentAdviceInvoiceLinked:
      allOf:
        - required:
            - id
          properties:
            status:
              type: string
            id:
              $ref: '#/components/schemas/PaymentAdviceId'
        - $ref: '#/components/schemas/PaymentAdviceInvoiceBase'
    PaymentAdviceInvoiceNotFound:
      allOf:
        - $ref: '#/components/schemas/PaymentAdviceInvoiceBase'
    PaymentAdviceInvoiceBase:
      type: object
      required:
        - status
        - payment_advice_data
      description: The invoices that are included in the payment advice.
      properties:
        status:
          type: string
          description: Wether the invoice is linked or not.
          example: not_found
          enum:
            - linked
            - not_found
        payment_advice_data:
          type: object
          description: The invoice data that is included in the payment advice.
          required:
            - code
          properties:
            code:
              type: string
              description: The code of the invoice.
              example: INV-12345
            amount:
              $ref: '#/components/schemas/AmountMinor'
              description: The amount of the invoice.
            currency:
              $ref: '#/components/schemas/Currency'
              description: The currency of the invoice.
            issued_at:
              $ref: '#/components/schemas/Date'
              description: The date when the invoice was issued.
    PaymentAdviceInvoiceResponse:
      type: object
      description: The invoices that are included in the payment advice.
      anyOf:
        - $ref: '#/components/schemas/PaymentAdviceInvoiceLinked'
        - $ref: '#/components/schemas/PaymentAdviceInvoiceNotFound'
      discriminator:
        propertyName: status
        mapping:
          linked: '#/components/schemas/PaymentAdviceInvoiceLinked'
          not_found: '#/components/schemas/PaymentAdviceInvoiceNotFound'
    EmailConversationSource:
      type: object
      required:
        - id
        - type
        - email
      description: The source of the payment advice.
      properties:
        id:
          allOf:
            - $ref: '#/components/schemas/Id'
            - description: The unique identifier of the source.
            - example: emc_4ehg1mkv3mvt3256vcn8dspb4h
        type:
          type: string
          example: email_conversation
        email:
          type: object
          description: The email source of the payment advice.
          required:
            - id
            - from
            - to
            - subject
            - received_at
            - document
          properties:
            id:
              allOf:
                - $ref: '#/components/schemas/Id'
                - description: The unique identifier of the email.
                - example: eml_4ehg1mkv3mvt3256vcn8dspb4h
            from:
              type: string
              description: The email address of the sender.
              example: finance@garage.es
            to:
              type: string
              description: The email address of the receiver.
              example: finance@customer.es
            subject:
              type: string
              description: The subject of the email.
              example: Payment advice Notice
            received_at:
              $ref: '#/components/schemas/Date'
              description: The date when the email was received.
            document:
              type: object
              description: The document of the email.
              required:
                - id
                - format
              properties:
                id:
                  $ref: '#/components/schemas/DocumentId'
                format:
                  type: string
                  description: The format of the document.
                  enum:
                    - eml
                  example: eml
            attachments:
              type: array
              description: List of attachments.
              items:
                type: object
                required:
                  - id
                  - name
                  - format
                properties:
                  id:
                    $ref: '#/components/schemas/DocumentId'
                  name:
                    type: string
                    description: Name of the attachment.
                    example: payment_advice.pdf
                  format:
                    type: string
                    description: The format of the document.
                    enum:
                      - pdf
                      - eml
                      - csv
                      - doc
                      - docx
                      - jpeg
                      - png
                      - txt
                      - xls
                      - xlsx
                      - xml
                      - md
                      - svg
                    example: pdf
    GetPaymentAdviceResponse:
      type: object
      required:
        - id
        - seller
        - source
      properties:
        id:
          $ref: '#/components/schemas/PaymentAdviceId'
        seller:
          type: object
          description: The seller information.
          required:
            - id
            - name
          properties:
            id:
              $ref: '#/components/schemas/AccountId'
              description: The unique identifier of the seller.
            name:
              type: string
              description: The name of the seller.
              example: Getpaid.
        total_amount:
          $ref: '#/components/schemas/AmountMinor'
          description: The total amount that will be paid.
        currency:
          $ref: '#/components/schemas/Currency'
        payment:
          type: object
          description: The payment information.
          properties:
            occurred_at:
              $ref: '#/components/schemas/Date'
              description: The date when the payment was made.
            reference:
              type: string
              description: The reference of the payment.
              example: PA-123456
        invoices:
          type: array
          description: The invoices that are included in the payment advice.
          minItems: 1
          uniqueItems: true
          items:
            $ref: '#/components/schemas/PaymentAdviceInvoiceResponse'
        source:
          description: The source of the payment advice.
          anyOf:
            - $ref: '#/components/schemas/EmailConversationSource'
          discriminator:
            propertyName: type
            mapping:
              email_conversation: '#/components/schemas/EmailConversationSource'
    PaymentInstrumentStatus:
      type: string
      description: The [status](#tag/Payment-Instruments/Statuses) of the payment instrument.
      enum:
        - active
        - inactive
    GetBankAccountResponse:
      allOf:
        - properties:
            id:
              type: string
            type:
              type: string
            account_number:
              type: object
        - $ref: '#/components/schemas/CreatePaymentInstrumentResponse'
        - $ref: '#/components/schemas/BankAccount'
        - required:
            - status
          properties:
            status:
              $ref: '#/components/schemas/PaymentInstrumentStatus'
    BankAccountConsentListResponse:
      allOf:
        - type: object
          required:
            - bank_account_authorization_id
          properties:
            bank_account_authorization_id:
              $ref: '#/components/schemas/BankAccountAuthorizationId'
        - $ref: '#/components/schemas/BankAccountConsent'
    CreatePaymentInstrumentResponse:
      type: object
      required:
        - id
        - open_banking
        - account
      properties:
        id:
          $ref: '#/components/schemas/PaymentInstrumentId'
        bank:
          type: object
          description: |
            The bank information.

            It could be empty because this field is computed from the account number and it could not be found.
          required:
            - type
            - name
            - country
            - urls
          properties:
            type:
              type: string
              enum:
                - aibbank
                - bankofireland
                - bbva
                - caixabank
                - unicaja
            name:
              type: string
              description: The friendly name of the bank.
              example: CaixaBank
            country:
              $ref: '#/components/schemas/Country'
            urls:
              type: object
              description: URLs to point to extra resources.
              required:
                - logo
                - icon
              properties:
                logo:
                  type: string
                  description: URL pointing to the imagotype including letters and the icon of the bank.
                  format: uri
                  maxLength: 1024
                icon:
                  type: string
                  description: URL pointing to the isotype including the icon of the bank.
                  format: uri
                  maxLength: 1024
        open_banking:
          type: object
          description: The Open Banking information.
          required:
            - supported
            - features
          properties:
            supported:
              type: boolean
              description: Defines whether Open Banking connectivity is supported or not.
            features:
              type: object
              description: Defines the relationship between Open Banking connection and getpaid features.
              required:
                - invoices_reconciliation
              properties:
                invoices_reconciliation:
                  type: object
                  description: The information related to reconciliate invoices.
                  required:
                    - status
                    - required_permissions
                  properties:
                    enabled:
                      type: string
                      description: Defines whether the feature is enabled.
                    status:
                      type: string
                      description: |
                        The feature status.

                        * `disabled` - The feature is currently turned off and inactive.
                        * `pending` - The feature is in a transitional state awaiting some form of approval, processing, or additional steps before it can be fully activated or used.
                        * `authorized` - The feature is fully active and available for use. All necessary conditions and approvals have been met.
                      enum:
                        - disabled
                        - pending
                        - authorized
                    required_permissions:
                      $ref: '#/components/schemas/BankAccountConsentPermissions'
                    consent:
                      $ref: '#/components/schemas/BankAccountConsentListResponse'
        account:
          $ref: '#/components/schemas/AccountRef'
    PaymentInstrumentBase:
      type: object
      description: The payment instrument type.
      required:
        - type
      properties:
        type:
          type: string
          description: The type of payment instrument.
    BankAccount:
      allOf:
        - $ref: '#/components/schemas/PaymentInstrumentBase'
        - required:
            - type
            - account_number
          properties:
            account_number:
              $ref: '#/components/schemas/BankAccountNumber'
    GetPaymentInstrumentResponse:
      anyOf:
        - $ref: '#/components/schemas/GetBankAccountResponse'
      discriminator:
        propertyName: type
        mapping:
          bank_account: '#/components/schemas/GetBankAccountResponse'
    ListPaymentInstrumentsResponse:
      type: object
      required:
        - data
      properties:
        data:
          description: The list of payment instruments.
          type: array
          items:
            $ref: '#/components/schemas/GetPaymentInstrumentResponse'
    CreateBankAccount:
      allOf:
        - required:
            - account
            - type
            - account_number
          properties:
            account:
              type: object
              required:
                - id
              properties:
                id:
                  $ref: '#/components/schemas/AccountId'
        - $ref: '#/components/schemas/BankAccount'
        - description: The bank account.
    CreatePaymentInstrumentRequest:
      anyOf:
        - $ref: '#/components/schemas/CreateBankAccount'
      discriminator:
        propertyName: type
        mapping:
          bank_account: '#/components/schemas/CreateBankAccount'
    PaymentTermStatus:
      type: string
      enum:
        - unmatched
        - suggested
        - confirmed
    PaymentTermSeller:
      type: object
      required:
        - id
        - legal_name
      properties:
        id:
          $ref: '#/components/schemas/AccountId'
        legal_name:
          $ref: '#/components/schemas/AccountLegalName'
      example:
        id: acc_47e65jz5b52mqfgk586mtf674m
        legal_name: Acme Corporation
    PaymentTermBuyer:
      type: object
      required:
        - id
        - legal_name
      properties:
        id:
          $ref: '#/components/schemas/AccountId'
        legal_name:
          $ref: '#/components/schemas/AccountLegalName'
    PaymentTermInvoice:
      type: object
      description: The invoice the payment term belongs to.
      required:
        - id
        - type
        - code
        - seller
        - buyer
      properties:
        id:
          $ref: '#/components/schemas/InvoiceId'
        type:
          $ref: '#/components/schemas/InvoiceType'
        code:
          description: The invoice code.
          $ref: '#/components/schemas/InvoiceCode'
        seller:
          description: The seller account issuing the invoice.
          $ref: '#/components/schemas/PaymentTermSeller'
        buyer:
          description: The buyer account receiving the invoice.
          $ref: '#/components/schemas/PaymentTermBuyer'
    PaymentTermBase:
      type: object
      required:
        - id
        - status
        - seller
        - invoice
        - number
        - due_at
        - amount
        - currency
      properties:
        id:
          $ref: '#/components/schemas/PaymentTermId'
        status:
          $ref: '#/components/schemas/PaymentTermStatus'
        invoice:
          $ref: '#/components/schemas/PaymentTermInvoice'
        number:
          description: The payment term number based on due dates.
          type: integer
          example: 1
        due_at:
          description: The due date of the payment term.
          $ref: '#/components/schemas/DateTime'
        amount:
          $ref: '#/components/schemas/AmountMinor'
        currency:
          $ref: '#/components/schemas/Currency'
    TransactionId:
      type: string
      description: The unique identifier of a transaction.
      example: trx_3775b2af2e13402d919a1f3f64b2a3f8
      minLength: 30
      maxLength: 50
    PaymentTermTransactionBase:
      type: object
      required:
        - id
        - amount
        - currency
        - booking_at
      properties:
        id:
          $ref: '#/components/schemas/TransactionId'
        amount:
          description: The amount of the suggested or matched transaction.
          $ref: '#/components/schemas/AmountMinor'
        currency:
          description: The currency of the suggested or matched transaction.
          $ref: '#/components/schemas/Currency'
        booking_at:
          description: The booking date of the suggested or matched transaction.
          $ref: '#/components/schemas/DateTime'
        description:
          description: The description of the suggested or matched transaction.
          example: Payment for July invoice
          type: string
    PaymentTerm:
      type: object
      allOf:
        - $ref: '#/components/schemas/PaymentTermBase'
        - required:
            - transactions
          properties:
            transactions:
              type: object
              description: |
                The list of transactions associated with the payment term. The list contains the matched transactions and the suggested transactions.
              required:
                - suggested
                - matched
              properties:
                suggested:
                  description: A list of suggested transactions. If the payment term status is unmatched, the field is empty. If the payment term status is suggested, the field contains an array with the suggested transaction.
                  type: array
                  maxItems: 1
                  items:
                    $ref: '#/components/schemas/PaymentTermTransactionBase'
                matched:
                  description: |
                    List of matched transactions. If the payment term status is unmatched, the field is empty. If the payment term status is confirmed, the list contains at least one transaction.
                  type: array
                  maxItems: 1
                  items:
                    $ref: '#/components/schemas/PaymentTermTransactionBase'
    PaymentTermPaymentMethod:
      type: object
      description: The payment method used for the payment term.
      required:
        - type
      properties:
        type:
          type: string
          description: The payment method type.
          enum:
            - external_bank_transfer
            - external_direct_debit
    GetPaymentTermResponseTransaction:
      type: object
      allOf:
        - $ref: '#/components/schemas/PaymentTermTransactionBase'
        - properties:
            payment_method:
              description: The payment method used for the transaction.
              $ref: '#/components/schemas/PaymentTermPaymentMethod'
            counterparty:
              description: The counterparty of the transaction.
              $ref: '#/components/schemas/BankTransactionParty'
    PaymentTermTransactions:
      type: object
      description: |
        The list of transactions associated with the payment term. The list contains the matched transactions and the suggested transactions.
      required:
        - suggested
        - matched
      properties:
        suggested:
          description: A list of suggested transactions. If the payment term status is unmatched, the field is empty. If the payment term status is suggested, the field contains an array with the suggested transaction.
          type: array
          maxItems: 1
          items:
            $ref: '#/components/schemas/GetPaymentTermResponseTransaction'
        matched:
          description: |
            List of matched transactions. If the payment term status is unmatched, the field is empty. If the payment term status is confirmed, the list contains at least one transaction.
          type: array
          maxItems: 1
          items:
            $ref: '#/components/schemas/GetPaymentTermResponseTransaction'
    PaymentTermEventBase:
      type: object
      required:
        - type
        - id
        - occurred_at
      description: The events of the payment term.
      properties:
        type:
          type: string
          enum:
            - created
            - match_suggested
            - match_confirmed
            - match_rejected
          description: |
            Type of events.
            * `created` - The payment term has been created.
            * `match_suggested` - The payment term has a suggested transaction.
            * `match_confirmed` - A match has been confirmed.
            * `match_rejected` - A match has been rejected.
        id:
          $ref: '#/components/schemas/EventId'
        occurred_at:
          $ref: '#/components/schemas/OccurredAt'
    GetPaymentTermResponse:
      type: object
      required:
        - payment_method
        - invoice
        - transactions
        - events
      allOf:
        - $ref: '#/components/schemas/PaymentTermBase'
        - properties:
            invoice:
              allOf:
                - $ref: '#/components/schemas/PaymentTermInvoice'
                - required:
                    - issued_at
                    - payment_methods
                  properties:
                    issued_at:
                      description: The date and time when the invoice has been issued.
                      $ref: '#/components/schemas/DateTime'
                    payment_methods:
                      minItems: 1
                      $ref: '#/components/schemas/PaymentMethods'
            transactions:
              $ref: '#/components/schemas/PaymentTermTransactions'
            events:
              description: |
                The list of events associated with the payment term.
              type: array
              items:
                $ref: '#/components/schemas/PaymentTermEventBase'
    UserReference:
      type: string
      description: The reference of the user.
      example: user@getpaid.io
      maxLength: 320
    ChatId:
      type: string
      description: Unique identifier of the chat.
      example: cht_4wpgcp0z7q76j18sw9kr3a9w5q
    CreatedAt:
      allOf:
        - $ref: '#/components/schemas/DateTime'
          description: The date on which the chat is created.
    ChatName:
      type: string
      description: The name of the chat.
      example: Chat One
      maxLength: 100
    ChatUser:
      type: object
      description: The user that creates the chat.
      required:
        - reference
      properties:
        reference:
          $ref: '#/components/schemas/UserReference'
    MessageType:
      type: string
      description: |
        The type of the message. The possible values are:
        * `assistant` - Message sent by the assistant.
        * `user` - Message sent by the user.
      enum:
        - assistant
        - user
    SentAt:
      allOf:
        - $ref: '#/components/schemas/DateTimeOffset'
          description: The date on which the message is sent.
    MessageContent:
      type: string
      description: The content of the chat message.
      example: Hello, can you help me?
      maxLength: 5000
    EventType:
      type: string
      description: |
        Type of events that can be triggered by the event stream while it's opened.
        * `delta` - The assistant has sent a new update on the content message.
        * `completed` - The assistant completed the response.
      enum:
        - delta
        - completed
      example: delta
    EventDataBase:
      type: object
      required:
        - event
        - data
      properties:
        event:
          $ref: '#/components/schemas/EventType'
        data:
          type: object
          description: The event data.
    Delta:
      allOf:
        - $ref: '#/components/schemas/EventDataBase'
        - type: object
          properties:
            data:
              type: object
              required:
                - content
              properties:
                content:
                  $ref: '#/components/schemas/MessageContent'
    Completed:
      allOf:
        - $ref: '#/components/schemas/EventDataBase'
    MessageResponse:
      type: object
      anyOf:
        - $ref: '#/components/schemas/Delta'
        - $ref: '#/components/schemas/Completed'
      discriminator:
        propertyName: event
        mapping:
          delta: '#/components/schemas/Delta'
          completed: '#/components/schemas/Completed'
    WebhookBaseRequest:
      type: object
      required:
        - id
        - type
        - version
        - occurred_at
        - data
      properties:
        id:
          allOf:
            - $ref: '#/components/schemas/Id'
            - description: The unique identifier of the event.
              example: evt_4r8t310nhp2mferdc1waa07s5d
        type:
          type: string
          description: The type of event.
        version:
          type: string
          description: The version of the event type.
          const: v2
          example: v2
        occurred_at:
          $ref: '#/components/schemas/DateTime'
          description: The UTC date and time at which the event occurred.
        data:
          type: object
          description: The event data specific to each event type and version.
  parameters:
    PaginationFirst:
      name: first
      in: query
      schema:
        type: integer
        default: 10
        minimum: 1
        maximum: 100
      description: Pagination. The number of elements that will be retrieved.
    PaginationAfter:
      name: after
      in: query
      schema:
        type: string
        maxLength: 250
      description: Pagination. The `cursor` from next page will be retrieved.
    IdempotencyKey:
      name: Getpaid-Idempotency-Key
      in: header
      description: |
        An idempotency key to allow safe retrying without the operation being performed multiple times.
        The value should be unique for each operation, e.g., a UUID, with the same key being sent on a retry of the same request.
      schema:
        type: string
        minLength: 10
        maxLength: 100
        pattern: ^[a-zA-Z0-9_-]{10,100}$
        example: 5c255194-30ec-11ed-a261-0242ac120002
    TraceId:
      name: Getpaid-Trace-Id
      in: header
      description: The trace identifier for the webhook. It is a good idea to log this and provide it with any support requests.
      schema:
        type: string
        example: 96ce50247f87f540bb2d86771b3728b8
  headers:
    TraceId:
      description: The trace identifier for the request. It is a good idea to log this and provide it with any support requests
      schema:
        type: string
        example: 96ce50247f87f540bb2d86771b3728b8
    ContentDisposition:
      description: See [Content-Disposition header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition) for more info.
      schema:
        type: string
        example: attachment; filename=INV-20240119-0001.pdf; filename*=UTF-8''INV-20240119-0001.pdf
  responses:
    BadRequest:
      description: Bad Request
      headers:
        Getpaid-Trace-Id:
          $ref: '#/components/headers/TraceId'
    Unauthorized:
      description: Unauthorized
      headers:
        Getpaid-Trace-Id:
          $ref: '#/components/headers/TraceId'
    ProblemInvalidParameters:
      description: Invalid Parameters
      headers:
        Getpaid-Trace-Id:
          $ref: '#/components/headers/TraceId'
      content:
        application/problem+json:
          schema:
            allOf:
              - $ref: '#/components/schemas/Problem'
              - type: object
                required:
                  - errors
                properties:
                  errors:
                    type: object
                    description: The JSON path of any request body fields or header names that are invalid with a description of the error
                    additionalProperties:
                      type: array
                      items:
                        type: string
                    example:
                      currency:
                        - currency_invalid
                  type:
                    example: https://docs.getpaid.io/overview/getting-started#422---invalid-parameters
                  title:
                    example: Invalid Parameters
                  status:
                    example: 422
    TooManyRequests:
      description: Too Many Requests
      headers:
        Getpaid-Trace-Id:
          $ref: '#/components/headers/TraceId'
    InternalServerError:
      description: Internal Server Error
      headers:
        Getpaid-Trace-Id:
          $ref: '#/components/headers/TraceId'
    ProblemConflict:
      description: Conflict
      headers:
        Getpaid-Trace-Id:
          $ref: '#/components/headers/TraceId'
      content:
        application/problem+json:
          schema:
            allOf:
              - $ref: '#/components/schemas/Problem'
              - type: object
                properties:
                  type:
                    example: https://docs.getpaid.io/overview/getting-started#409---conflict
                  title:
                    example: Conflict
                  status:
                    example: 409
                  detail:
                    example: Request cannot be completed due to the current state of the server
    ProblemNotFound:
      description: Not Found
      headers:
        Getpaid-Trace-Id:
          $ref: '#/components/headers/TraceId'
      content:
        application/problem+json:
          schema:
            allOf:
              - $ref: '#/components/schemas/Problem'
              - type: object
                properties:
                  type:
                    example: https://docs.getpaid.io/overview/getting-started#404---not-found
                  title:
                    example: Not Found
                  status:
                    example: 404
    NoContent:
      description: No Content
      headers:
        Getpaid-Trace-Id:
          $ref: '#/components/headers/TraceId'
    ContentTooLarge:
      description: Content Too Large
      headers:
        Getpaid-Trace-Id:
          $ref: '#/components/headers/TraceId'
  examples:
    UploadBankTransactionsDocument:
      summary: Upload Bank Transaction Document
      value: |
        POST /v2alpha1/bank_transactions/documents HTTP/1.1
        Host: api.getpaid.io
        Content-Length: 296
        Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW

        ----WebKitFormBoundary7MA4YWxkTrZu0gW
        Content-Disposition: form-data; name="file"; filename="AEB43_20240805.csv"
    GetBankTransactionsImportsResponse:
      summary: Import jobs
      description: The list of bank transactions files import jobs.
      value:
        cursor: Y3Vyc29yIHBhZ2luYXRpb24gZXhhbXBsZQ
        data:
          - id: bti_48qfw22ns0pdrf8hzhff5r0vn6
            status: pending
            document:
              id: doc_48z12x496symye6pkejeme4g43
              name: AEB43_20240802.csv
              uploaded_at: '2024-08-03T17:24:32.563Z'
          - id: bti_4dt3s8c9jpw1n07g3ydw6gwmng
            status: validated
            document:
              id: doc_4fsz2c3j6w0b2bnznae0hf2kmj
              name: AEB43_20240803.csv
              uploaded_at: '2024-08-04T15:12:56.783Z'
              format: aeb43
              transactions_date: '2024-08-02'
          - id: xpt_4ehg1mkv3mvt3256vcn8dspb4h
            status: completed
            document:
              id: doc_422j710b4cd581cz0j5degtg45
              name: AEB43_20240805.csv
              uploaded_at: '2024-08-06T14:42:55.035Z'
              format: aeb43
              transactions_date: '2024-08-02'
            summary:
              matched: 95
              unmatched: 5
              total: 100
          - id: bti_4efqn5r3fkyffcawxpy34b5jxm
            status: error
            document:
              id: doc_4cqy9eax1defqeeet8t1fq40cn
              name: AEB43_20240806.csv
              uploaded_at: '2024-08-07T13:32:15.937Z'
            reason:
              code: file_integrity_failed
              description: The bank transactions file is not in the correct format.
    GetBankTransactionsImportPendingResponse:
      summary: Pending import job
      description: The import job is still being validated.
      value:
        id: bti_48qfw22ns0pdrf8hzhff5r0vn6
        status: pending
        document:
          id: doc_48z12x496symye6pkejeme4g43
          name: AEB43_20240805.csv
          uploaded_at: '2024-08-06T17:24:32.563Z'
    GetBankTransactionsImportValidatedResponse:
      summary: Validated import job
      description: The import job is starting the process of the file after its successful validation.
      value:
        id: bti_4dt3s8c9jpw1n07g3ydw6gwmng
        status: validated
        document:
          id: doc_4fsz2c3j6w0b2bnznae0hf2kmj
          name: AEB43_20240805.csv
          uploaded_at: '2024-08-06T15:12:56.783Z'
          format: aeb43
          transactions_date: '2024-08-02'
    GetBankTransactionsImportCompletedResponse:
      summary: Completed import job
      description: The import process finished and the transactions were processed.
      value:
        id: xpt_4ehg1mkv3mvt3256vcn8dspb4h
        status: completed
        document:
          id: doc_422j710b4cd581cz0j5degtg45
          name: AEB43_20240805.csv
          uploaded_at: '2024-08-06T14:42:55.035Z'
          format: aeb43
          transactions_date: '2024-08-02'
        summary:
          matched: 95
          unmatched: 5
          total: 100
    GetBankTransactionsImportErrorResponse:
      summary: Failed export job
      description: The export job failed.
      value:
        id: bti_4efqn5r3fkyffcawxpy34b5jxm
        status: error
        document:
          id: doc_4cqy9eax1defqeeet8t1fq40cn
          name: AEB43_20240805.csv
          uploaded_at: '2024-08-06T13:32:15.937Z'
        reason:
          code: file_integrity_failed
          description: The bank transactions file is not in the correct format.
    CreateStandardInvoiceRequestProvidedCode:
      summary: Standard with provided code
      value:
        type: standard
        code:
          type: provided
          value: 2023-00837
        reference: d8732571-7945-41c1-be1d-f3a71c5a36b2
        seller:
          id: acc_44678r08jtm8zbt227tzhc4nw5
        buyer:
          id: acc_4w5az89g1p9dy9st7qe3rgstm7
          notifications:
            - type: email
              to:
                - invoices@seller.com
        currency: EUR
        groups:
          - reference: pieces
            name: Piezas
            lines:
              - item:
                  reference: 1POC082709ABC
                  name: Filtro aceite
                  amount: 1581
                  unit: item
                  metadata:
                    family: Filtros
                    manufacturer: Bosch
                quantity: 1
                discounts:
                  - type: percentage
                    percent: 20
                taxes:
                  - type: percentage
                    name: IVA
                    percent: 21
                    reference: vat
                notes:
                  - Filtros Bosch
              - item:
                  reference: '1049360'
                  name: Aceite motor
                  amount: 1050
                  unit: litre
                  metadata:
                    family: Aceites
                    manufacturer: Wolf
                quantity: 3.9
                charges:
                  - type: fixed
                    amount: 500
                    reference: URGENT
                    name: Entrega Urgente
                taxes:
                  - type: percentage
                    name: IVA
                    percent: 21
                    reference: vat
                notes:
                  - Aceites Wolf
          - reference: labour_cost
            name: Mano de obra
            lines:
              - item:
                  name: Sustituir Aceite motor / Sustituir Filtro aceite
                  amount: 3025
                  unit: hour
                quantity: 0.2
                taxes:
                  - type: percentage
                    name: IVA
                    percent: 21
                    reference: vat
              - item:
                  name: Comprobar filtro aire ** Limpiar si es necesario
                  amount: 3025
                  unit: hour
                quantity: 0.1
                taxes:
                  - type: percentage
                    name: IVA
                    percent: 21
                    reference: vat
        lines:
          - item:
              name: BOLSA REGALO
              amount: 500
              unit: item
            quantity: 1
            discounts:
              - type: percentage
                percent: 100
                reference: VOUCHER
                name: Cupón - BLACKFRIDAY
            taxes:
              - type: percentage
                name: IVA
                percent: 21
                reference: vat
          - item:
              name: Alinear dirección
              amount: 4000
              unit: hour
            quantity: 1
            discounts:
              - type: percentage
                percent: 0
            taxes:
              - type: percentage
                name: IVA
                percent: 21
                reference: vat
        payment:
          terms:
            type: due_date
            due_dates:
              - due_at: '2023-10-01T22:05:48.479Z'
          methods:
            - type: external_bank_transfer
              payment_instrument_id: pai_4mjfmtdf13eg5bdvsky11fyqxm
        documents:
          - format: pdf
        external_links:
          - name: Order
            url: https://seller.com/orders/98f445bd-1316-4d6c-9243-f6b9d9192ef8
        metadata:
          vehicle: ford focus
          plate: 1111XXX
        notes:
          - Vehículo Ford Focus
          - Matrícula 1111XXX
    CreateStandardInvoiceRequestGeneratedCode:
      summary: Standard with generated code
      value:
        type: standard
        code:
          type: generated
          series_id: ser_4ehg1mkv3mvt3256vcn8dspb4h
        reference: 3264b587-c5e1-4650-92ec-25d592fe5520
        seller:
          id: acc_44678r08jtm8zbt227tzhc4nw5
        buyer:
          id: acc_4w5az89g1p9dy9st7qe3rgstm7
          notifications:
            - type: email
              to:
                - invoices@seller.com
        currency: EUR
        groups:
          - reference: pieces
            name: Piezas
            lines:
              - item:
                  reference: 1POC082709ABC
                  name: Filtro aceite
                  amount: 1581
                  unit: item
                  metadata:
                    family: Filtros
                    manufacturer: Bosch
                quantity: 1
                discounts:
                  - type: percentage
                    percent: 20
                taxes:
                  - type: percentage
                    name: IVA
                    percent: 21
                    reference: vat
                notes:
                  - Filtros Bosch
              - item:
                  reference: '1049360'
                  name: Aceite motor
                  amount: 1050
                  unit: litre
                  metadata:
                    family: Aceites
                    manufacturer: Wolf
                quantity: 3.9
                charges:
                  - type: fixed
                    amount: 500
                    reference: URGENT
                    name: Entrega Urgente
                taxes:
                  - type: percentage
                    name: IVA
                    percent: 21
                    reference: vat
                notes:
                  - Aceites Wolf
          - reference: labour_cost
            name: Mano de obra
            lines:
              - item:
                  name: Sustituir Aceite motor / Sustituir Filtro aceite
                  amount: 3025
                  unit: hour
                quantity: 0.2
                taxes:
                  - type: percentage
                    name: IVA
                    percent: 21
                    reference: vat
              - item:
                  name: Comprobar filtro aire ** Limpiar si es necesario
                  amount: 3025
                  unit: hour
                quantity: 0.1
                taxes:
                  - type: percentage
                    name: IVA
                    percent: 21
                    reference: vat
        lines:
          - item:
              name: BOLSA REGALO
              amount: 500
              unit: item
            quantity: 1
            discounts:
              - type: percentage
                percent: 100
                reference: VOUCHER
                name: Cupón - BLACKFRIDAY
            taxes:
              - type: percentage
                name: IVA
                percent: 21
                reference: vat
          - item:
              name: Alinear dirección
              amount: 4000
              unit: hour
            quantity: 1
            discounts:
              - type: percentage
                percent: 0
            taxes:
              - type: exempt
                name: IVA
            reference: vat
        payment:
          terms:
            type: due_date
            due_dates:
              - due_at: '2023-10-01T22:05:48.479Z'
          methods:
            - type: external_bank_transfer
              payment_instrument_id: pai_4mjfmtdf13eg5bdvsky11fyqxm
        documents:
          - format: pdf
        external_links:
          - name: Order
            url: https://seller.com/orders/98f445bd-1316-4d6c-9243-f6b9d9192ef8
        metadata:
          vehicle: ford focus
          plate: 1111XXX
        notes:
          - Vehículo Ford Focus
          - Matrícula 1111XXX
    CreateCorrectiveInvoiceRequestProvidedCode:
      summary: Corrective with provided code
      value:
        type: corrective
        code:
          type: provided
          value: R-2023-00008
        reference: cb9c4823-6255-472d-967b-99c2b2705f61
        correction_options:
          type: complete
        precedings:
          - id: inv_4ehg1mkv3mvt3256vcn8dspb4h
            reason: Corrección de cantidades unitarias
        buyer:
          notifications:
            - type: email
              to:
                - invoices@seller.com
        groups:
          - reference: pieces
            name: Piezas
            lines:
              - item:
                  reference: 1POC082709ABC
                  name: Filtro aceite
                  amount: 1581
                  unit: item
                  metadata:
                    family: Filtros
                    manufacturer: Bosch
                quantity: 1
                discounts:
                  - type: percentage
                    percent: 20
                taxes:
                  - type: percentage
                    name: IVA
                    percent: 21
                    reference: vat
                notes:
                  - Filtros Bosch
              - item:
                  reference: '1049360'
                  name: Aceite motor
                  amount: 1050
                  unit: litre
                  metadata:
                    family: Aceites
                    manufacturer: Wolf
                quantity: 3.9
                charges:
                  - type: fixed
                    amount: 500
                    reference: URGENT
                    name: Entrega Urgente
                taxes:
                  - type: percentage
                    name: IVA
                    percent: 21
                    reference: vat
                notes:
                  - Aceites Wolf
          - reference: labour_cost
            name: Mano de obra
            lines:
              - item:
                  name: Sustituir Aceite motor / Sustituir Filtro aceite
                  amount: 3025
                  unit: hour
                quantity: 0.2
                taxes:
                  - type: percentage
                    name: IVA
                    percent: 21
                    reference: vat
              - item:
                  name: Comprobar filtro aire ** Limpiar si es necesario
                  amount: 3025
                  unit: hour
                quantity: 0.1
                taxes:
                  - type: percentage
                    name: IVA
                    percent: 21
                    reference: vat
        lines:
          - item:
              name: BOLSA REGALO
              amount: 500
              unit: item
            quantity: 1
            discounts:
              - type: percentage
                percent: 100
                reference: VOUCHER
                name: Cupón - BLACKFRIDAY
            taxes:
              - type: percentage
                name: IVA
                percent: 21
                reference: vat
          - item:
              name: Alinear dirección
              amount: 4000
              unit: hour
            quantity: 1
            discounts:
              - type: percentage
                percent: 0
            taxes:
              - type: percentage
                name: IVA
                percent: 21
                reference: vat
        payment:
          terms:
            type: due_date
            due_dates:
              - due_at: '2023-10-01T22:05:48.479Z'
          methods:
            - type: external_bank_transfer
              payment_instrument_id: pai_4mjfmtdf13eg5bdvsky11fyqxm
        documents:
          - format: pdf
        external_links:
          - name: Order
            url: https://seller.com/orders/98f445bd-1316-4d6c-9243-f6b9d9192ef8
        metadata:
          vehicle: ford focus
          plate: 1111XXX
        notes:
          - Vehículo Ford Focus
          - Matrícula 1111XXX
    CreateCorrectiveInvoiceRequestGeneratedCode:
      summary: Corrective with generated code
      value:
        type: corrective
        code:
          type: generated
          series_id: ser_4ehg1mkv3mvt3256vcn8dspb4h
        reference: 3264b587-c5e1-4650-92ec-25d592fe5520
        correction_options:
          type: complete
        precedings:
          - id: inv_4ehg1mkv3mvt3256vcn8dspb4h
            reason: Corrección de cantidades unitarias
        buyer:
          notifications:
            - type: email
              to:
                - invoices@seller.com
        groups:
          - reference: pieces
            name: Piezas
            lines:
              - item:
                  reference: 1POC082709ABC
                  name: Filtro aceite
                  amount: 1581
                  unit: item
                  metadata:
                    family: Filtros
                    manufacturer: Bosch
                quantity: 1
                discounts:
                  - type: percentage
                    percent: 20
                taxes:
                  - type: percentage
                    name: IVA
                    percent: 21
                    reference: vat
                notes:
                  - Filtros Bosch
              - item:
                  reference: '1049360'
                  name: Aceite motor
                  amount: 1050
                  unit: litre
                  metadata:
                    family: Aceites
                    manufacturer: Wolf
                quantity: 3.9
                charges:
                  - type: fixed
                    amount: 500
                    reference: URGENT
                    name: Entrega Urgente
                taxes:
                  - type: percentage
                    name: IVA
                    percent: 21
                    reference: vat
                notes:
                  - Aceites Wolf
          - reference: labour_cost
            name: Mano de obra
            lines:
              - item:
                  name: Sustituir Aceite motor / Sustituir Filtro aceite
                  amount: 3025
                  unit: hour
                quantity: 0.2
                taxes:
                  - type: percentage
                    name: IVA
                    percent: 21
                    reference: vat
              - item:
                  name: Comprobar filtro aire ** Limpiar si es necesario
                  amount: 3025
                  unit: hour
                quantity: 0.1
                taxes:
                  - type: percentage
                    name: IVA
                    percent: 21
                    reference: vat
        lines:
          - item:
              name: BOLSA REGALO
              amount: 500
              unit: item
            quantity: 1
            discounts:
              - type: percentage
                percent: 100
                reference: VOUCHER
                name: Cupón - BLACKFRIDAY
            taxes:
              - type: percentage
                name: IVA
                percent: 21
                reference: vat
          - item:
              name: Alinear dirección
              amount: 4000
              unit: hour
            quantity: 1
            discounts:
              - type: percentage
                percent: 0
            taxes:
              - type: percentage
                name: IVA
                percent: 21
                reference: vat
        payment:
          terms:
            type: due_date
            due_dates:
              - due_at: '2023-10-01T22:05:48.479Z'
          methods:
            - type: external_bank_transfer
              payment_instrument_id: pai_4mjfmtdf13eg5bdvsky11fyqxm
        documents:
          - format: pdf
        external_links:
          - name: Order
            url: https://seller.com/orders/98f445bd-1316-4d6c-9243-f6b9d9192ef8
        metadata:
          vehicle: ford focus
          plate: 1111XXX
        notes:
          - Vehículo Ford Focus
          - Matrícula 1111XXX
    CreatePartialCorrectiveInvoiceRequest:
      summary: Partial corrective
      value:
        type: corrective
        code:
          type: provided
          value: R-2023-00008
        reference: cb9c4823-6255-472d-967b-99c2b2705f61
        correction_options:
          type: partial
        precedings:
          - id: inv_4ehg1mkv3mvt3256vcn8dspb4h
            reason: Corrección parcial
        buyer:
          notifications:
            - type: email
              to:
                - invoices@seller.com
        lines:
          - item:
              name: BOLSA REGALO
              amount: 500
              unit: item
            quantity: 1
            discounts:
              - type: percentage
                percent: 100
                reference: VOUCHER
                name: Cupón - BLACKFRIDAY
            taxes:
              - type: percentage
                name: IVA
                percent: 21
                reference: vat
        payment:
          terms:
            type: due_date
            due_dates:
              - due_at: '2023-10-01T22:05:48.479Z'
          methods:
            - type: external_bank_transfer
              payment_instrument_id: pai_4mjfmtdf13eg5bdvsky11fyqxm
        documents:
          - format: pdf
        external_links:
          - name: Order
            url: https://seller.com/orders/98f445bd-1316-4d6c-9243-f6b9d9192ef8
        metadata:
          vehicle: ford focus
          plate: 1111XXX
        notes:
          - Vehículo Ford Focus
          - Matrícula 1111XXX
    CreateStandardInvoiceResponseProvidedCode:
      summary: Standard with provided code
      description: The code has been provided as an input and the invoice can be issued during creation.
      value:
        id: inv_4ehg1mkv3mvt3256vcn8dspb4h
        type: standard
        status: issued
        groups:
          - reference: pieces
            lines:
              - item:
                  reference: 1POC082709ABC
                  name: Filtro aceite
                base: 1265
                tax: 265
                total: 1530
              - item:
                  reference: '1049360'
                  name: Aceite motor
                base: 4595
                tax: 965
                total: 5560
          - reference: labour_cost
            lines:
              - item:
                  name: Sustituir Aceite motor / Sustituir Filtro aceite
                base: 605
                tax: 127
                total: 732
              - item:
                  name: Comprobar filtro aire ** Limpiar si es necesario
                base: 302
                tax: 64
                total: 366
        lines:
          - item:
              name: BOLSA REGALO
            base: 0
            tax: 0
            total: 0
          - item:
              name: Alinear dirección
            base: 4000
            tax: 840
            total: 4840
        payment:
          terms:
            type: due_date
            due_dates:
              - due_at: '2023-10-01T22:05:48.479Z'
                amount: 13028
        totals:
          tax: 2261
          taxes:
            - reference: vat
              percentages:
                - type: percentage
                  percent: 21
                  tax: 2261
                  base: 10767
              sum: 2261
          base: 10767
          total: 13028
    CreateStandardInvoiceResponseGeneratedCode:
      summary: Standard with generated code
      description: Status is initiated because the invoice will be issued when the code is generated.
      value:
        id: inv_43jf9c2thy58242h5ma3dh64dm
        type: standard
        status: initiated
        groups:
          - reference: pieces
            lines:
              - item:
                  reference: 1POC082709ABC
                  name: Filtro aceite
                base: 1265
                tax: 265
                total: 1530
              - item:
                  reference: '1049360'
                  name: Aceite motor
                base: 4595
                tax: 965
                total: 5560
          - reference: labour_cost
            lines:
              - item:
                  name: Sustituir Aceite motor / Sustituir Filtro aceite
                base: 605
                tax: 127
                total: 732
              - item:
                  name: Comprobar filtro aire ** Limpiar si es necesario
                base: 302
                tax: 64
                total: 366
        lines:
          - item:
              name: BOLSA REGALO
            tax: 0
            base: 0
            total: 0
          - item:
              name: Alinear dirección
            base: 4000
            total: 4000
        payment:
          terms:
            type: due_date
            due_dates:
              - due_at: '2023-10-01T22:05:48.479Z'
                amount: 12189
        totals:
          tax: 1421
          taxes:
            - reference: vat
              percentages:
                - percent: 21
                  tax: 1421
                  type: percentage
                  base: 6768
                - type: exempt
                  base: 4000
              sum: 1421
          base: 10768
          total: 12189
    CreateCorrectiveInvoiceResponseProvidedCode:
      summary: Corrective with provided code
      description: The code has been provided as an input and the invoice can be issued during creation.
      value:
        id: inv_4acf7aac20714d549b83261580
        type: corrective
        status: issued
        groups:
          - reference: pieces
            lines:
              - item:
                  reference: 1POC082709ABC
                  name: Filtro aceite
                base: 1265
                tax: 265
                total: 1530
              - item:
                  reference: '1049360'
                  name: Aceite motor
                base: 4595
                tax: 965
                total: 5560
          - reference: labour_cost
            lines:
              - item:
                  name: Sustituir Aceite motor / Sustituir Filtro aceite
                base: 605
                tax: 127
                total: 732
              - item:
                  name: Comprobar filtro aire ** Limpiar si es necesario
                base: 302
                tax: 64
                total: 366
        lines:
          - item:
              name: BOLSA REGALO
            base: 0
            tax: 0
            total: 0
          - item:
              name: Alinear dirección
            base: 4000
            tax: 840
            total: 4840
        payment:
          terms:
            type: due_date
            due_dates:
              - due_at: '2023-10-01T22:05:48.479Z'
                amount: 13028
        totals:
          tax: 2261
          taxes:
            - reference: vat
              percentages:
                - type: percentage
                  percent: 21
                  tax: 2261
                  base: 10767
              sum: 2261
          base: 10767
          total: 13028
    CreateCorrectiveInvoiceResponseGeneratedCode:
      summary: Corrective with generated code
      description: Status is initiated because the invoice will be issued when the code is generated.
      value:
        id: inv_4acf7aac20714d549b83261580
        type: corrective
        status: initiated
        groups:
          - reference: pieces
            lines:
              - item:
                  reference: 1POC082709ABC
                  name: Filtro aceite
                base: 1265
                tax: 265
                total: 1530
              - item:
                  reference: '1049360'
                  name: Aceite motor
                base: 4595
                tax: 965
                total: 5560
          - reference: labour_cost
            lines:
              - item:
                  name: Sustituir Aceite motor / Sustituir Filtro aceite
                base: 605
                tax: 127
                total: 732
              - item:
                  name: Comprobar filtro aire ** Limpiar si es necesario
                base: 302
                tax: 64
                total: 366
        lines:
          - item:
              name: BOLSA REGALO
            base: 0
            tax: 0
            total: 0
          - item:
              name: Alinear dirección
            base: 4000
            tax: 840
            total: 4840
        payment:
          terms:
            type: due_date
            due_dates:
              - due_at: '2023-10-01T22:05:48.479Z'
                amount: 13028
        totals:
          tax: 2261
          taxes:
            - reference: vat
              percentages:
                - type: percentage
                  percent: 21
                  tax: 2261
                  base: 10767
              sum: 2261
          base: 10767
          total: 13028
    GetInvoicesExportPendingResponse:
      summary: Pending export job
      description: The export job is still in progress.
      value:
        id: xpt_4ehg1mkv3mvt3256vcn8dspb4h
        status: pending
    GetInvoicesExportCompletedResponse:
      summary: Completed export job
      description: The export process finished and the invoices export file can be downloaded.
      value:
        id: xpt_4ehg1mkv3mvt3256vcn8dspb4h
        status: completed
        report:
          id: rpt_470g1mkv3mvt3256vcn8dspb4h
          url: https://api.getpaid.io/v2alpha1/invoices/reports/rpt_470g1mkv3mvt3256vcn8dspb4h
          expires_at: '2023-09-01T22:05:48.479Z'
    GetInvoicesExportErrorResponse:
      summary: Failed export job
      description: The export job failed.
      value:
        id: xpt_4ehg1mkv3mvt3256vcn8dspb4h
        status: error
    UploadInvoiceDocument:
      summary: Upload Invoice Document
      value: |
        POST /v2alpha1/invoices/documents HTTP/1.1
        Host: api.getpaid.io
        Content-Length: 296
        Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW

        ----WebKitFormBoundary7MA4YWxkTrZu0gW
        Content-Disposition: form-data; name="file"; filename="details.csv"
        Content-Type: text/csv
    ListSubscriptions:
      summary: List subscriptions
      description: List existing subscriptions.
      value:
        cursor: Y3Vyc29yIHBhZ2luYXRpb24gZXhhbXBsZQ
        data:
          - id: sub_4mk9y6c2v46953j37qkc0vranw
            type: custom
            name: Monthly SAAS subscription
            starts_at: '2023-09-01'
            ends_at: '2023-09-01'
            billing_cycle:
              type: interval
              expression: 0 12 1 * * *
              step: month
              count: 1
            invoice_details:
              seller:
                id: acc_44678r08jtm8zbt227tzhc4nw5
                legal_name: ACME Corp.
              buyer:
                id: acc_4w5az89g1p9dy9st7qe3rgstm7
                legal_name: Wildcat Pumps GmbH
          - id: sub_44678r08jtm8zbt227tzhc4nw5
            type: custom
            name: Monthly SAAS subscription
            starts_at: '2023-09-01'
            ends_at: '2023-09-01'
            billing_cycle:
              type: custom
              expression: 0 0 0 17 * ?
              day_of_month: '17'
              month_of_year: '*'
            invoice_details:
              seller:
                id: acc_44678r08jtm8zbt227tzhc4nw5
                legal_name: ACME Corp.
              buyer:
                id: acc_4w5az89g1p9dy9st7qe3rgstm7
                legal_name: Wildcat Pumps GmbH
    CreateSubscriptionCustom:
      summary: Custom subscription
      value:
        type: custom
        name: Monthly SAAS subscription
        billing_cycle:
          type: interval
          step: month
          count: 1
        invoice_details:
          code:
            type: fixed_series
            series_id: ser_4ehg1mkv3mvt3256vcn8dspb4h
          seller:
            id: acc_44678r08jtm8zbt227tzhc4nw5
          buyer:
            id: acc_4w5az89g1p9dy9st7qe3rgstm7
            notifications:
              - type: email
                to:
                  - invoices@buyer.com
          currency: EUR
          groups:
            - reference: pieces
              name: Pieces
              lines:
                - item:
                    reference: 1POC082709ABC
                    name: Oil filter
                    amount: 1581
                    unit: item
                    metadata:
                      family: Filters
                      manufacturer: Bosch
                  quantity: 1
                  discounts:
                    - type: percentage
                      percent: 20
                  taxes:
                    - type: percentage
                      name: VAT
                      percent: 21
                      reference: vat
                  notes:
                    - Bosch filters
                - item:
                    reference: '1049360'
                    name: Motor oil
                    amount: 1050
                    unit: litre
                    metadata:
                      family: Oils
                      manufacturer: Wolf
                  quantity: 3.9
                  charges:
                    - type: fixed
                      amount: 500
                      reference: URGENT
                      name: Urgent shipping
                  taxes:
                    - type: percentage
                      name: VAT
                      percent: 21
                      reference: vat
                  notes:
                    - Wolf Oils
            - reference: labour_cost
              name: Labour costs
              lines:
                - item:
                    name: Motor oil and oil filter change
                    amount: 3025
                    unit: hour
                  quantity: 0.2
                  taxes:
                    - type: percentage
                      name: VAT
                      percent: 21
                      reference: vat
                - item:
                    name: Check air filter ** Clean air filter if needed
                    amount: 3025
                    unit: hour
                  quantity: 0.1
                  taxes:
                    - type: percentage
                      name: VAT
                      percent: 21
                      reference: vat
          lines:
            - item:
                name: GIFT BAG
                amount: 500
                unit: item
              quantity: 1
              discounts:
                - type: percentage
                  percent: 100
                  reference: VOUCHER
                  name: Voucher - BLACKFRIDAY
              taxes:
                - type: percentage
                  name: VAT
                  percent: 21
                  reference: vat
            - item:
                name: Align direction
                amount: 4000
                unit: hour
              quantity: 1
              discounts:
                - type: percentage
                  percent: 0
              taxes:
                - type: percentage
                  name: VAT
                  percent: 21
                  reference: vat
          payment:
            terms:
              type: deferred
              due_dates:
                - days: 30
            methods:
              - type: external_bank_transfer
                payment_instrument_id: pai_4mjfmtdf13eg5bdvsky11fyqxm
          documents:
            - format: pdf
          external_links:
            - name: Order
              url: https://seller.com/orders/98f445bd-1316-4d6c-9243-f6b9d9192ef8
          metadata:
            vehicle: Ford Focus
            plate: 1111XXX
          notes:
            - Model Ford Focus
            - Plate 1111XXX
    GetSubscription:
      summary: Get subscription
      description: Get subscription details.
      value:
        type: custom
        name: Monthly SAAS subscription
        version: '20240702153523123'
        starts_at: '2023-09-01T22:05:48-08:00'
        ends_at: '2023-09-01T22:05:48-08:00'
        billing_cycle:
          type: interval
          expression: 0 0 0 1 */1 ?
          step: month
          count: 1
        invoice_details:
          code:
            type: fixed_series
            series_id: ser_4ehg1mkv3mvt3256vcn8dspb4h
          seller:
            id: acc_44678r08jtm8zbt227tzhc4nw5
            legal_name: ACME Corp.
          buyer:
            id: acc_4w5az89g1p9dy9st7qe3rgstm7
            legal_name: Wildcat Bump Inc.
            notifications:
              - type: email
                to:
                  - invoices@buyer.com
          currency: EUR
          groups:
            - reference: pieces
              name: Pieces
              lines:
                - item:
                    reference: 1POC082709ABC
                    name: Oil filter
                    amount: 1581
                    unit: item
                    metadata:
                      family: Filters
                      manufacturer: Bosch
                  quantity: 1
                  discounts:
                    - type: percentage
                      percent: 20
                  taxes:
                    - type: percentage
                      name: VAT
                      percent: 21
                      reference: vat
                  notes:
                    - Bosch filters
                - item:
                    reference: '1049360'
                    name: Motor oil
                    amount: 1050
                    unit: litre
                    metadata:
                      family: Oils
                      manufacturer: Wolf
                  quantity: 3.9
                  charges:
                    - type: fixed
                      amount: 500
                      reference: URGENT
                      name: Urgent shippint
                  taxes:
                    - type: percentage
                      name: VAT
                      percent: 21
                      reference: vat
                  notes:
                    - Wolf oils
            - reference: labour_cost
              name: Labour costs
              lines:
                - item:
                    name: Motor oil and oil filter change
                    amount: 3025
                    unit: hour
                  quantity: 0.2
                  taxes:
                    - name: VAT
                      percent: 21
                      reference: vat
                - item:
                    name: Check air filter ** Clean air filter if needed
                    amount: 3025
                    unit: hour
                  quantity: 0.1
                  taxes:
                    - type: percentage
                      name: VAT
                      percent: 21
                      reference: vat
          lines:
            - item:
                name: GIFT BAG
                amount: 500
                unit: item
              quantity: 1
              discounts:
                - type: percentage
                  percent: 100
                  reference: VOUCHER
                  name: Voucher - BLACKFRIDAY
              taxes:
                - type: percentage
                  name: VAT
                  percent: 21
                  reference: vat
            - item:
                name: Align direction
                amount: 4000
                unit: hour
              quantity: 1
              discounts:
                - type: percentage
                  percent: 0
              taxes:
                - type: percentage
                  name: VAT
                  percent: 21
                  reference: vat
          payment:
            terms:
              type: due_date
              due_dates:
                - due_at: 30
            methods:
              - type: external_bank_transfer
                payment_instrument_id: pai_4mjfmtdf13eg5bdvsky11fyqxm
          documents:
            - format: pdf
          external_links:
            - name: Order
              url: https://seller.com/orders/98f445bd-1316-4d6c-9243-f6b9d9192ef8
          metadata:
            vehicle: Ford Focus
            plate: 1111XXX
          notes:
            - Model Ford Focus
            - Plate 1111XXX
        invoices:
          - id: inv_4ehg1mkv3mvt3256vcn8dspb4h
            code: INV_20240000001
            issued_at: '2023-09-01T22:05:48.479Z'
    UpdateSubscriptionCustom:
      summary: Custom subscription
      value:
        type: custom
        name: Monthly SAAS subscription
        effective_at: '2024-01-01'
        invoice_details:
          code:
            type: fixed_series
            series_id: ser_4ehg1mkv3mvt3256vcn8dspb4h
          buyer:
            notifications:
              - type: email
                to:
                  - invoices@buyer.com
          currency: EUR
          groups:
            - reference: pieces
              name: Pieces
              lines:
                - item:
                    reference: 1POC082709ABC
                    name: Oil filter
                    amount: 1581
                    unit: item
                    metadata:
                      family: Filters
                      manufacturer: Bosch
                  quantity: 1
                  discounts:
                    - type: percentage
                      percent: 20
                  taxes:
                    - type: percentage
                      name: VAT
                      percent: 21
                      reference: vat
                  notes:
                    - Bosch filters
                - item:
                    reference: '1049360'
                    name: Motor oil
                    amount: 1050
                    unit: litre
                    metadata:
                      family: Oils
                      manufacturer: Wolf
                  quantity: 3.9
                  charges:
                    - type: fixed
                      amount: 500
                      reference: URGENT
                      name: Urgent shipping
                  taxes:
                    - type: percentage
                      name: VAT
                      percent: 21
                      reference: vat
                  notes:
                    - Wolf oils
            - reference: labour_cost
              name: Labour costs
              lines:
                - item:
                    name: Motor oil and oil filter change
                    amount: 3025
                    unit: hour
                  quantity: 0.2
                  taxes:
                    - type: percentage
                      name: VAT
                      percent: 21
                      reference: vat
                - item:
                    name: Check air filter ** Clean air filter if needed
                    amount: 3025
                    unit: hour
                  quantity: 0.1
                  taxes:
                    - type: percentage
                      name: VAT
                      percent: 21
                      reference: vat
          lines:
            - item:
                name: GIFT BAG
                amount: 500
                unit: item
              quantity: 1
              discounts:
                - type: percentage
                  percent: 100
                  reference: VOUCHER
                  name: Voucher - BLACKFRIDAY
              taxes:
                - type: percentage
                  name: VAT
                  percent: 21
                  reference: vat
            - item:
                name: Align direction
                amount: 4000
                unit: hour
              quantity: 1
              discounts:
                - type: percentage
                  percent: 0
              taxes:
                - type: percentage
                  name: VAT
                  percent: 21
                  reference: vat
          payment:
            terms:
              type: deferred
              due_dates:
                - days: 30
            methods:
              - type: external_bank_transfer
                payment_instrument_id: pai_4mjfmtdf13eg5bdvsky11fyqxm
          documents:
            - format: pdf
          external_links:
            - name: Order
              url: https://seller.com/orders/98f445bd-1316-4d6c-9243-f6b9d9192ef8
          metadata:
            vehicle: Ford Focus
            plate: 1111XXX
          notes:
            - Model Ford Focus
            - Plate 1111XXX
    UploadChatDocument:
      summary: Upload Chat Document
      value: |
        POST /v2alpha1/chats/cht_4wpgcp0z7q76j18sw9kr3a9w5q/documents HTTP/1.1
        Host: api.getpaid.io
        Content-Length: 296
        Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW

        ----WebKitFormBoundary7MA4YWxkTrZu0gW
        Content-Disposition: form-data; name="file"; filename="payment.pdf"
        Content-Type: application/pdf
x-tagGroups:
  - name: General
    tags:
      - Authentication
  - name: Accounts
    tags:
      - Accounts
      - Account Links
      - Bank Account Authorizations
      - Invoices Series
      - Labels
      - Payment Instruments
      - Taxes
  - name: Invoicing
    tags:
      - Invoices
      - Invoice Documents
      - Invoices Reports
      - Invoice Webhooks
      - Subscriptions
  - name: Reconciliation
    tags:
      - Bank Transactions
      - Bank Transactions Enrichment
      - Bank Transactions Enrichment Webhooks
      - Payment Advices
      - Payment Advice Documents
      - Payment Terms
