{
    "swagger": "2.0",
    "info": {
        "title": "Invoice Tools API",
        "description": "Waya/Inkassogram invoice and tools API.\n\nClient side code can be generated using the Swagger/OpenAPI specification, see more information [here](https://swagger.io/tools/swagger-codegen/).\n\n---\n## Standard definitions\n- Country codes in [ISO 3166-1 alpha 2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2), for example `SE`.\n- Language codes in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes). Note: `sv`=Swedish, `se`=Northern Sami.\n- Currency codes in [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217), for example `SEK`.\n- Dates and timestamps in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601), for example `2020-12-31` for dates and `2020-12-31T20:30:00+01:00` for timestamps. Assumes UTC for timestamps in requests if no timezone given.\n\n---\n## API modifications\nNew fields will be added to both request and response models when needed, but no new mandatory fields will be added without prior notice. To avoid problems when new fields are added to responses, ensure the client code does not throw errors when unexpected fields are detected.\n\nNew values for enums might also be added when needed. Ensure these unexpected values can still be handled without error. For example, if generating Java code using the Swagger generator, the config `enumUnknownDefaultCase` can be set to true in order to automatically add an extra enum value that will be used for unexpected future enum values returned by the API.\n\n---\n## Error handling\nWhen there is an error, a unique error code will be returned which can be referenced when contacting our support for quicker help. However, the first part of the error code, for example `319-2-4`, can be used to programmatically identify different errors. As a rule of thumb, errors starting with `319-2` are caused by user input and those starting with `319-3` are due to malformed API requests.\n\nExample error response, details fields may be null:\n```json\n{\n    \"errorCode\": \"319-2-4-1704965684\",\n    \"message\": \"Not found\",\n    \"details\": \"No invoice with that ID\"\n}\n```\nDefined error codes:\n|HTTP|Code|Description|\n|:--|:--|:--|\n|400|319-3-1|Schema validation error|\n|500|319-1-2|Unexpected error, try again - Try again in a little while, if the problem persists then contact Waya's technical support.|\n|400|319-3-3|Unsupported - Request required features no longer supported by the system or features no longer enabled for integration or client.|\n|404|319-2-4|Not found|\n|401|319-2-5|Unauthorized|\n|403|319-2-46|Forbidden resource - Valid authentication, but making a request not allow by current permissions set on integration.|\n|400|319-2-6|Already exists - When creating a resource, a resource with specified ID already exists.|\n|400|319-3-46|Inactive channel - If invoice channel is not active yet or has been disabled and thus cannot accept invoices.|\n|400|319-2-7|Invalid debtor - Debtor is not valid, usually due to invalid national identifier.|\n|400|319-2-8|Blocked debtor|\n|400|319-3-9|Delivery method unavailable for creditor|\n|400|319-2-10|Delivery method unavailable for debtor - Usually due to delivery method requiring debtor to opt in.|\n|400|319-3-11|Invalid invoice date|\n|400|319-3-12|Invalid due date|\n|400|319-3-13|Invalid delivery date|\n|400|319-3-14|Missing email address|\n|400|319-2-15|Invalid email address|\n|400|319-2-16|Blocked email address|\n|400|319-2-17|Invalid email CC address|\n|400|319-2-18|Invalid email BCC address|\n|400|319-3-19|Missing phone number|\n|400|319-2-20|Invalid phone number|\n|400|319-2-21|Invalid discount|\n|400|319-3-22|Sum row validation error|\n|400|319-3-23|Sum total validation error|\n|400|319-2-24|Price too low|\n|400|319-2-25|Price too high|\n|400|319-3-26|Row mismatch|\n|400|319-3-27|Invoice not found - When referencing an invalid invoice in a request.|\n|400|319-2-32|Invalid currency|\n|400|319-2-33|Invalid exchange rate|\n|400|319-3-36|Invalid process step|\n|400|319-3-37|Invalid country|\n|400|319-2-38|Credit limit reached|\n|400|319-3-39|Invalid fee|\n|400|319-3-40|Invalid interest|\n|400|319-3-41|Invalid file size|\n|400|319-3-42|Invalid file type|\n|400|319-3-43|Invalid file hash|\n|400|319-2-44|Invalid reservation|\n|400|319-2-45|Invalid invoice state - Request requires the invoice to be in another state, for example when trying to delete an invoice but it has already been sent to the debtor.|\n|400|319-2-47|Invalid attachment - One or more of the PDF attachments are invalid|\n|400|319-2-48|Invalid tax reduction row - One or more of the tax reduction rows are invalid|\n|400|319-2-49|Fraud protection - Individual is marked for fraud protected and care should be taken to ensure the identity of the individual|\n|400|319-2-50|Deregistered or deleted - Legal entity has been deleted or deregistered in national registry|\n|400|319-2-51|Invalid legal entity - Legal entity exists, but data cannot be retrieved from national registry due to their status|\n\n\n---\n## Invoice delivery methods\nThere are multiple ways to deliver debits and credits to the debtor. Only some delivery methods might be available, depending on configuration.\n\n| Name | Description |\n| :--- | :--- |\n| `DO_NOT_SEND` | Will generate a PDF, but not distribute it to the debtor. Invoice PDF can be downloaded and distributed using a 3rd party. |\n| `EXTERNAL` | Does not generate a PDF. Integration creates and distributes their own version of the invoice. |\n| `EMAIL` | Distributes as email. |\n| `POSTAL` | Distributes as letter. |\n| `E_INVOICE_COMPANY` | Only if debor is an organization, distributes directly to the debtor's ERP system. Sends using given GLN, otherwise tries using their national identifier. |\n| `E_INVOICE_BANK` | Distributes directly to the debtor's bank, but only if the debtor has opted in. |\n| `E_INVOICE` | Combination of `E_INVOICE_BANK` and `E_INVOICE_COMPANY`, trying them in that order. |\n| `DIGITAL_MAILBOX` | Distributes to digital mailbox. |\n| `DYNAMIC` | Lets the system find an appropriate delivery method for the specific debtor. |\n\n---\n## Process status\nAll process steps are categorized into four general types: `INVOICE`, `DUNNING`, `COLLECTION` and `ENFORCEMENT`. Depending on product, country and creditor configuration, the invoice might have multiple dunning or collection steps. While new country-specific steps may be introduced, no additional general types will be added. Integrations should therefore handle statuses by evaluating the general type if an unrecognized, more country-specific step is returned by the API.\n\n| Specific | General | Description |\n| :--- | :--- | :--- |\n| `EXTERNAL_INVOICE` | `INVOICE` | Invoice was not created in Waya's system until it was overdue and next step might be either dunning or collection. |\n| `INVOICE` | `INVOICE` |  |\n| `REMINDER` | `DUNNING` |  |\n| `DEBT_COLLECTION` | `COLLECTION` |  |\n| `FINAL_NOTICE` | `COLLECTION` |  |\n| `KFM` | `ENFORCEMENT` | Kronofogdemyndigheten - Case has been handed over to the Swedish enforcement agency. |\n| `3PC` | `COLLECTION` | Third party collection - Case has been handed over to a third party for collection. |\n\n---\n## Entity IDs\nEntity IDs exposed by the API are guaranteed to be unique within the same entity type only. For example, invoice IDs are unique among invoices even if created by different integrations or creditors, but may collide with IDs of other entity types such as credits or financial reports. \n\n---\n## Webhooks\nThe system can send webhooks to an integration-defined endpoint whenever an entity is created or updated. As each webhook contains identifiers only, the receiving system is expected to fetch the full and current state of the entity via the API.\n\nExample payload of invoice webhook:\n```json\n{\n    \"type\": \"INVOICE\",\n    \"id\": \"oWh_LNipaGQ\",\n    \"creditorId\": \"QYKrdNSAw-c\"\n}\n```\n\n| Field | Description |\n| :--- | :--- |\n| `type` | Type of entity that was created or modified. Possible values are: `INVOICE`, `CREDIT`, `FINANCIAL_REPORT`, `FINANCIAL_REPORT_BUNDLE`. Each entity type can be configured to be sent to a specific endpoint or excluded entirely. Newly introduced webhook types are opt-in and will not be delivered to existing integrations by default. |\n| `id` | The ID of the invoice, credit, etc. |\n| `creditorId` | The ID of the creditor/client the entity belongs to. Necessary if the integration has access to multiple creditors. |\n\nStatic headers and/or additional static fields can be configured.",
        "version": "1.0.0"
    },
    "basePath": "/",
    "paths": {
        "/v4/rest/boarding/{id}": {
            "get": {
                "tags": [
                    "Boarding"
                ],
                "summary": "Get a boarding",
                "description": "Retrieves an ongoing or completed boarding of a new creditor.",
                "operationId": "getBoarding",
                "produces": [
                    "application/json"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "",
                        "required": true,
                        "type": "string"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "schema": {
                            "$ref": "#/definitions/BoardingResponse"
                        }
                    },
                    "404": {
                        "description": "Error",
                        "schema": {
                            "$ref": "#/definitions/ErrorResponse"
                        },
                        "examples": {
                            "application/json": {
                                "errorCode": "319-2-4-1705334108",
                                "message": "Not found",
                                "details": null
                            }
                        }
                    }
                }
            }
        },
        "/v4/rest/boarding/{boardingId}/document/{documentId}/pdf": {
            "get": {
                "tags": [
                    "Boarding"
                ],
                "summary": "Retrieve signed PDF file",
                "description": "",
                "operationId": "getBoardingDocumentPdf",
                "parameters": [
                    {
                        "name": "boardingId",
                        "in": "path",
                        "description": "",
                        "required": true,
                        "type": "string"
                    },
                    {
                        "name": "documentId",
                        "in": "path",
                        "description": "",
                        "required": true,
                        "type": "string"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "schema": {
                            "type": "string",
                            "format": "binary"
                        }
                    },
                    "404": {
                        "description": "Error",
                        "schema": {
                            "$ref": "#/definitions/ErrorResponse"
                        },
                        "examples": {
                            "application/json": {
                                "errorCode": "319-2-4-1705334108",
                                "message": "Not found",
                                "details": null
                            }
                        }
                    }
                }
            }
        },
        "/v4/rest/boarding/{boardingId}/document/{documentId}/attachment/{attachmentId}/file": {
            "get": {
                "tags": [
                    "Boarding"
                ],
                "summary": "Retrieve attached file",
                "description": "",
                "operationId": "getAttachmentFile",
                "parameters": [
                    {
                        "name": "boardingId",
                        "in": "path",
                        "description": "",
                        "required": true,
                        "type": "string"
                    },
                    {
                        "name": "documentId",
                        "in": "path",
                        "description": "",
                        "required": true,
                        "type": "string"
                    },
                    {
                        "name": "attachmentId",
                        "in": "path",
                        "description": "",
                        "required": true,
                        "type": "string"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "schema": {
                            "type": "string",
                            "format": "binary"
                        }
                    },
                    "404": {
                        "description": "Error",
                        "schema": {
                            "$ref": "#/definitions/ErrorResponse"
                        },
                        "examples": {
                            "application/json": {
                                "errorCode": "319-2-4-1705334108",
                                "message": "Not found",
                                "details": null
                            }
                        }
                    }
                }
            }
        },
        "/v4/rest/boarding/{boardingId}/document/{documentId}/signature": {
            "get": {
                "tags": [
                    "Boarding"
                ],
                "summary": "Get boarding document signatures",
                "description": "Retrieves the signatures for a specific boarding document.",
                "operationId": "getBoardingDocumentSignatures",
                "produces": [
                    "application/json"
                ],
                "parameters": [
                    {
                        "name": "boardingId",
                        "in": "path",
                        "description": "",
                        "required": true,
                        "type": "string"
                    },
                    {
                        "name": "documentId",
                        "in": "path",
                        "description": "",
                        "required": true,
                        "type": "string"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "schema": {
                            "$ref": "#/definitions/SignaturesResponse"
                        }
                    },
                    "404": {
                        "description": "Error",
                        "schema": {
                            "$ref": "#/definitions/ErrorResponse"
                        },
                        "examples": {
                            "application/json": {
                                "errorCode": "319-2-4-1705334108",
                                "message": "Not found",
                                "details": null
                            }
                        }
                    }
                }
            }
        },
        "/v4/rest/credit": {
            "get": {
                "tags": [
                    "Credit"
                ],
                "summary": "Find credits",
                "description": "Returns empty array and status code 200 if no results.",
                "operationId": "searchCredits",
                "produces": [
                    "application/json"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "query",
                        "description": "",
                        "required": false,
                        "type": "array",
                        "items": {
                            "type": "string"
                        },
                        "collectionFormat": "csv"
                    },
                    {
                        "name": "externalNumber",
                        "in": "query",
                        "description": "",
                        "required": false,
                        "type": "array",
                        "items": {
                            "type": "string"
                        },
                        "collectionFormat": "csv"
                    },
                    {
                        "name": "debitId",
                        "in": "query",
                        "description": "",
                        "required": false,
                        "type": "array",
                        "items": {
                            "type": "string"
                        },
                        "collectionFormat": "csv"
                    },
                    {
                        "name": "pageNumber",
                        "in": "query",
                        "description": "",
                        "required": false,
                        "type": "integer"
                    },
                    {
                        "name": "pageSize",
                        "in": "query",
                        "description": "",
                        "required": false,
                        "type": "integer"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "schema": {
                            "$ref": "#/definitions/CreditSearchResponse"
                        }
                    }
                }
            },
            "post": {
                "tags": [
                    "Credit"
                ],
                "summary": "Create a credit",
                "description": "Credit rows of a debit invoice.\n\nTo match against a debit, use exactly one of `debitId`, `debitOcr` or `debitExternalNumber`.",
                "operationId": "createCredit",
                "produces": [
                    "application/json"
                ],
                "parameters": [
                    {
                        "name": "body",
                        "in": "body",
                        "schema": {
                            "$ref": "#/definitions/NewCredit"
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Success",
                        "schema": {
                            "$ref": "#/definitions/CreditResponse"
                        }
                    },
                    "400": {
                        "description": "Error",
                        "schema": {
                            "$ref": "#/definitions/ErrorResponse"
                        },
                        "examples": {
                            "application/json": {
                                "errorCode": "319-3-26-1705338677",
                                "message": "Row mismatch",
                                "details": "No match for row #1"
                            }
                        }
                    }
                }
            }
        },
        "/v4/rest/credit/{id}": {
            "get": {
                "tags": [
                    "Credit"
                ],
                "summary": "Get a credit",
                "operationId": "getCredit",
                "produces": [
                    "application/json"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "",
                        "required": true,
                        "type": "string"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "schema": {
                            "$ref": "#/definitions/CreditResponse"
                        }
                    },
                    "404": {
                        "description": "Error",
                        "schema": {
                            "$ref": "#/definitions/ErrorResponse"
                        },
                        "examples": {
                            "application/json": {
                                "errorCode": "319-2-4-1705334108",
                                "message": "Not found",
                                "details": null
                            }
                        }
                    }
                }
            }
        },
        "/v4/rest/creditor/{id}": {
            "get": {
                "tags": [
                    "Creditor"
                ],
                "summary": "Get a creditor",
                "description": "Retrieves information about a specific creditor.",
                "operationId": "getCreditor",
                "produces": [
                    "application/json"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "",
                        "required": true,
                        "type": "string"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "schema": {
                            "$ref": "#/definitions/CreditorResponse"
                        }
                    },
                    "404": {
                        "description": "Error",
                        "schema": {
                            "$ref": "#/definitions/ErrorResponse"
                        },
                        "examples": {
                            "application/json": {
                                "errorCode": "319-2-4-1705334108",
                                "message": "Not found",
                                "details": null
                            }
                        }
                    }
                }
            },
            "patch": {
                "tags": [
                    "Creditor"
                ],
                "summary": "Patch a creditor",
                "operationId": "patchCreditor",
                "produces": [
                    "application/json"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "",
                        "required": true,
                        "type": "string"
                    },
                    {
                        "name": "body",
                        "in": "body",
                        "schema": {
                            "$ref": "#/definitions/PatchCreditor"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "schema": {
                            "$ref": "#/definitions/CreditorResponse"
                        }
                    },
                    "404": {
                        "description": "Error",
                        "schema": {
                            "$ref": "#/definitions/ErrorResponse"
                        },
                        "examples": {
                            "application/json": {
                                "errorCode": "319-2-4-1705334108",
                                "message": "Not found",
                                "details": null
                            }
                        }
                    }
                }
            }
        },
        "/v4/rest/direct-payment": {
            "post": {
                "tags": [
                    "Direct Payment"
                ],
                "summary": "Register a direct payment",
                "description": "Direct payments are payments made to the creditor rather than the system. In order for the debt to correctly be reduced, it must be registered using this method.\n\nIt is possible to allocate a payment across multiple invoices as once, however they must all have the same currency. It is also possible to allocate a negative sum, with the restriction that the total of all allocations registered at the same time must be at least 0.\n\nThe list of allocations in the response will be returned in the same order as the allocations in the request, but they also include the invoice ID for easier identification.\n\n## Notable error codes\n|HTTP|Code|Description|\n|:--|:--|:--|\n|400|319-2-6|Already exists - When creating a resource, a resource with specified ID already exists.|\n",
                "operationId": "registerDirectPayment",
                "produces": [
                    "application/json"
                ],
                "parameters": [
                    {
                        "name": "body",
                        "in": "body",
                        "schema": {
                            "$ref": "#/definitions/NewDirectPayment"
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Success",
                        "schema": {
                            "$ref": "#/definitions/DirectPaymentResponse"
                        }
                    },
                    "400": {
                        "description": "Error",
                        "schema": {
                            "$ref": "#/definitions/ErrorResponse"
                        },
                        "examples": {
                            "application/json": {
                                "errorCode": "319-2-6-1707808648",
                                "message": "Already exists",
                                "details": "Payment with reference '987' has already been registered"
                            }
                        }
                    }
                }
            }
        },
        "/v4/rest/financial-report-bundle/{id}": {
            "get": {
                "tags": [
                    "Financial Report Bundle"
                ],
                "summary": "Get a financial report bundle",
                "description": "",
                "operationId": "getFinancialReportBundle",
                "produces": [
                    "application/json"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "",
                        "required": true,
                        "type": "string"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "schema": {
                            "$ref": "#/definitions/FinancialReportBundleResponse"
                        }
                    }
                }
            }
        },
        "/v4/rest/financial-report-bundle/{id}/costs": {
            "get": {
                "tags": [
                    "Financial Report Bundle"
                ],
                "summary": "Get bundle costs",
                "description": "",
                "operationId": "getBundleCosts",
                "produces": [
                    "application/json"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "",
                        "required": true,
                        "type": "string"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "schema": {
                            "$ref": "#/definitions/BundleCostsResponse"
                        }
                    }
                }
            }
        },
        "/v4/rest/financial-report": {
            "get": {
                "tags": [
                    "Financial Report"
                ],
                "summary": "Find financial reports",
                "description": "Returns empty array and status code 200 if no results.",
                "operationId": "searchReports",
                "produces": [
                    "application/json"
                ],
                "parameters": [
                    {
                        "name": "type",
                        "in": "query",
                        "description": "",
                        "required": false,
                        "type": "array",
                        "items": {
                            "type": "string",
                            "enum": [
                                "SALES_NOTE",
                                "INSTANT_DEBT",
                                "TRANSACTION_LOG",
                                "LEDGER_ACCOUNTS_RECEIVABLE",
                                "LEDGER_ACCOUNT_BALANCE",
                                "ACCOUNT_ACTIVITY_STATEMENT",
                                "ACCOUNT_BOOKKEEPING_STATEMENT",
                                "UNALLOCATED_PAYMENTS_ACCOUNT_BALANCE",
                                "PURCHASES",
                                "REPURCHASES",
                                "CLIENT_SPECIFIC",
                                "PAYMENT_STATEMENT",
                                "RECONCILIATION",
                                "UNKNOWN_PAYMENTS",
                                "SURPLUS_PAYMENTS"
                            ]
                        },
                        "collectionFormat": "csv"
                    },
                    {
                        "name": "since",
                        "in": "query",
                        "description": "filter reports created after specified ISO timestamp",
                        "required": false,
                        "type": "string"
                    },
                    {
                        "name": "pageNumber",
                        "in": "query",
                        "description": "",
                        "required": false,
                        "type": "integer"
                    },
                    {
                        "name": "pageSize",
                        "in": "query",
                        "description": "",
                        "required": false,
                        "type": "integer"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "schema": {
                            "$ref": "#/definitions/FinancialReportSearchResponse"
                        }
                    }
                }
            }
        },
        "/v4/rest/financial-report/{id}/file": {
            "get": {
                "tags": [
                    "Financial Report"
                ],
                "summary": "Retrieve financial report file",
                "description": "",
                "operationId": "getReportFile",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "",
                        "required": true,
                        "type": "string"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "schema": {
                            "type": "string",
                            "format": "binary"
                        }
                    },
                    "404": {
                        "description": "Error",
                        "schema": {
                            "$ref": "#/definitions/ErrorResponse"
                        },
                        "examples": {
                            "application/json": {
                                "errorCode": "319-2-4-1705334108",
                                "message": "Not found",
                                "details": null
                            }
                        }
                    }
                }
            }
        },
        "/v4/rest/invoice": {
            "get": {
                "tags": [
                    "Invoice"
                ],
                "summary": "Find invoices",
                "description": "Returns empty array and status code 200 if no results.",
                "operationId": "searchInvoices",
                "produces": [
                    "application/json"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "query",
                        "description": "",
                        "required": false,
                        "type": "array",
                        "items": {
                            "type": "string"
                        },
                        "collectionFormat": "csv"
                    },
                    {
                        "name": "externalNumber",
                        "in": "query",
                        "description": "",
                        "required": false,
                        "type": "array",
                        "items": {
                            "type": "string"
                        },
                        "collectionFormat": "csv"
                    },
                    {
                        "name": "ocr",
                        "in": "query",
                        "description": "",
                        "required": false,
                        "type": "array",
                        "items": {
                            "type": "string"
                        },
                        "collectionFormat": "csv"
                    },
                    {
                        "name": "updatedSince",
                        "in": "query",
                        "description": "filter invoices updated after specified ISO timestamp",
                        "required": false,
                        "type": "string"
                    },
                    {
                        "name": "pageNumber",
                        "in": "query",
                        "description": "",
                        "required": false,
                        "type": "integer"
                    },
                    {
                        "name": "pageSize",
                        "in": "query",
                        "description": "",
                        "required": false,
                        "type": "integer"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "schema": {
                            "$ref": "#/definitions/InvoiceSearchResponse"
                        }
                    }
                }
            },
            "post": {
                "tags": [
                    "Invoice"
                ],
                "summary": "Create an invoice",
                "description": "Create invoices.\n\n## Debtor\n**NOTE** For valid formats of national identifiers, as well as a list of valid debtors to use when testing in non-production environments, see [lookup using national identifier](#get-/v4/rest/legal-entity/-country-code-/-national-identification-number-).\n\nThe minimum information needed about the debtor is their personal identification number or organization number. If no address is given, their registered address will be used:\n```json\n\"debtor\": {\n    \"nationalIdentifier\": {\n        \"number\": \"5590127725\",\n        \"countryCode\": \"SE\"\n    }\n}\n```\n\nTo send the invoice to a foreign debtor or to another address than their registered address, include an address:\n```json\n\"debtor\": {\n    \"nationalIdentifier\": {\n        \"number\": \"5590127725\",\n        \"countryCode\": \"SE\"\n    },\n    \"name\": \"Waya Technology AB\",\n    \"billingAddress\": {\n        \"lines\": [\n            \"Lilla Bommen 1\"\n        ],\n        \"postalCode\": \"41104\",\n        \"city\": \"G\u00f6teborg\",\n        \"countryCode\": \"SE\"\n    },\n    \"type\": \"ORGANIZATION\"\n}\n```\n\n## Invoice rows\nA row without any price can be used as a comment or to add additional information to the invoice:\n```json\n\"rows\": [\n    {\n        \"text\": \"A text line without any price\"\n    }\n]\n```\n\nA discount can either be specified on a row itself using either `discountTotal` or `discountPercentage`.\nFor example, this will create a row with a total price of 3,200.00 (` = (800.00 \u00d7 4 - 200.00) \u00d7 1.25`):\n```json\n\"rows\": [\n    {\n        \"text\": \"Consultation services\",\n        \"unit\": \"h\",\n        \"unitPrice\": 800.00,\n        \"quantity\": 4,\n        \"vatPercentage\": 25.0,\n        \"discountTotal\": 200.00,\n        \"priceExcludingVat\": true\n    }\n]\n```",
                "operationId": "createInvoice",
                "produces": [
                    "application/json"
                ],
                "parameters": [
                    {
                        "name": "body",
                        "in": "body",
                        "schema": {
                            "$ref": "#/definitions/NewInvoice"
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Success",
                        "schema": {
                            "$ref": "#/definitions/InvoiceResponse"
                        }
                    },
                    "400": {
                        "description": "Error",
                        "schema": {
                            "$ref": "#/definitions/ErrorResponse"
                        },
                        "examples": {
                            "application/json": {
                                "errorCode": "319-2-7-1705334189",
                                "message": "Invalid debtor",
                                "details": "No debtor with organization number '123456789' exists"
                            }
                        }
                    }
                }
            }
        },
        "/v4/rest/invoice/{id}": {
            "get": {
                "tags": [
                    "Invoice"
                ],
                "summary": "Get an invoice",
                "operationId": "getInvoice",
                "produces": [
                    "application/json"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "",
                        "required": true,
                        "type": "string"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "schema": {
                            "$ref": "#/definitions/InvoiceResponse"
                        }
                    },
                    "404": {
                        "description": "Error",
                        "schema": {
                            "$ref": "#/definitions/ErrorResponse"
                        },
                        "examples": {
                            "application/json": {
                                "errorCode": "319-2-4-1705334108",
                                "message": "Not found",
                                "details": null
                            }
                        }
                    }
                }
            },
            "put": {
                "tags": [
                    "Invoice"
                ],
                "summary": "Replace an invoice",
                "description": "Replaces an invoice which must have been created with `reservation` set to `true`.\n\nIn order to send the invoice, it must be finalized by setting `reservation` to `false`. Once it has been finalized, it can no longer be modified using this method.",
                "operationId": "replaceInvoice",
                "produces": [
                    "application/json"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "",
                        "required": true,
                        "type": "string"
                    },
                    {
                        "name": "body",
                        "in": "body",
                        "schema": {
                            "$ref": "#/definitions/NewInvoice"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "schema": {
                            "$ref": "#/definitions/InvoiceResponse"
                        }
                    },
                    "404": {
                        "description": "Error",
                        "schema": {
                            "$ref": "#/definitions/ErrorResponse"
                        },
                        "examples": {
                            "application/json": {
                                "errorCode": "319-2-4-1705334108",
                                "message": "Not found",
                                "details": null
                            }
                        }
                    }
                }
            },
            "delete": {
                "tags": [
                    "Invoice"
                ],
                "summary": "Delete an invoice",
                "description": "Only invoices that are still marked as reservations can be deleted. Once it has been finalized, it must be credited instead.\n\n## Notable error codes\n|HTTP|Code|Description|\n|:--|:--|:--|\n|400|319-2-45|Invalid invoice state - Request requires the invoice to be in another state, for example when trying to delete an invoice but it has already been sent to the debtor.|\n",
                "operationId": "deleteInvoice",
                "produces": [
                    "application/json"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "",
                        "required": true,
                        "type": "string"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success"
                    },
                    "404": {
                        "description": "Error",
                        "schema": {
                            "$ref": "#/definitions/ErrorResponse"
                        },
                        "examples": {
                            "application/json": {
                                "errorCode": "319-2-4-1705334108",
                                "message": "Not found",
                                "details": null
                            }
                        }
                    }
                }
            },
            "patch": {
                "tags": [
                    "Invoice"
                ],
                "summary": "Patch an invoice",
                "description": "Updates an invoice. Depending on the process step and status of the invoice, some fields might not be possible to modify.",
                "operationId": "patchInvoice",
                "produces": [
                    "application/json"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "",
                        "required": true,
                        "type": "string"
                    },
                    {
                        "name": "body",
                        "in": "body",
                        "schema": {
                            "$ref": "#/definitions/PatchInvoice"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "schema": {
                            "$ref": "#/definitions/InvoiceResponse"
                        }
                    },
                    "404": {
                        "description": "Error",
                        "schema": {
                            "$ref": "#/definitions/ErrorResponse"
                        },
                        "examples": {
                            "application/json": {
                                "errorCode": "319-2-4-1705334108",
                                "message": "Not found",
                                "details": null
                            }
                        }
                    },
                    "400": {
                        "description": "Error",
                        "schema": {
                            "$ref": "#/definitions/ErrorResponse"
                        },
                        "examples": {
                            "application/json": {
                                "errorCode": "319-2-45-1747208106",
                                "message": "Invalid invoice state",
                                "details": "Cannot update invoice dates for invoices with service 'fakturaservice'"
                            }
                        }
                    }
                }
            }
        },
        "/v4/rest/invoice/{id}/finalize": {
            "put": {
                "tags": [
                    "Invoice"
                ],
                "summary": "Finalize a reserved invoice",
                "description": "Sends a reserved invoice. If the invoice was created with `sendAs` = `INVOICE`, it will be scheduled to be sent to the debtor as soon as possible. For other values of `sendAs`, it might take a few days for it to be distributed depending on configuration.\n\n## Notable error codes\n|HTTP|Code|Description|\n|:--|:--|:--|\n|400|319-2-45|Invalid invoice state - Request requires the invoice to be in another state, for example when trying to delete an invoice but it has already been sent to the debtor.|\n",
                "operationId": "finalizeReservation",
                "produces": [
                    "application/json"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "",
                        "required": true,
                        "type": "string"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "schema": {
                            "$ref": "#/definitions/InvoiceResponse"
                        }
                    },
                    "404": {
                        "description": "Error",
                        "schema": {
                            "$ref": "#/definitions/ErrorResponse"
                        },
                        "examples": {
                            "application/json": {
                                "errorCode": "319-2-4-1705334108",
                                "message": "Not found",
                                "details": null
                            }
                        }
                    }
                }
            }
        },
        "/v4/rest/invoice/{id}/pdf": {
            "get": {
                "tags": [
                    "Invoice"
                ],
                "summary": "Retrieve invoice PDF",
                "description": "Retrives the original invoice PDF. If the invoice was created by specifying `sendAs` to something else than `INVOICE`, the original invoice PDF must have been specified as an attachment when creating it. Otherwise, the invoice PDF will be created once it is sent to the debtor by the system.\n\nNote that if the invoice has not yet been sent to the debtor, the PDF might not yet be possible to fetch and give a 404 response code.",
                "operationId": "getInvoicePdf",
                "produces": [
                    "application/pdf"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "",
                        "required": true,
                        "type": "string"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "schema": {
                            "type": "string",
                            "format": "binary"
                        }
                    },
                    "404": {
                        "description": "Error",
                        "schema": {
                            "$ref": "#/definitions/ErrorResponse"
                        },
                        "examples": {
                            "application/json": {
                                "errorCode": "319-2-4-1705334108",
                                "message": "Not found",
                                "details": null
                            }
                        }
                    }
                }
            },
            "put": {
                "tags": [
                    "Invoice"
                ],
                "summary": "Set invoice PDF",
                "description": "Set the original invoice PDF that will be available for the debtor online as well as printed on the back of reminders, debt collection letters and similar.\n\nNote that if the system generated and sent the original PDF, i.e. the invoice was created by specifying `sendAs` to `INVOICE`, the PDF cannot be replaced.\n\n## Notable error codes\n|HTTP|Code|Description|\n|:--|:--|:--|\n|400|319-3-42|Invalid file type|\n|400|319-2-45|Invalid invoice state - Request requires the invoice to be in another state, for example when trying to delete an invoice but it has already been sent to the debtor.|\n",
                "operationId": "setInvoicePdf",
                "consumes": [
                    "application/octet-stream"
                ],
                "produces": [
                    "application/json"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "",
                        "required": true,
                        "type": "string"
                    },
                    {
                        "name": "pdf",
                        "in": "body",
                        "description": "",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "binary"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success"
                    },
                    "404": {
                        "description": "Error",
                        "schema": {
                            "$ref": "#/definitions/ErrorResponse"
                        },
                        "examples": {
                            "application/json": {
                                "errorCode": "319-2-4-1705334108",
                                "message": "Not found",
                                "details": null
                            }
                        }
                    }
                }
            }
        },
        "/v4/rest/invoice/{id}/closure": {
            "post": {
                "tags": [
                    "Invoice"
                ],
                "summary": "Register a closure",
                "description": "Close some or all of an invoice.",
                "operationId": "registerClosure",
                "produces": [
                    "application/json"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "",
                        "required": true,
                        "type": "string"
                    },
                    {
                        "name": "body",
                        "in": "body",
                        "schema": {
                            "$ref": "#/definitions/NewClosure"
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Success",
                        "schema": {
                            "$ref": "#/definitions/ClosureResponse"
                        }
                    },
                    "404": {
                        "description": "Error",
                        "schema": {
                            "$ref": "#/definitions/ErrorResponse"
                        },
                        "examples": {
                            "application/json": {
                                "errorCode": "319-2-4-1705334108",
                                "message": "Not found",
                                "details": null
                            }
                        }
                    }
                }
            }
        },
        "/v4/rest/invoice/{id}/payment-details": {
            "get": {
                "tags": [
                    "Invoice"
                ],
                "summary": "Get payment details",
                "description": "Gives the payment details the debtor should use in order to pay the invoice.\n\nNote that the accounts to pay to might change depending on the invoice's process status.",
                "operationId": "getPaymentDetails",
                "produces": [
                    "application/json"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "",
                        "required": true,
                        "type": "string"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "schema": {
                            "$ref": "#/definitions/PaymentDetailsResponse"
                        }
                    },
                    "404": {
                        "description": "Error",
                        "schema": {
                            "$ref": "#/definitions/ErrorResponse"
                        },
                        "examples": {
                            "application/json": {
                                "errorCode": "319-2-4-1705334108",
                                "message": "Not found",
                                "details": null
                            }
                        }
                    }
                }
            }
        },
        "/v4/rest/legal-entity/{country-code}/{national-identification-number}": {
            "get": {
                "tags": [
                    "Legal Entity"
                ],
                "summary": "Lookup address given a national identifier",
                "description": "Lookup of address given a national identifier in the same way as is automatically done when creating an invoice.\n\n## National identifier format\nAt leasts the following formats may be used in requests:\n- Swedish individuals\n  - `YYYYMMDDNNNC`\n  - `YYYYMMDD-NNNC`\n  - `YYMMDDNNNC`, assumes age of individual is less than 100 years\n  - `YYMMDD-NNNC`, assumes age of individual is less than 100 years\n  - `YYMMDD+NNNC`, assumes age of individual is 100 years or more\n- Swedish organizations\n  - `XXXXXXNNNC`\n  - `XXXXXX-NNNC`\n  - `16XXXXXXNNNC`, as `16` is usually used as prefix in order to store organizations with same length as an individuals in some systems\n  - `YYMMDDNNNC` (or any other valid format for Swedish individual), sole proprietorship (enskild firma)\n  - `YYMMDDNNNCXXXXX`, sole proprietorship (enskild firma), format usually used if individual has more than one\n\n## Testing\nIn non-production environments, only mocked individuals and a small subset of real organizations can be used, for example:\n- Swedish individuals: 194107102222, 194107161111, 194109061111, 194111142222, 194112271111, 194201232222, 194201312222, 194202281111, 194203052222, 194203212222, 194205112222, 194207311111, 194301021111.\n- Swedish organizations:  5560000043, 5560000241, 5560000365, 5560000472, 5560000753, 5560001033, 5560001348, 5560001439, 5560001629, 5560001975, 5560001991, 5560002221, 5560002296, 5560002320.\n\nWaya can provide a list of additional national identifiers if needed.\n\n## Examples respones\nExample response for individual:\n```json\n{\n  \"status\": \"NORMAL\",\n  \"nationalIdentifier\": {\n      \"number\": \"194811252222\",\n      \"countryCode\": \"SE\"\n  },\n  \"type\": \"INDIVIDUAL\",\n  \"firstName\": \"Barbro\",\n  \"lastName\": \"Lindberg\",\n  \"givenName\": \"Barbro Lindberg\",\n  \"address\": {\n      \"lines\": [\n          \"Storgatan 12A\"\n      ],\n      \"postalCode\": \"21611\",\n      \"city\": \"LIMHAMN\",\n      \"countryCode\": \"SE\"\n  }\n}\n```\nExample response for organization:\n```json\n{\n  \"status\": \"NORMAL\",\n  \"nationalIdentifier\": {\n      \"number\": \"5560139700\",\n      \"countryCode\": \"SE\"\n  },\n  \"type\": \"ORGANIZATION\",\n  \"companyName\": \"Volvo Lastvagnar Aktiebolag\",\n  \"address\": {\n      \"postalCode\": \"40508\",\n      \"city\": \"G\u00d6TEBORG\",\n      \"countryCode\": \"SE\"\n  }\n}\n```\n\n## Special cases\n- Protected address (`PROTECTED`)  \n  Indicates the individual has a protected address.  \n  For Sweden, Skatteverket's address is returned instead of the individual's.  \n  *Example (test environment):* (SE) 19400427-9107\n\n- Deceased (`DECEASED`)  \n  Indicates the individual is deceased.  \n  No address is returned.  \n  *Example (test environment):* (SE) 19441011-9046\n\n- Emigrated (`EMIGRATED`)  \n  Indicates the individual has emigrated.  \n  Their new foreign address is included if available.  \n  *Example (test environment):* (SE) 19790702-2391\n\n- Changed National Identifier (`CHANGED_NIN`)  \n  Indicates the individual has received a new national identifier.  \n  The new identifier is returned; no address is included.  \n  *Example (test environment):* (SE) 19460907-3277\n\n## Notable error codes\n|HTTP|Code|Description|\n|:--|:--|:--|\n|400|319-2-49|Fraud protection - Individual is marked for fraud protected and care should be taken to ensure the identity of the individual|\n|400|319-2-50|Deregistered or deleted - Legal entity has been deleted or deregistered in national registry|\n|400|319-2-51|Invalid legal entity - Legal entity exists, but data cannot be retrieved from national registry due to their status|\n",
                "operationId": "lookup",
                "produces": [
                    "application/json"
                ],
                "parameters": [
                    {
                        "name": "country-code",
                        "in": "path",
                        "description": "Country code for national identification number",
                        "required": true,
                        "type": "string"
                    },
                    {
                        "name": "national-identification-number",
                        "in": "path",
                        "description": "National identification number",
                        "required": true,
                        "type": "string"
                    },
                    {
                        "name": "type",
                        "in": "query",
                        "description": "Optional hint to force search of specific type, for example to differentiate between an individual and their sole proprietorship (enskilda firma)",
                        "required": false,
                        "type": "string",
                        "enum": [
                            "INDIVIDUAL",
                            "ORGANIZATION"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "schema": {
                            "$ref": "#/definitions/LegalEntityResponse"
                        },
                        "examples": {
                            "application/json": {
                                "data": {
                                    "status": "NORMAL",
                                    "nationalIdentifier": {
                                        "number": "194811252222",
                                        "countryCode": "SE"
                                    },
                                    "type": "INDIVIDUAL",
                                    "firstName": "Barbro",
                                    "lastName": "Lindberg",
                                    "givenName": "Barbro Lindberg",
                                    "address": {
                                        "lines": [
                                            "Storgatan 12A"
                                        ],
                                        "postalCode": "21611",
                                        "city": "LIMHAMN",
                                        "countryCode": "SE"
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Error",
                        "schema": {
                            "$ref": "#/definitions/ErrorResponse"
                        },
                        "examples": {
                            "application/json": {
                                "errorCode": "319-2-49-1762503520",
                                "message": "Fraud protection",
                                "details": "S3 - Locked"
                            }
                        }
                    },
                    "404": {
                        "description": "Error",
                        "schema": {
                            "$ref": "#/definitions/ErrorResponse"
                        },
                        "examples": {
                            "application/json": {
                                "errorCode": "319-2-4-1705334108",
                                "message": "Not found",
                                "details": null
                            }
                        }
                    }
                }
            }
        },
        "/v4/rest/legal-entity/{country-code}/{national-identification-number}/credit-check": {
            "get": {
                "tags": [
                    "Legal Entity"
                ],
                "summary": "Perform a credit check",
                "description": "<div style=\"color:#B2B4B8; background-color:#232935; padding: 8px 0px 8px 8px;border-left: 5px solid #E64841;\">\n    <b style=\"color:#E64841\">WARNING</b> This is an experimental method that might change.\n</div>\n\n\u200c Perform credit check of legal entity given a national identifier.",
                "operationId": "creditCheck",
                "produces": [
                    "application/json"
                ],
                "parameters": [
                    {
                        "name": "country-code",
                        "in": "path",
                        "description": "Country code for national identification number",
                        "required": true,
                        "type": "string"
                    },
                    {
                        "name": "national-identification-number",
                        "in": "path",
                        "description": "National identification number",
                        "required": true,
                        "type": "string"
                    },
                    {
                        "name": "type",
                        "in": "query",
                        "description": "Optional hint to force search of specific type, for example to differentiate between an individual and their sole proprietorship (enskilda firma)",
                        "required": false,
                        "type": "string",
                        "enum": [
                            "INDIVIDUAL",
                            "ORGANIZATION"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "schema": {
                            "$ref": "#/definitions/CreditCheckResponse"
                        }
                    },
                    "400": {
                        "description": "Error",
                        "schema": {
                            "$ref": "#/definitions/ErrorResponse"
                        },
                        "examples": {
                            "application/json": {
                                "errorCode": "319-2-49-1762503520",
                                "message": "Fraud protection",
                                "details": "S3 - Locked"
                            }
                        }
                    },
                    "404": {
                        "description": "Error",
                        "schema": {
                            "$ref": "#/definitions/ErrorResponse"
                        },
                        "examples": {
                            "application/json": {
                                "errorCode": "319-2-4-1705334108",
                                "message": "Not found",
                                "details": null
                            }
                        }
                    }
                }
            }
        }
    },
    "definitions": {
        "Address": {
            "required": [],
            "properties": {
                "lines": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "postalCode": {
                    "type": "string"
                },
                "city": {
                    "type": "string"
                },
                "countryCode": {
                    "type": "string",
                    "pattern": "[A-Z]{2}"
                }
            }
        },
        "Boarding": {
            "required": [
                "id",
                "_link",
                "resellerId",
                "creditor"
            ],
            "properties": {
                "id": {
                    "type": "string"
                },
                "_link": {
                    "type": "string"
                },
                "resellerId": {
                    "type": "string"
                },
                "creditorId": {
                    "description": "Once the boarding is completed, the ID of the new creditor.",
                    "type": "string"
                },
                "_creditorLink": {
                    "type": "string"
                },
                "creditor": {
                    "$ref": "#/definitions/BoardingCreditor"
                },
                "documents": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/BoardingDocument"
                    }
                }
            }
        },
        "BoardingCreditor": {
            "description": "Creditor data given for boarding. Does not reflect changes done later to the actual creditor entity created by the boarding.",
            "required": [
                "address",
                "taxRegistered"
            ],
            "properties": {
                "nationalIdentifier": {
                    "$ref": "#/definitions/NationalIdentifier"
                },
                "name": {
                    "type": "string"
                },
                "address": {
                    "$ref": "#/definitions/Address"
                },
                "taxRegistered": {
                    "type": "boolean"
                }
            }
        },
        "BoardingDocument": {
            "required": [
                "id"
            ],
            "properties": {
                "id": {
                    "type": "string"
                },
                "_pdfLink": {
                    "description": "Link to signed document once boarding is completed.",
                    "type": "string"
                },
                "_signaturesLink": {
                    "description": "Link to list of signatures once boarding is completed.",
                    "type": "string"
                },
                "parameters": {
                    "description": "Boarding specific parameters used for the document.",
                    "type": "string"
                },
                "attachments": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/BoardingDocumentAttachment"
                    }
                }
            }
        },
        "BoardingDocumentAttachment": {
            "required": [
                "id",
                "_fileLink",
                "name"
            ],
            "properties": {
                "id": {
                    "type": "string"
                },
                "_fileLink": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                }
            }
        },
        "BuildInfo": {
            "required": [
                "projectVersion"
            ],
            "properties": {
                "projectVersion": {
                    "type": "string"
                }
            }
        },
        "BundleCost": {
            "required": [
                "type",
                "text",
                "price",
                "vatPercentage",
                "currencyCodeBase",
                "currencyExchangeRate",
                "currencyCodeCounter",
                "chargeThroughFinancialPartner",
                "invoiceId",
                "_invoiceLink"
            ],
            "properties": {
                "type": {
                    "type": "string",
                    "enum": [
                        "NONE",
                        "NOTIFICATION_FEE",
                        "REMINDER",
                        "DEBT_COLLECTION",
                        "INTEREST",
                        "KFM_APPLICATION_FEE",
                        "KFM_DELEGATION_FEE",
                        "KFM_EXECUTION_FEE",
                        "INSTALLMENT_AMORTIZATION_FEE",
                        "CREDITED_NOTIFICATION_FEE",
                        "CREDITED_REMINDER",
                        "CREDITED_DEBT_COLLECTION",
                        "CREDITED_INTEREST",
                        "CREDITED_KFM_DELEGATION_FEE",
                        "CREDITED_KFM_EXECUTION_FEE",
                        "CREDITED_INSTALLMENT_AMORTIZATION_FEE",
                        "START_FEE",
                        "CREDITED_START_FEE",
                        "CREDIT_INTEREST_FEE",
                        "CREDITED_CREDIT_INTEREST_FEE",
                        "LATE_PAYMENT_COMPENSATION_FEE",
                        "CREDITED_LATE_PAYMENT_COMPENSATION_FEE"
                    ]
                },
                "text": {
                    "type": "string"
                },
                "price": {
                    "description": "price excluding VAT in `currencyCodeBase`",
                    "type": "number",
                    "format": "double"
                },
                "vatPercentage": {
                    "type": "number",
                    "format": "double",
                    "minimum": 0
                },
                "currencyCodeBase": {
                    "description": "currency of the transaction account the associated invoice should be paid to",
                    "type": "string",
                    "pattern": "[A-Z]{3}"
                },
                "currencyExchangeRate": {
                    "type": "number",
                    "format": "double"
                },
                "currencyCodeCounter": {
                    "description": "the creditor's bookkeeping currency",
                    "type": "string",
                    "pattern": "[A-Z]{3}"
                },
                "chargeThroughFinancialPartner": {
                    "description": "costs that will be charged through the financial partner towards the creditor",
                    "type": "boolean"
                },
                "invoiceId": {
                    "type": "string"
                },
                "_invoiceLink": {
                    "type": "string"
                }
            }
        },
        "Closure": {
            "required": [
                "invoiceAmountLeft",
                "capital",
                "interest",
                "fees"
            ],
            "properties": {
                "invoiceAmountLeft": {
                    "description": "amount left to pay on the invoice after this allocation",
                    "type": "number",
                    "format": "double",
                    "minimum": 0
                },
                "capital": {
                    "description": "how much of the capital was reduced",
                    "type": "number",
                    "format": "double"
                },
                "interest": {
                    "description": "how much of the interest was reduced",
                    "type": "number",
                    "format": "double"
                },
                "fees": {
                    "description": "how much of the collection fees were reduced",
                    "type": "number",
                    "format": "double"
                }
            }
        },
        "Credit": {
            "required": [
                "id",
                "_link",
                "externalNumber",
                "debitId",
                "_debitLink",
                "rows",
                "amount"
            ],
            "properties": {
                "id": {
                    "type": "string"
                },
                "_link": {
                    "type": "string"
                },
                "externalNumber": {
                    "type": "string"
                },
                "debitId": {
                    "type": "string"
                },
                "_debitLink": {
                    "type": "string"
                },
                "rows": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/CreditRow"
                    }
                },
                "amount": {
                    "type": "number",
                    "format": "double"
                }
            }
        },
        "CreditCheck": {
            "required": [
                "passed"
            ],
            "properties": {
                "passed": {
                    "type": "boolean"
                },
                "legalEntity": {
                    "$ref": "#/definitions/LegalEntity"
                }
            }
        },
        "CreditRow": {
            "required": [
                "creditedRow",
                "totalPrice"
            ],
            "properties": {
                "creditedRow": {
                    "$ref": "#/definitions/InvoiceRow"
                },
                "totalPrice": {
                    "description": "credited amount including VAT",
                    "type": "number",
                    "format": "double"
                }
            }
        },
        "CreditSearchResult": {
            "required": [
                "id",
                "_link",
                "externalNumber"
            ],
            "properties": {
                "id": {
                    "type": "string"
                },
                "_link": {
                    "type": "string"
                },
                "externalNumber": {
                    "type": "string"
                }
            }
        },
        "Creditor": {
            "required": [
                "id",
                "_link",
                "status",
                "nationalIdentifier",
                "taxRegistered",
                "name",
                "address",
                "invoiceContact"
            ],
            "properties": {
                "id": {
                    "type": "string"
                },
                "_link": {
                    "type": "string"
                },
                "status": {
                    "$ref": "#/definitions/CreditorStatus"
                },
                "boardingId": {
                    "description": "ID of the boarding that created this creditor.",
                    "type": "string"
                },
                "_boardingLink": {
                    "type": "string"
                },
                "nationalIdentifier": {
                    "$ref": "#/definitions/NationalIdentifier"
                },
                "vatNumber": {
                    "type": "string"
                },
                "taxRegistered": {
                    "type": "boolean"
                },
                "name": {
                    "type": "string"
                },
                "address": {
                    "$ref": "#/definitions/Address"
                },
                "invoiceContact": {
                    "$ref": "#/definitions/CreditorInvoiceContact"
                }
            }
        },
        "CreditorInvoiceContact": {
            "required": [],
            "properties": {
                "email": {
                    "type": "string"
                },
                "phone": {
                    "type": "string"
                },
                "web": {
                    "type": "string"
                }
            }
        },
        "CreditorStatus": {
            "required": [
                "aggregated",
                "system"
            ],
            "properties": {
                "aggregated": {
                    "description": "Resulting status of the creditor. Only `ACTIVE` creditors can issue invoices. Typically a creditor starts out as `AWAITING_ACTIVATION` and then transitions to `ACTIVE` once all onboarding steps are completed. If a creditor is deactivated, the status becomes `INACTIVE`.",
                    "type": "string",
                    "enum": [
                        "AWAITING_ACTIVATION",
                        "ACTIVE",
                        "INACTIVE"
                    ]
                },
                "system": {
                    "description": "Status given by the system.",
                    "type": "string",
                    "enum": [
                        "AWAITING_ACTIVATION",
                        "ACTIVE",
                        "INACTIVE"
                    ]
                },
                "reseller": {
                    "description": "If the creditor has a reseller, the status given by the reseller, otherwise `null`.",
                    "type": "string",
                    "enum": [
                        "AWAITING_ACTIVATION",
                        "ACTIVE",
                        "INACTIVE"
                    ]
                },
                "financialPartner": {
                    "description": "If the creditor has a financial partner, the status given by the financial partner, otherwise `null`.",
                    "type": "string",
                    "enum": [
                        "AWAITING_ACTIVATION",
                        "ACTIVE",
                        "INACTIVE"
                    ]
                }
            }
        },
        "Debtor": {
            "required": [
                "billingAddress",
                "type"
            ],
            "properties": {
                "externalNumber": {
                    "type": "string"
                },
                "nationalIdentifier": {
                    "$ref": "#/definitions/NationalIdentifier"
                },
                "billingAddress": {
                    "$ref": "#/definitions/Address"
                },
                "type": {
                    "type": "string",
                    "enum": [
                        "INDIVIDUAL",
                        "ORGANIZATION"
                    ]
                },
                "vatNumber": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                },
                "email": {
                    "type": "string"
                },
                "phone": {
                    "type": "string"
                },
                "gln": {
                    "type": "string"
                }
            }
        },
        "DirectPayment": {
            "required": [
                "allocations"
            ],
            "properties": {
                "allocations": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/DirectPaymentAllocation"
                    }
                }
            }
        },
        "DirectPaymentAllocation": {
            "required": [
                "debitId",
                "invoiceId",
                "debitAmountLeft",
                "invoiceAmountLeft",
                "surplus",
                "capital",
                "interest",
                "fees"
            ],
            "properties": {
                "debitId": {
                    "description": "**DEPRECATED** - use `invoiceId` instead",
                    "type": "string"
                },
                "invoiceId": {
                    "type": "string"
                },
                "debitAmountLeft": {
                    "description": "**DEPRECATED** - use `invoiceAmountLeft` instead",
                    "type": "number",
                    "format": "double"
                },
                "invoiceAmountLeft": {
                    "description": "amount left to pay on the invoice after this allocation",
                    "type": "number",
                    "format": "double",
                    "minimum": 0
                },
                "surplus": {
                    "description": "how much of a surplus (debt towards the debtor) the specific allocation generated on the debit",
                    "type": "number",
                    "format": "double",
                    "minimum": 0
                },
                "capital": {
                    "description": "how much of the capital was reduced",
                    "type": "number",
                    "format": "double"
                },
                "interest": {
                    "description": "how much of the interest was reduced",
                    "type": "number",
                    "format": "double"
                },
                "fees": {
                    "description": "how much of the collection fees were reduced",
                    "type": "number",
                    "format": "double"
                }
            }
        },
        "ExtendedField": {
            "required": [
                "key"
            ],
            "properties": {
                "key": {
                    "type": "string"
                },
                "value": {
                    "type": "string"
                }
            }
        },
        "FinancialReportBundle": {
            "required": [
                "id",
                "_link",
                "financialReports"
            ],
            "properties": {
                "id": {
                    "type": "string"
                },
                "_link": {
                    "type": "string"
                },
                "_costsLink": {
                    "type": "string"
                },
                "financialReports": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/FinancialReportSearchResult"
                    }
                }
            }
        },
        "FinancialReportSearchResult": {
            "required": [
                "id",
                "_fileLink",
                "createdAt",
                "name",
                "type",
                "mediaType"
            ],
            "properties": {
                "id": {
                    "type": "string"
                },
                "_fileLink": {
                    "type": "string"
                },
                "createdAt": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                },
                "type": {
                    "type": "string",
                    "enum": [
                        "SALES_NOTE",
                        "INSTANT_DEBT",
                        "TRANSACTION_LOG",
                        "LEDGER_ACCOUNTS_RECEIVABLE",
                        "LEDGER_ACCOUNT_BALANCE",
                        "ACCOUNT_ACTIVITY_STATEMENT",
                        "ACCOUNT_BOOKKEEPING_STATEMENT",
                        "UNALLOCATED_PAYMENTS_ACCOUNT_BALANCE",
                        "PURCHASES",
                        "REPURCHASES",
                        "CLIENT_SPECIFIC",
                        "PAYMENT_STATEMENT",
                        "RECONCILIATION",
                        "UNKNOWN_PAYMENTS",
                        "SURPLUS_PAYMENTS"
                    ]
                },
                "mediaType": {
                    "type": "string"
                }
            }
        },
        "Invoice": {
            "required": [
                "id",
                "_link",
                "_paymentDetailsLink",
                "type",
                "ocr",
                "externalNumber",
                "reservation",
                "deliveryMethod",
                "invoiceDate",
                "dueDate",
                "currencyCode",
                "currencyExchangeRate",
                "vatIncluded",
                "reverseCharge",
                "taxReduction",
                "languageCode",
                "edi",
                "debtor",
                "rows",
                "currentProcessStep",
                "originalAmount",
                "amountLeft",
                "amountPaid",
                "amountCredited"
            ],
            "properties": {
                "id": {
                    "type": "string"
                },
                "_link": {
                    "type": "string"
                },
                "_paymentDetailsLink": {
                    "type": "string"
                },
                "type": {
                    "type": "string",
                    "enum": [
                        "DEBIT",
                        "STANDALONE_CREDIT"
                    ]
                },
                "ocr": {
                    "type": "string"
                },
                "externalNumber": {
                    "type": "string"
                },
                "reservation": {
                    "type": "boolean"
                },
                "service": {
                    "type": "string"
                },
                "financialPartnerService": {
                    "description": "If the creditor has a financial partner, the service or status of the invoice as provided by the financial partner.",
                    "type": "string"
                },
                "deliveryMethod": {
                    "type": "string",
                    "enum": [
                        "DO_NOT_SEND",
                        "EMAIL",
                        "POSTAL",
                        "E_INVOICE_COMPANY",
                        "E_INVOICE_BANK",
                        "E_INVOICE",
                        "DYNAMIC",
                        "DIGITAL_MAILBOX",
                        "EXTERNAL"
                    ]
                },
                "invoiceDate": {
                    "type": "string",
                    "pattern": "\\d{4}-\\d{2}-\\d{2}"
                },
                "dueDate": {
                    "type": "string",
                    "pattern": "\\d{4}-\\d{2}-\\d{2}"
                },
                "deliveryDate": {
                    "type": "string",
                    "pattern": "\\d{4}-\\d{2}-\\d{2}"
                },
                "currencyCode": {
                    "type": "string",
                    "pattern": "[A-Z]{3}"
                },
                "currencyExchangeRate": {
                    "type": "number",
                    "format": "double"
                },
                "vatIncluded": {
                    "type": "boolean"
                },
                "reverseCharge": {
                    "type": "boolean"
                },
                "taxReduction": {
                    "type": "boolean"
                },
                "languageCode": {
                    "type": "string",
                    "pattern": "[a-z]{2}"
                },
                "comment": {
                    "type": "string"
                },
                "yourReference": {
                    "type": "string"
                },
                "ourReference": {
                    "type": "string"
                },
                "yourReferenceId": {
                    "type": "string"
                },
                "ourReferenceId": {
                    "type": "string"
                },
                "yourOrderNumber": {
                    "type": "string"
                },
                "ourOrderNumber": {
                    "type": "string"
                },
                "edi": {
                    "$ref": "#/definitions/InvoiceEdi"
                },
                "reference": {
                    "type": "string"
                },
                "termsOfDelivery": {
                    "type": "string"
                },
                "project": {
                    "type": "string"
                },
                "debtor": {
                    "$ref": "#/definitions/Debtor"
                },
                "rows": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/InvoiceRow"
                    }
                },
                "currentProcessStep": {
                    "$ref": "#/definitions/ProcessStep"
                },
                "originalAmount": {
                    "description": "In the invoice's currency, the original price of invoice when created in the system.",
                    "type": "number",
                    "format": "double"
                },
                "amountLeft": {
                    "description": "In the invoice's currency, the remaining debt to pay.",
                    "type": "number",
                    "format": "double"
                },
                "amountPaid": {
                    "description": "In the invoice's currency, the total amount paid by the debtor, regardless of whether capital or fees were paid.",
                    "type": "number",
                    "format": "double"
                },
                "amountCredited": {
                    "description": "In the invoice's currency, the total amount credited, regardless of whether capital or fees were credited.",
                    "type": "number",
                    "format": "double"
                }
            }
        },
        "InvoiceEdi": {
            "description": "Additional electronic data interchange (EDI) fields only used with e-invoices.",
            "required": [],
            "properties": {
                "yourReference": {
                    "type": "string"
                },
                "yourOrderNumber": {
                    "type": "string"
                }
            }
        },
        "InvoiceRow": {
            "required": [
                "id",
                "type",
                "text",
                "unitPrice",
                "quantity",
                "vatPercentage",
                "totalPrice"
            ],
            "properties": {
                "id": {
                    "type": "string"
                },
                "type": {
                    "type": "string",
                    "enum": [
                        "CAPITAL",
                        "FEE_CAPITAL",
                        "FEE_NO_INTEREST"
                    ]
                },
                "externalNumber": {
                    "type": "string"
                },
                "articleNumber": {
                    "type": "string"
                },
                "text": {
                    "type": "string"
                },
                "description": {
                    "type": "string"
                },
                "unit": {
                    "type": "string"
                },
                "unitPrice": {
                    "description": "unit price excluding VAT",
                    "type": "number",
                    "format": "double"
                },
                "quantity": {
                    "type": "number",
                    "format": "double"
                },
                "discountTotal": {
                    "type": "number",
                    "format": "double"
                },
                "discountPercentage": {
                    "type": "number",
                    "format": "double"
                },
                "percentageMarkup": {
                    "type": "number",
                    "format": "double"
                },
                "vatPercentage": {
                    "type": "number",
                    "format": "double",
                    "minimum": 0
                },
                "totalPrice": {
                    "description": "net price, i.e. total price after discount and including VAT",
                    "type": "number",
                    "format": "double"
                },
                "project": {
                    "type": "string"
                },
                "profitUnit": {
                    "type": "string"
                },
                "bookkeepingAccount": {
                    "type": "string"
                }
            }
        },
        "InvoiceSearchResult": {
            "required": [
                "id",
                "_link",
                "type",
                "ocr",
                "externalNumber",
                "originalAmount",
                "amountLeft"
            ],
            "properties": {
                "id": {
                    "type": "string"
                },
                "_link": {
                    "type": "string"
                },
                "type": {
                    "type": "string",
                    "enum": [
                        "DEBIT",
                        "STANDALONE_CREDIT"
                    ]
                },
                "ocr": {
                    "type": "string"
                },
                "externalNumber": {
                    "type": "string"
                },
                "originalAmount": {
                    "description": "in the invoice's currency, the original price of invoice when created in the system",
                    "type": "number",
                    "format": "double"
                },
                "amountLeft": {
                    "description": "in the invoice's currency, the remaining amount debt to pay",
                    "type": "number",
                    "format": "double"
                }
            }
        },
        "LegalEntity": {
            "required": [
                "status",
                "nationalIdentifier",
                "type"
            ],
            "properties": {
                "status": {
                    "type": "string",
                    "enum": [
                        "NORMAL",
                        "PROTECTED",
                        "DECEASED",
                        "EMIGRATED",
                        "CHANGED_NIN"
                    ]
                },
                "nationalIdentifier": {
                    "$ref": "#/definitions/NationalIdentifier"
                },
                "type": {
                    "type": "string",
                    "enum": [
                        "INDIVIDUAL",
                        "ORGANIZATION"
                    ]
                },
                "companyName": {
                    "type": "string"
                },
                "firstName": {
                    "type": "string"
                },
                "lastName": {
                    "type": "string"
                },
                "givenName": {
                    "description": "full name",
                    "type": "string"
                },
                "address": {
                    "$ref": "#/definitions/Address"
                }
            }
        },
        "Liveness": {
            "required": [
                "instanceId",
                "startTime",
                "buildInfo"
            ],
            "properties": {
                "instanceId": {
                    "type": "string"
                },
                "startTime": {
                    "type": "integer",
                    "format": "int64"
                },
                "buildInfo": {
                    "$ref": "#/definitions/BuildInfo"
                }
            }
        },
        "NationalIdentifier": {
            "description": "National identification number (NIN), unique identifier for a legal entity in a specific country",
            "required": [
                "number",
                "countryCode"
            ],
            "properties": {
                "number": {
                    "type": "string"
                },
                "countryCode": {
                    "description": "ISO 3166-1 alpha 2",
                    "type": "string",
                    "pattern": "[A-Z]{2}"
                }
            }
        },
        "NewAttachment": {
            "required": [
                "base64",
                "md5"
            ],
            "properties": {
                "base64": {
                    "type": "string"
                },
                "md5": {
                    "description": "MD5 hash of file prior to base64 encoding it",
                    "type": "string"
                }
            }
        },
        "NewClosure": {
            "required": [],
            "properties": {
                "externalNumber": {
                    "description": "optional ID of the closure, must be unique if specified",
                    "type": "string"
                },
                "closeAll": {
                    "description": "whether to close all remaining debt",
                    "type": "boolean",
                    "default": false
                },
                "amount": {
                    "description": "Amount to close, in the same currency as the invoice. Should not be used if `closeAll` is `true`.",
                    "type": "number",
                    "format": "double"
                }
            }
        },
        "NewCredit": {
            "required": [
                "externalNumber",
                "rows"
            ],
            "properties": {
                "externalNumber": {
                    "description": "ID of credit in external system, must be unique",
                    "type": "string"
                },
                "debitId": {
                    "description": "ID of debit to match against",
                    "type": "string"
                },
                "debitOcr": {
                    "description": "OCR of debit to match against",
                    "type": "string"
                },
                "debitExternalNumber": {
                    "description": "invoice number of debit to match against",
                    "type": "string"
                },
                "deliveryMethod": {
                    "description": "defaults to same delivery method as debit",
                    "type": "string",
                    "enum": [
                        "DO_NOT_SEND",
                        "EMAIL",
                        "POSTAL",
                        "E_INVOICE_COMPANY",
                        "E_INVOICE_BANK",
                        "E_INVOICE",
                        "DYNAMIC",
                        "DIGITAL_MAILBOX",
                        "EXTERNAL"
                    ]
                },
                "cashRounding": {
                    "description": "whether to round credit total",
                    "type": "boolean",
                    "default": false
                },
                "debtor": {
                    "$ref": "#/definitions/NewCreditDebtor"
                },
                "rows": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/NewCreditRow"
                    }
                },
                "sumValidation": {
                    "$ref": "#/definitions/SumValidation"
                },
                "extendedFields": {
                    "description": "additional fields that are used for custom or experimental features",
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/ExtendedField"
                    }
                }
            }
        },
        "NewCreditDebtor": {
            "required": [],
            "properties": {
                "name": {
                    "type": "string"
                },
                "billingAddress": {
                    "$ref": "#/definitions/Address"
                },
                "email": {
                    "description": "if the credit should be delivered as email to another email than defined on the debit invoice",
                    "type": "string"
                },
                "gln": {
                    "description": "if the credit should be delivered as e-invoice to another GLN than defined on the debit invoice",
                    "type": "string"
                }
            }
        },
        "NewCreditRow": {
            "required": [],
            "properties": {
                "debitRowExternalNumber": {
                    "type": "string"
                },
                "debitRowId": {
                    "type": "string"
                },
                "debitRowArticleNumber": {
                    "type": "string"
                },
                "text": {
                    "type": "string"
                },
                "unitPrice": {
                    "type": "number",
                    "format": "double",
                    "default": 0
                },
                "quantity": {
                    "type": "number",
                    "format": "double",
                    "default": 1
                },
                "discountTotal": {
                    "description": "total price discount, cannot be used together with `discountPercentage` or `percentageMarkup`",
                    "type": "number",
                    "format": "double",
                    "default": 0
                },
                "discountPercentage": {
                    "description": "cannot be used together with `discountTotal` or `percentageMarkup`",
                    "type": "number",
                    "format": "double",
                    "default": 0,
                    "maximum": 100,
                    "minimum": 0
                },
                "percentageMarkup": {
                    "description": "cannot be used together with `discountTotal` or `discountPercentage`",
                    "type": "number",
                    "format": "double",
                    "default": 0,
                    "minimum": -100
                },
                "vatPercentage": {
                    "type": "number",
                    "format": "double",
                    "default": 0,
                    "minimum": 0
                },
                "priceExcludingVat": {
                    "description": "whether the `unitPrice` and `discountTotal` is specified without VAT",
                    "type": "boolean",
                    "default": false
                },
                "sumValidation": {
                    "$ref": "#/definitions/SumValidation"
                }
            }
        },
        "NewDebtor": {
            "required": [],
            "properties": {
                "externalNumber": {
                    "description": "debtor number in external system",
                    "type": "string"
                },
                "nationalIdentifier": {
                    "$ref": "#/definitions/NewNationalIdentifier"
                },
                "billingAddress": {
                    "$ref": "#/definitions/Address"
                },
                "type": {
                    "description": "mandatory if no lookup of debtor is supported",
                    "type": "string",
                    "enum": [
                        "INDIVIDUAL",
                        "ORGANIZATION"
                    ]
                },
                "vatNumber": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                },
                "email": {
                    "description": "preferably always specified if available, mandatory if delivery method is e-mail",
                    "type": "string"
                },
                "phone": {
                    "description": "preferably always specified if available, mandatory if delivery method is SMS",
                    "type": "string"
                },
                "gln": {
                    "description": "not mandatory for e-invoices, but helps with identifying the correct channel",
                    "type": "string"
                }
            }
        },
        "NewDirectPayment": {
            "required": [
                "externalNumber",
                "allocations"
            ],
            "properties": {
                "externalNumber": {
                    "description": "ID of the payment in external system, must be unique",
                    "type": "string"
                },
                "paymentDate": {
                    "description": "original payment date if payment was made in the past and not matched to any invoices until now, cannot be a future date, defaults to today if not provided",
                    "type": "string",
                    "pattern": "\\d{4}-\\d{2}-\\d{2}"
                },
                "allocations": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/NewDirectPaymentAllocation"
                    }
                }
            },
            "example": {
                "externalNumber": "1234",
                "allocations": [
                    {
                        "invoiceId": "knVkZp1ZRaI",
                        "amount": 100
                    },
                    {
                        "invoiceId": "Ps0776Pc0jY",
                        "amount": 50
                    }
                ]
            }
        },
        "NewDirectPaymentAllocation": {
            "required": [
                "amount"
            ],
            "properties": {
                "debitId": {
                    "description": "**DEPRECATED** - use `invoiceId` instead",
                    "type": "string"
                },
                "invoiceId": {
                    "description": "ID of invoice to register to",
                    "type": "string"
                },
                "invoiceOcr": {
                    "description": "OCR of invoice to register to",
                    "type": "string"
                },
                "invoiceExternalNumber": {
                    "description": "invoice number to register to",
                    "type": "string"
                },
                "amount": {
                    "description": "amount to register, in the same currency as the debit it is registered to",
                    "type": "number",
                    "format": "double"
                }
            }
        },
        "NewInvoice": {
            "required": [
                "externalNumber",
                "debtor",
                "rows"
            ],
            "properties": {
                "externalNumber": {
                    "description": "invoice number in external system, must be unique",
                    "type": "string"
                },
                "type": {
                    "description": "if specified, gives validation error if the sum of the debit is negative or the sum of the credit is positive",
                    "type": "string",
                    "enum": [
                        "DEBIT",
                        "STANDALONE_CREDIT"
                    ]
                },
                "reservation": {
                    "description": "whether to create the invoice as a reservation which must be finalized before actually being sent",
                    "type": "boolean",
                    "default": false
                },
                "service": {
                    "description": "specific service to use if multiple services are active on the same account at once",
                    "type": "string"
                },
                "deliveryMethod": {
                    "description": "Primary delivery method for invoice. If not specified, it will automatically be selected from the fields specified on the given debtor.",
                    "type": "string",
                    "enum": [
                        "DO_NOT_SEND",
                        "EMAIL",
                        "POSTAL",
                        "E_INVOICE_COMPANY",
                        "E_INVOICE_BANK",
                        "E_INVOICE",
                        "DYNAMIC",
                        "DIGITAL_MAILBOX",
                        "EXTERNAL"
                    ]
                },
                "sendAs": {
                    "description": "the type of distribution to start with",
                    "type": "string",
                    "default": "INVOICE",
                    "enum": [
                        "INVOICE",
                        "REMINDER",
                        "DEBT_COLLECTION"
                    ]
                },
                "overdueInterestRate": {
                    "description": "Yearly overdue interest rate in percentage. Default to configuration on creditor.",
                    "type": "number",
                    "format": "double",
                    "minimum": 0
                },
                "allowEnforcementAuthority": {
                    "description": "Whether the invoice can be sent to enforcement authority if still not paid after collection process. Defaults to configuration on creditor.",
                    "type": "boolean"
                },
                "allowAmortization": {
                    "description": "Once the invoice has gone to collection, whether the debtor can pay the debt over several months. Defaults to configuration on creditor.",
                    "type": "boolean"
                },
                "cashRounding": {
                    "description": "whether to round invoice total",
                    "type": "boolean",
                    "default": false
                },
                "invoiceDate": {
                    "description": "invoice date, or today's date if not specified",
                    "type": "string",
                    "pattern": "\\d{4}-\\d{2}-\\d{2}"
                },
                "dueDate": {
                    "description": "invoice due date, otherwise will set a default based on invoice date",
                    "type": "string",
                    "pattern": "\\d{4}-\\d{2}-\\d{2}"
                },
                "deliveryDate": {
                    "type": "string",
                    "pattern": "\\d{4}-\\d{2}-\\d{2}"
                },
                "currencyCode": {
                    "description": "defaults to same currency as bookkeeping is done in",
                    "type": "string",
                    "pattern": "[A-Z]{3}"
                },
                "currencyExchangeRate": {
                    "description": "mandatory if different currency than bookkeeping is done in",
                    "type": "number",
                    "format": "double"
                },
                "vatIncluded": {
                    "description": "whether to include VAT on row totals when displaying or printing, defaults to true for individual debtors and false for organizations",
                    "type": "boolean"
                },
                "vatRoundingPerRow": {
                    "description": "Whether to round VAT on each row, otherwise rounding is done at the end. If `vatIncluded` is `true` then rounding per row will be done anyways.",
                    "type": "boolean",
                    "default": false
                },
                "reverseCharge": {
                    "description": "whether reverse charge should apply, will default to true if no VAT was specified on any rows and the debtor is an organization in another EU country than the creditor",
                    "type": "boolean"
                },
                "taxReduction": {
                    "description": "whether the invoice was affected by tax reductions",
                    "type": "boolean",
                    "default": false
                },
                "languageCode": {
                    "description": "The language to use when sending the invoice, defaults to `sv` if debtor is located in Sweden, otherwise `en`. Any language code without translations will use English instead.",
                    "type": "string",
                    "pattern": "[a-z]{2}"
                },
                "comment": {
                    "description": "comment to print on the invoice",
                    "type": "string"
                },
                "yourReference": {
                    "type": "string"
                },
                "ourReference": {
                    "type": "string"
                },
                "yourReferenceId": {
                    "type": "string"
                },
                "ourReferenceId": {
                    "type": "string"
                },
                "yourOrderNumber": {
                    "type": "string"
                },
                "ourOrderNumber": {
                    "type": "string"
                },
                "edi": {
                    "$ref": "#/definitions/NewInvoiceEdi"
                },
                "reference": {
                    "type": "string"
                },
                "termsOfDelivery": {
                    "type": "string"
                },
                "project": {
                    "type": "string"
                },
                "debtor": {
                    "$ref": "#/definitions/NewDebtor"
                },
                "rows": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/NewInvoiceRow"
                    }
                },
                "attachment": {
                    "description": "**DEPRECATED** - kept for backward compatibility reasons, use `attachments` instead",
                    "$ref": "#/definitions/NewAttachment"
                },
                "attachments": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/NewAttachment"
                    }
                },
                "sumValidation": {
                    "$ref": "#/definitions/SumValidation"
                },
                "extendedFields": {
                    "description": "additional fields that are used for custom or experimental features",
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/ExtendedField"
                    }
                }
            },
            "example": {
                "debtor": {
                    "nationalIdentifier": {
                        "number": "5560139700",
                        "countryCode": "SE"
                    }
                },
                "externalNumber": "123",
                "rows": [
                    {
                        "text": "Stuff",
                        "unit": "box",
                        "unitPrice": 125.5,
                        "quantity": 2,
                        "vatPercentage": 25,
                        "priceExcludingVat": false
                    }
                ]
            }
        },
        "NewInvoiceEdi": {
            "description": "Additional electronic data interchange (EDI) fields only used with e-invoices.",
            "required": [],
            "properties": {
                "yourReference": {
                    "type": "string"
                },
                "yourOrderNumber": {
                    "type": "string"
                }
            }
        },
        "NewInvoiceRow": {
            "required": [
                "text"
            ],
            "properties": {
                "externalNumber": {
                    "description": "optional reference to row that can be matched when fetching invoice or crediting the specific row",
                    "type": "string"
                },
                "type": {
                    "description": "Type of row. Overdue interest will be calculated on rows of type `CAPITAL` and `FEE_CAPITAL`. Defaults to `CAPITAL` if `feeType` is `null`, otherwise `FEE_NO_INTEREST`.",
                    "type": "string",
                    "enum": [
                        "CAPITAL",
                        "FEE_CAPITAL",
                        "FEE_NO_INTEREST",
                        "TAX_REDUCTION"
                    ]
                },
                "feeType": {
                    "description": "type of fee, otherwise the row will be considered part of capital",
                    "type": "string",
                    "enum": [
                        "reminder"
                    ]
                },
                "articleNumber": {
                    "type": "string"
                },
                "text": {
                    "type": "string"
                },
                "description": {
                    "type": "string"
                },
                "unit": {
                    "type": "string"
                },
                "unitPrice": {
                    "type": "number",
                    "format": "double",
                    "default": 0
                },
                "quantity": {
                    "type": "number",
                    "format": "double",
                    "default": 1
                },
                "discountTotal": {
                    "description": "total price discount, cannot be used in combination with `discountPercentage` or `percentageMarkup`",
                    "type": "number",
                    "format": "double",
                    "default": 0
                },
                "discountPercentage": {
                    "description": "percentage discount of row, for example 50.00 SEK with 10% discount results in 45.00 SEK, cannot be used in combination with `discountTotal` or `percentageMarkup`",
                    "type": "number",
                    "format": "double",
                    "default": 0,
                    "maximum": 100,
                    "minimum": 0
                },
                "percentageMarkup": {
                    "description": "percentage markup of row, for example 50.00 SEK with 10% markup results in 55.00 SEK, cannot be used in combination with `discountTotal` or `discountPercentage`",
                    "type": "number",
                    "format": "double",
                    "default": 0,
                    "minimum": -100
                },
                "vatPercentage": {
                    "type": "number",
                    "format": "double",
                    "default": 0,
                    "minimum": 0
                },
                "priceExcludingVat": {
                    "description": "whether the `unitPrice` and `discountTotal` is specified without VAT",
                    "type": "boolean",
                    "default": false
                },
                "project": {
                    "type": "string"
                },
                "profitUnit": {
                    "type": "string"
                },
                "bookkeepingAccount": {
                    "type": "string"
                },
                "sumValidation": {
                    "$ref": "#/definitions/SumValidation"
                }
            }
        },
        "NewNationalIdentifier": {
            "description": "National identification number (NIN), unique identifier for a legal entity in a specific country",
            "required": [
                "number"
            ],
            "properties": {
                "number": {
                    "type": "string"
                },
                "countryCode": {
                    "description": "ISO 3166-1 alpha 2",
                    "type": "string",
                    "pattern": "[A-Z]{2}"
                }
            }
        },
        "PaginationInfo": {
            "required": [
                "totalSize",
                "pageSize",
                "pageCount",
                "pageNumber"
            ],
            "properties": {
                "totalSize": {
                    "description": "total number of hits",
                    "type": "integer"
                },
                "pageSize": {
                    "description": "number of hits per page",
                    "type": "integer"
                },
                "pageCount": {
                    "description": "number of pages",
                    "type": "integer"
                },
                "pageNumber": {
                    "description": "current page number",
                    "type": "integer"
                }
            }
        },
        "PatchCreditor": {
            "required": [],
            "properties": {
                "status": {
                    "$ref": "#/definitions/PatchCreditorStatus"
                }
            }
        },
        "PatchCreditorStatus": {
            "required": [],
            "properties": {
                "reseller": {
                    "type": "string",
                    "enum": [
                        "ACTIVE",
                        "INACTIVE"
                    ]
                },
                "financialPartner": {
                    "type": "string",
                    "enum": [
                        "ACTIVE",
                        "INACTIVE"
                    ]
                }
            }
        },
        "PatchDebtor": {
            "required": [],
            "properties": {
                "name": {
                    "type": "string"
                },
                "billingAddress": {
                    "$ref": "#/definitions/Address"
                },
                "email": {
                    "type": "string"
                },
                "phone": {
                    "type": "string"
                },
                "gln": {
                    "type": "string"
                }
            }
        },
        "PatchInvoice": {
            "required": [],
            "properties": {
                "service": {
                    "type": "string"
                },
                "financialPartnerService": {
                    "type": "string"
                },
                "deliveryMethod": {
                    "type": "string",
                    "enum": [
                        "DO_NOT_SEND",
                        "EMAIL",
                        "POSTAL",
                        "E_INVOICE_COMPANY",
                        "E_INVOICE_BANK",
                        "E_INVOICE",
                        "DYNAMIC",
                        "DIGITAL_MAILBOX",
                        "EXTERNAL"
                    ]
                },
                "debtor": {
                    "$ref": "#/definitions/PatchDebtor"
                },
                "invoiceDate": {
                    "type": "string",
                    "pattern": "\\d{4}-\\d{2}-\\d{2}"
                },
                "dueDate": {
                    "description": "if `invoiceDate` is given but `dueDate` is not, the invoice due date will be adjusted to same payment terms as before",
                    "type": "string",
                    "pattern": "\\d{4}-\\d{2}-\\d{2}"
                }
            }
        },
        "PaymentAccount": {
            "required": [
                "raw",
                "pretty"
            ],
            "properties": {
                "raw": {
                    "description": "raw format",
                    "type": "string"
                },
                "pretty": {
                    "description": "pretty printed format that can be displayed to end user",
                    "type": "string"
                }
            }
        },
        "PaymentDetails": {
            "required": [
                "paymentReference",
                "paymentReferenceType"
            ],
            "properties": {
                "paymentReference": {
                    "description": "payment reference the debtor should supply when making the payment.",
                    "type": "string"
                },
                "paymentReferenceType": {
                    "type": "string",
                    "enum": [
                        "OCR"
                    ]
                },
                "payee": {
                    "type": "string"
                },
                "payeeNationalIdentifier": {
                    "$ref": "#/definitions/NationalIdentifier"
                },
                "bic": {
                    "description": "BIC/SWIFT, bank identifier for international bank transfers, i.e. used with IBAN",
                    "type": "string"
                },
                "iban": {
                    "description": "international bank account number",
                    "$ref": "#/definitions/PaymentAccount"
                },
                "bban": {
                    "description": "country-specific back account number",
                    "$ref": "#/definitions/PaymentAccount"
                },
                "bg": {
                    "description": "BG, Bankgiro",
                    "$ref": "#/definitions/PaymentAccount"
                },
                "swish": {
                    "$ref": "#/definitions/PaymentAccount"
                }
            }
        },
        "ProcessStep": {
            "required": [
                "general",
                "type",
                "date"
            ],
            "properties": {
                "general": {
                    "description": "All steps can be catagorized in four groups. Even when new country specific steps are added, no new general types will be added.",
                    "type": "string",
                    "enum": [
                        "INVOICE",
                        "DUNNING",
                        "COLLECTION",
                        "ENFORCEMENT"
                    ]
                },
                "type": {
                    "type": "string",
                    "enum": [
                        "EXTERNAL_INVOICE",
                        "INVOICE",
                        "REMINDER",
                        "DEBT_COLLECTION",
                        "FINAL_NOTICE",
                        "KFM",
                        "3PC"
                    ]
                },
                "date": {
                    "type": "string",
                    "pattern": "\\d{4}-\\d{2}-\\d{2}"
                }
            }
        },
        "BoardingResponse": {
            "required": [
                "data"
            ],
            "properties": {
                "data": {
                    "$ref": "#/definitions/Boarding"
                }
            }
        },
        "BundleCostsResponse": {
            "required": [
                "data"
            ],
            "properties": {
                "data": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/BundleCost"
                    }
                }
            }
        },
        "ClosureResponse": {
            "required": [
                "data"
            ],
            "properties": {
                "data": {
                    "$ref": "#/definitions/Closure"
                }
            }
        },
        "CreditCheckResponse": {
            "required": [
                "data"
            ],
            "properties": {
                "data": {
                    "$ref": "#/definitions/CreditCheck"
                }
            }
        },
        "CreditResponse": {
            "required": [
                "data"
            ],
            "properties": {
                "data": {
                    "$ref": "#/definitions/Credit"
                }
            }
        },
        "CreditSearchResponse": {
            "required": [
                "pagination",
                "data"
            ],
            "properties": {
                "pagination": {
                    "$ref": "#/definitions/PaginationInfo"
                },
                "data": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/CreditSearchResult"
                    }
                }
            }
        },
        "CreditorResponse": {
            "required": [
                "data"
            ],
            "properties": {
                "data": {
                    "$ref": "#/definitions/Creditor"
                }
            }
        },
        "DirectPaymentResponse": {
            "required": [
                "data"
            ],
            "properties": {
                "data": {
                    "$ref": "#/definitions/DirectPayment"
                }
            },
            "example": {
                "data": {
                    "allocations": [
                        {
                            "invoiceId": "knVkZp1ZRaI",
                            "invoiceAmountLeft": 0,
                            "surplus": 0,
                            "capital": 100,
                            "interest": 0,
                            "fees": 0
                        },
                        {
                            "invoiceId": "Ps0776Pc0jY",
                            "invoiceAmountLeft": 250,
                            "surplus": 0,
                            "capital": 20,
                            "interest": 10,
                            "fees": 20
                        }
                    ]
                }
            }
        },
        "ErrorResponse": {
            "required": [
                "errorCode",
                "message",
                "details"
            ],
            "properties": {
                "errorCode": {
                    "type": "string"
                },
                "message": {
                    "type": "string"
                },
                "details": {
                    "type": "string"
                }
            }
        },
        "FinancialReportBundleResponse": {
            "required": [
                "data"
            ],
            "properties": {
                "data": {
                    "$ref": "#/definitions/FinancialReportBundle"
                }
            }
        },
        "FinancialReportSearchResponse": {
            "required": [
                "pagination",
                "data"
            ],
            "properties": {
                "pagination": {
                    "$ref": "#/definitions/PaginationInfo"
                },
                "data": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/FinancialReportSearchResult"
                    }
                }
            },
            "example": {
                "pagination": {
                    "totalSize": 4,
                    "pageSize": 100,
                    "pageCount": 1,
                    "pageNumber": 1
                },
                "data": [
                    {
                        "id": "MQbE2iSwpUM",
                        "_fileLink": "/v4/rest/financial-report/MQbE2iSwpUM/file",
                        "createdAt": "2024-02-27T06:57:21+01:00",
                        "name": "Avr\u00e4kningsnota_Mitt F\u00f6retag AB_Inkassogram_SEK_2024-02-27-065721109.pdf",
                        "type": "SALES_NOTE",
                        "mediaType": "application/pdf"
                    },
                    {
                        "id": "hASDeQVPtK0",
                        "_fileLink": "/v4/rest/financial-report/hASDeQVPtK0/file",
                        "createdAt": "2024-02-27T06:57:21+01:00",
                        "name": "Avr\u00e4kningsnota_Mitt F\u00f6retag AB_Inkassogram_SEK_2024-02-27-065721397.TXT",
                        "type": "SALES_NOTE",
                        "mediaType": "text/plain"
                    },
                    {
                        "id": "GU4zQCUIJ1E",
                        "_fileLink": "/v4/rest/financial-report/GU4zQCUIJ1E/file",
                        "createdAt": "2024-02-27T06:57:21+01:00",
                        "name": "verifikation Mitt Foretag AB Avrakningsnota SEK 2024-02-27-065721439.SI",
                        "type": "SALES_NOTE",
                        "mediaType": "text/plain"
                    },
                    {
                        "id": "O47M825ndMo",
                        "_fileLink": "/v4/rest/financial-report/O47M825ndMo/file",
                        "createdAt": "2024-02-27T06:57:21+01:00",
                        "name": "Avr\u00e4kningsnota_Mitt Foretag AB_Inkassogram_SEK_2024-02-27-065721543.csv",
                        "type": "SALES_NOTE",
                        "mediaType": "text/csv"
                    }
                ]
            }
        },
        "InvoiceResponse": {
            "required": [
                "data"
            ],
            "properties": {
                "data": {
                    "$ref": "#/definitions/Invoice"
                }
            }
        },
        "InvoiceSearchResponse": {
            "required": [
                "pagination",
                "data"
            ],
            "properties": {
                "pagination": {
                    "$ref": "#/definitions/PaginationInfo"
                },
                "data": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/InvoiceSearchResult"
                    }
                }
            }
        },
        "LegalEntityResponse": {
            "required": [
                "data"
            ],
            "properties": {
                "data": {
                    "$ref": "#/definitions/LegalEntity"
                }
            }
        },
        "PaymentDetailsResponse": {
            "required": [
                "data"
            ],
            "properties": {
                "data": {
                    "$ref": "#/definitions/PaymentDetails"
                }
            }
        },
        "SignaturesResponse": {
            "required": [
                "data"
            ],
            "properties": {
                "data": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/Signature"
                    }
                }
            }
        },
        "Signature": {
            "required": [],
            "properties": {
                "nationalIdentifier": {
                    "$ref": "#/definitions/NationalIdentifier"
                },
                "name": {
                    "type": "string"
                }
            }
        },
        "SumValidation": {
            "description": "Optional fields for validating the sum of an invoice or row. Mismatch gives error and no invoice is created.",
            "required": [],
            "properties": {
                "totalInclVat": {
                    "description": "expected total price including VAT",
                    "type": "number",
                    "format": "double"
                },
                "totalExclVat": {
                    "description": "expected total price excluding VAT",
                    "type": "number",
                    "format": "double"
                },
                "totalVat": {
                    "description": "expected total VAT",
                    "type": "number",
                    "format": "double"
                }
            }
        }
    },
    "securityDefinitions": {
        "Bearer Auth": {
            "type": "apiKey",
            "description": "Token authorized through Vanguard, see [this](https://auth.waya.se/vanguard/v2.0/swagger.html#/) documentation for details.\n\n**NOTE** Usage is `Bearer <Vanguard token>` when sending it in the `Authorization` header.\n\n---",
            "name": "Authorization",
            "in": "header"
        },
        "Basic Auth": {
            "type": "basic",
            "description": "Encoded using integration ID as username and integration key as password.\n\n**NOTE** Use the additional header `waya-customer-number` in order to specify which customer to act on when making requests.\n\n**NOTE** This authentication method is by default disabled as Vanguard is the preferred method.\n\n---"
        },
        "Customer Number": {
            "type": "apiKey",
            "description": "Specify which customer to act on.\n\n**NOTE** Not required when using Vanguard.\n\n---",
            "name": "waya-customer-number",
            "in": "header"
        }
    },
    "security": [
        {
            "Basic Auth": [],
            "Customer Number": []
        },
        {
            "Bearer Auth": []
        }
    ],
    "tags": [
        {
            "name": "Boarding"
        },
        {
            "name": "Credit"
        },
        {
            "name": "Creditor"
        },
        {
            "name": "Direct Payment"
        },
        {
            "name": "Financial Report Bundle"
        },
        {
            "name": "Financial Report"
        },
        {
            "name": "Invoice"
        },
        {
            "name": "Legal Entity"
        }
    ]
}