{
    "openapi": "3.1.0",
    "info": {
        "title": "wefiscal.com API",
        "version": "v1 (Commit: e6fa132)",
        "description": "# Introduction\n\nThis document details the Wefiscal REST API, an advanced engine for generating, signing, and transmitting fiscal documents to authorities like AADE (myDATA) and the PEPPOL B2G Network.\n\n> [!TIP]\n> **New to the API?** \n> Check out the [API Startup Guide: 100% Headless Onboarding](STARTUP_GUIDE.md) to learn how to provision companies, generate WeFiscal machines, and issue your first invoice dynamically without ever logging into the UI!\n\n### Postman / OpenAPI Export\nYou can test this API directly in **Postman** by importing our OpenAPI specification.  \n\ud83d\udc49 [**Download OpenAPI Collection (Postman JSON)**](/docs/api.json) *(Right-click and select **Save Link As...**)*\n\n---\n\n## Table of Contents\n- [Base URL & General Information](#base-url--general-information)\n- [Authentication & Headers](#authentication--headers)\n- [Global Response Codes](#global-response-codes)\n- [API Endpoints](#api-endpoints)\n  - [User Endpoints](#user-endpoints)\n    - [GET /api/user](#get-apiuser)\n  - [Invoice Endpoints](#invoice-endpoints)\n    - [POST /api/v1/invoices](#post-apiv1invoices)\n    - [POST /api/v1/invoices/{mark}/cancel](#post-apiv1invoicesmarkcancel)\n    - [GET /api/v1/invoices](#get-apiv1invoices)\n    - [GET /api/v1/invoices/{id}](#get-apiv1invoicesid)\n    - [POST /api/v1/invoices/{id}/cancel](#post-apiv1invoicesidcancel)\n    - [GET /api/v1/transmitted-docs](#get-apiv1transmitted-docs)\n  - [Company Endpoints](#company-endpoints)\n    - [GET /api/v1/companies](#get-apiv1companies)\n    - [GET /api/v1/companies/{id}](#get-apiv1companiesid)\n    - [PUT/PATCH /api/v1/companies/{id}](#putpatch-apiv1companiesid)\n  - [E-Sign Endpoints](#e-sign-endpoints)\n    - [POST /api/v1/esign](#post-apiv1esign)\n    - [GET /api/v1/esign/{id}](#get-apiv1esignid)\n  - [Settings Endpoints](#settings-endpoints)\n    - [GET /api/v1/settings](#get-apiv1settings)\n    - [PUT/PATCH /api/v1/settings](#putpatch-apiv1settings)\n\n---\n\n## Base URL & General Information\n\nAll API requests must be made over HTTPS. The default base URL for the API is:\n```\nhttps://app.wefiscal.com/api\n```\nAll routes defined in this document (except `/api/user`) are prefixed with `/v1`.\n\n---\n\n## Authentication & Headers\n\nThe API uses Laravel Sanctum for bearer token authentication. In addition, requests under the `/v1` prefix require machine key verification via custom headers.\n\n### Required Headers\n\n| Header | Description | Required |\n| :--- | :--- | :--- |\n| `Authorization`<br>_String_ | Bearer token format: `Bearer {token}`. Authenticates the API user. | **Yes** |\n| `X-Machine-Key`<br>_String_ | Active key of the Sign Machine (fiscal box). If missing, `X-Machine-Key` will be checked. | **Yes** (For `/v1/*` routes) |\n| `X-Machine-Key`<br>_String_ | Alternative to `X-Machine-Key`. Active key of the Sign Machine. | **Yes** (If `X-Machine-Key` is not sent) |\n| `X-ISV-ID`<br>_String_ | Custom ISV/Partner identification header. | No |\n| `X-Partner-ID`<br>_String_ | Alternative to `X-ISV-ID`. Custom ISV/Partner identification header. | No |\n\n*Note: In the `/v1` route group, the `RequireMachineKey` middleware ensures that the requested `SignMachine` belongs to one of the authenticated user's companies and activates that company context for the request.*\n\n---\n\n## Global Response Codes\n\nThe API returns standard HTTP status codes to indicate success or failure:\n\n*   **200 OK**: The request succeeded.\n*   **201 Created**: A resource was successfully created.\n*   **400 Bad Request**: Malformed JSON payload or empty request body.\n*   **401 Unauthorized**: Missing/invalid bearer token or missing/invalid Sign Box machine key.\n*   **403 Forbidden**: Authenticated user is not authorized to access the resolved Sign Box/Company.\n*   **404 Not Found**: The requested resource was not found.\n*   **422 Unprocessable Content**: The request payload failed validation checks.\n*   **500/502/503 Server Errors**: Internal server error, bad gateway, or external service (e.g. myDATA) connection timeout.\n\n---\n\n## API Endpoints\n\n### User Endpoints\n\n#### GET /api/user\n\nRetrieve the profile details of the currently authenticated user.\n\n*   **Authentication**: `auth:sanctum` (Bearer Token only)\n*   **HTTP Method**: `GET`\n*   **Headers**:\n    *   `Authorization: Bearer <token>` (Required)\n\n##### Success Response (200 OK)\n```json\n{\n  \"id\": 1,\n  \"name\": \"Jane Doe\",\n  \"email\": \"jane@example.com\",\n  \"email_verified_at\": \"2026-07-01T12:00:00.000000Z\",\n  \"created_at\": \"2026-06-25T10:00:00.000000Z\",\n  \"updated_at\": \"2026-07-01T12:00:00.000000Z\"\n}\n```\n\n##### Error Responses\n*   **401 Unauthorized** (Invalid/missing token)\n    ```json\n    {\n      \"message\": \"Unauthenticated.\"\n    }\n    ```\n\n---\n\n### Invoice Endpoints\n\n#### POST /api/v1/invoices\n\nTransmit an invoice payload to AADE via the active Sign Box (fiscal provider/box).\n\n*   **Authentication**: `auth:sanctum` + `RequireMachineKey`\n*   **HTTP Method**: `POST`\n*   **Headers**:\n    *   `Authorization: Bearer <token>` (Required)\n    *   `X-Machine-Key: <key>` or `X-Machine-Key: <key>` (Required)\n    *   `X-ISV-ID: <id>` or `X-Partner-ID: <id>` (Optional)\n\n##### Request Body Fields (JSON)\n\n| Field | Rules | Description |\n| :--- | :--- | :--- |\n| `invoice_number`<br>_String_ | Nullable. *Required if `series` and `aa` are not both provided.* | The unique document/invoice number. |\n| `issuer_vat_number`<br>_String_ | **Required**. | The VAT identification number of the invoice issuer. |\n| `series`<br>_String_ | Nullable. *Required if `invoice_number` is empty.* | The invoice series indicator (e.g. \"A\"). |\n| `aa`<br>_String_ | Nullable. *Required if `invoice_number` is empty.* | The sequential invoice serial number (e.g. \"123\"). |\n| `invoice_type_id`<br>_String_ | Nullable. | The myDATA invoice type ID (e.g. \"1.1\"). |\n| `issue_date`<br>_String_ | **Required**, format `Y-m-d`. | Date the invoice was issued. **Must strictly be today's date**. |\n| `currency`<br>_String_ | Nullable, length strictly 3. | 3-letter currency code (e.g. \"EUR\"). |\n| `total_net_value`<br>_Numeric_ | **Required**, minimum `0`. | The net value of all invoice lines. |\n| `total_vat_amount`<br>_Numeric_ | **Required**, minimum `0`. | The total VAT amount of all invoice lines. |\n| `total_gross_value`<br>_Numeric_ | **Required**, minimum `0`. | The total gross value. **Must match `total_net_value + total_vat_amount` within 0.01 tolerance.** |\n| `customer_street`<br>_String_ | Nullable. | The street address of the customer. |\n| `lines`<br>_Array_ | **Required**. | List of line items in the invoice. |\n| `lines.*.line_number`<br>_Integer_ | **Required**. | Sequential line number. |\n| `lines.*.net_value`<br>_Numeric_ | **Required**, minimum `0`. | Net value of this line. |\n| `lines.*.vat_amount`<br>_Numeric_ | **Required**, minimum `0`. | VAT amount of this line. |\n| `lines.*.vat_percent`<br>_Integer_ | **Required**. | VAT percentage of this line (e.g., `24`). |\n| `lines.*.vat_exemption_category_id`<br>_String_ | Nullable. | myDATA VAT exemption category ID if VAT percent is `0` or VAT-exempt. |\n| `lines.*.description`<br>_String_ | Nullable. | Description of the item or service. |\n| `lines.*.invoice_detail_type` \\<br>_`invoiceDetailType`_ | Integer | Nullable. | detail type code for classification. |\n| `lines.*.rec_type` \\<br>_`recType`_ | Integer | Nullable. | Record type. |\n| `lines.*.fees_amount` \\<br>_`feesAmount`_ | Numeric | Nullable. | Fees amount on the line. |\n| `lines.*.fees_percent_category` \\<br>_`feesPercentCategory`_ | Integer | Nullable. | Fees percentage category. |\n| `lines.*.line_comments` \\<br>_`lineComments`_ | String | Nullable. | Comments specific to the line. |\n| `payments`<br>_Array_ | Nullable. | Array containing payment method details. |\n| `payments.*.payment_method_id`<br>_Integer_ | Nullable. | Payment method identifier. |\n| `payments.*.amount`<br>_Numeric_ | **Required**, minimum `0`. | Amount allocated to this payment. |\n| `payments.*.pos_transaction_id`<br>_String_ | Nullable. | Associated POS transaction ID. |\n| `payments.*.session_transaction_id`<br>_String_ | Nullable. | POS session transaction ID. |\n| `meta`<br>_Array_ | Nullable. | Predefined template mappings or extra metadata overrides. |\n| `meta.fiscal_template_id`<br>_String/Int_ | Nullable. | Resolves preset classification values from template. |\n| `meta.payment_template_id`<br>_String/Int_ | Nullable. | Resolves payment method from template. |\n| `meta.isv_id`<br>_String_ | Nullable. | ISV Identifier. |\n| `meta.machine_payload`<br>_Object_ | Nullable. | Payload containing specific overrides for the AADE / myDATA WeFiscal machine (and other universal wefiscal machines). [See Payload Reference](API_PAYLOAD_REFERENCE.md#1-universal-provider-overrides-metamachine_payload) for all available fields. |\n| `meta.peppol_payload`<br>_Object_ | Nullable. | Payload containing complete decoupling options for PEPPOL B2G WeFiscal machines. [See Payload Reference](API_PAYLOAD_REFERENCE.md#2-peppol--b2g-node-metapeppol_payload) for all available fields. |\n\n*Note: If `payments` is provided, the sum of all `payments.*.amount` values must equal `total_gross_value` within 0.01 tolerance.*\n\n##### Success Response (200 OK)\nReturns a unified response structure regardless of the WeFiscal machine used. The global identifiers (`uid`, `authentication_code`, `qr_url`) are returned at the root, while WeFiscal machine-specific data (like myDATA `mark` or PEPPOL `ubl_xml`) are encapsulated inside `meta.machine_responses`.\n```json\n{\n    \"status\": \"Success\",\n    \"uid\": \"7B57FDB30F7B6A251FFAA7533BACD9FD943F8790\",\n    \"authentication_code\": \"BF0E8C4A5081568F52D8FC7A5B2014788259B1DE\",\n    \"qr_url\": \"https://mydataapidev.aade.gr/TimologioQR/QRInfo?q=...\",\n    \"meta\": {\n        \"machine_responses\": [\n            {\n                \"machine_key\": \"box_123456789\", \n                \"status\": \"Success\",\n                \"metadata\": {\n                    \"mark\": \"400001965119703\"\n                }\n            }\n        ]\n    }\n}\n```\n\n##### Error Responses\n*   **400 Bad Request** (Malformed JSON or empty request body)\n    ```json\n    {\n      \"error\": \"Empty request body\"\n    }\n    ```\n*   **401 Unauthorized** (Missing or invalid authorization/keys)\n    ```json\n    {\n      \"error\": \"Missing X-Machine-Key header\"\n    }\n    ```\n*   **403 Forbidden** (Machine does not belong to user's companies)\n    ```json\n    {\n      \"error\": \"Unauthorized for this Sign Box\"\n    }\n    ```\n*   **422 Unprocessable Content** (Validation failed)\n    ```json\n    {\n      \"message\": \"Validation failed: gross value mismatch\",\n      \"errors\": {\n        \"total_gross_value\": [\n          \"Validation failed: gross value mismatch\"\n        ]\n      }\n    }\n    ```\n*   **503 Service Unavailable** (AADE/myDATA connection timed out or offline)\n    ```json\n    {\n      \"error\": \"Connection timed out\"\n    }\n    ```\n\n---\n\n#### POST /api/v1/invoices/{mark}/cancel\n\nCancel an active invoice using its AADE `mark`.\n\n*   **Authentication**: `auth:sanctum` + `RequireMachineKey`\n*   **HTTP Method**: `POST`\n*   **Path Parameters**:\n    *   `mark` (String, Required): The myDATA registration mark of the invoice.\n*   **Headers**:\n    *   `Authorization: Bearer <token>` (Required)\n    *   `X-Machine-Key: <key>` or `X-Machine-Key: <key>` (Required)\n\n##### Success Response (200 OK)\n```json\n{\n  \"status\": \"Success\",\n  \"cancellationMark\": \"40000987654321\"\n}\n```\n\n##### Error Responses\n*   **401 Unauthorized** (API key or Sanctum Bearer token expired/invalid)\n    ```json\n    {\n      \"error\": \"Invalid or revoked API key\"\n    }\n    ```\n*   **404 Not Found** (Invoice with the given mark not found under the company)\n    ```json\n    {\n      \"error\": \"Invoice not found\"\n    }\n    ```\n*   **422 Unprocessable Content** (AADE returned cancellation error)\n    ```json\n    {\n      \"error\": \"AADE Error: Document cannot be cancelled in its current status.\"\n    }\n    ```\n\n---\n\n#### GET /api/v1/invoices\n\nRetrieve a paginated list of all AADE Invoices associated with the resolved company.\n\n*   **Authentication**: `auth:sanctum` + `RequireMachineKey`\n*   **HTTP Method**: `GET`\n*   **Headers**:\n    *   `Authorization: Bearer <token>` (Required)\n    *   `X-Machine-Key: <key>` or `X-Machine-Key: <key>` (Required)\n*   **Query Parameters**:\n    *   `page` (Integer, Optional): Target pagination page. Defaults to `1`.\n\n##### Success Response (200 OK)\n```json\n{\n  \"current_page\": 1,\n  \"data\": [\n    {\n      \"id\": 12,\n      \"company_id\": 2,\n      \"invoice_id\": 45,\n      \"uid\": \"7F68A915BC02DA49E2...\",\n      \"mark\": \"4000012345678\",\n      \"cancelled_by_mark\": null,\n      \"issue_date\": \"2026-07-05\",\n      \"total_net_value\": \"100.00\",\n      \"total_vat_amount\": \"24.00\",\n      \"total_gross_value\": \"124.00\",\n      \"status\": \"active\",\n      \"can\": {\n        \"edit\": true,\n        \"changeLines\": false,\n        \"sendExpenseClassifications\": false\n      },\n      \"classifiedAs\": \"income\",\n      \"created_at\": \"2026-07-05T00:10:00.000000Z\",\n      \"updated_at\": \"2026-07-05T00:12:00.000000Z\"\n    }\n  ],\n  \"first_page_url\": \"https://app.wefiscal.com/api/v1/invoices?page=1\",\n  \"from\": 1,\n  \"last_page\": 1,\n  \"last_page_url\": \"https://app.wefiscal.com/api/v1/invoices?page=1\",\n  \"next_page_url\": null,\n  \"path\": \"https://app.wefiscal.com/api/v1/invoices\",\n  \"per_page\": 20,\n  \"prev_page_url\": null,\n  \"to\": 1,\n  \"total\": 1\n}\n```\n\n---\n\n#### GET /api/v1/invoices/{id}\n\nRetrieve full details of a specific AADE invoice, including lines, payment methods, and error history.\n\n*   **Authentication**: `auth:sanctum` + `RequireMachineKey`\n*   **HTTP Method**: `GET`\n*   **Path Parameters**:\n    *   `id` (Integer, Required): The database ID of the `AadeInvoice`.\n*   **Headers**:\n    *   `Authorization: Bearer <token>` (Required)\n    *   `X-Machine-Key: <key>` or `X-Machine-Key: <key>` (Required)\n\n##### Success Response (200 OK)\n```json\n{\n  \"id\": 12,\n  \"company_id\": 2,\n  \"invoice_id\": 45,\n  \"uid\": \"7F68A915BC02DA49E2...\",\n  \"mark\": \"4000012345678\",\n  \"cancelled_by_mark\": null,\n  \"issue_date\": \"2026-07-05\",\n  \"total_net_value\": \"100.00\",\n  \"total_vat_amount\": \"24.00\",\n  \"total_gross_value\": \"124.00\",\n  \"status\": \"active\",\n  \"can\": {\n    \"edit\": true,\n    \"changeLines\": false,\n    \"sendExpenseClassifications\": false\n  },\n  \"classifiedAs\": \"income\",\n  \"lines\": [\n    {\n      \"id\": 28,\n      \"aade_invoice_id\": 12,\n      \"line_number\": 1,\n      \"net_value\": \"100.00\",\n      \"vat_amount\": \"24.00\",\n      \"vat_category\": 1,\n      \"description\": \"Premium consulting service\",\n      \"created_at\": \"2026-07-05T00:10:00.000000Z\",\n      \"updated_at\": \"2026-07-05T00:10:00.000000Z\"\n    }\n  ],\n  \"payments\": [\n    {\n      \"id\": 10,\n      \"aade_invoice_id\": 12,\n      \"aade_payment_type_id\": 1,\n      \"amount\": \"124.00\",\n      \"payment_info\": null,\n      \"created_at\": \"2026-07-05T00:10:00.000000Z\",\n      \"updated_at\": \"2026-07-05T00:10:00.000000Z\"\n    }\n  ],\n  \"errors\": [],\n  \"created_at\": \"2026-07-05T00:10:00.000000Z\",\n  \"updated_at\": \"2026-07-05T00:12:00.000000Z\"\n}\n```\n\n##### Error Responses\n*   **404 Not Found**:\n    ```json\n    {\n      \"error\": \"Invoice not found\"\n    }\n    ```\n\n---\n\n#### GET /api/v1/transmitted-docs\n\nPassthrough endpoint for AADE's `RequestTransmittedDocs`. Retrieves a list of transmitted documents directly from myDATA or the YPAHES provider.\n\n*   **Authentication**: `auth:sanctum` + `RequireMachineKey`\n*   **HTTP Method**: `GET`\n*   **Headers**:\n    *   `Authorization: Bearer <token>` (Required)\n    *   `X-Machine-Key: <key>` or `X-Machine-Key: <key>` (Required)\n\n##### Query Parameters\n\n| Parameter | Required | Description |\n| :--- | :--- | :--- |\n| `mark`<br>_Integer_ | No | Fetch documents with MARK greater than this value. Defaults to `0`. |\n| `date_from`<br>_String_ | No | Format `Y-m-d`. Start date for the request. |\n| `date_to`<br>_String_ | No | Format `Y-m-d`. End date for the request. |\n\n##### Success Response (200 OK)\nReturns the raw JSON response parsed from the provider's `RequestTransmittedDocs` endpoint. Contains `invoices`, `cancelledInvoices`, `incomeClassifications`, and `expensesClassifications`.\n\n```json\n{\n  \"status\": \"ok\",\n  \"invoices\": [\n    {\n      \"mark\": \"40000123456789\",\n      \"uid\": \"1FA8B9...\",\n      \"issuerVat\": \"999999999\",\n      \"issueDate\": \"2026-09-19\"\n    }\n  ],\n  \"cancelledInvoices\": [],\n  \"incomeClassifications\": [],\n  \"expensesClassifications\": []\n}\n```\n\n##### Error Responses\n*   **400 Bad Request** (Error from provider)\n*   **500 Internal Server Error** (Connection failure or misconfiguration)\n\n---\n\n#### POST /api/v1/invoices/{id}/cancel\n\nCancel an active invoice using its database `id`.\n\n*   **Authentication**: `auth:sanctum` + `RequireMachineKey`\n*   **HTTP Method**: `POST`\n*   **Path Parameters**:\n    *   `id` (Integer, Required): The database ID of the AadeInvoice.\n*   **Headers**:\n    *   `Authorization: Bearer <token>` (Required)\n    *   `X-Machine-Key: <key>` or `X-Machine-Key: <key>` (Required)\n\n##### Success Response (200 OK)\n```json\n{\n  \"status\": \"Success\",\n  \"cancellationMark\": \"40000987654321\"\n}\n```\n\n##### Error Responses\n*   **404 Not Found**:\n    ```json\n    {\n      \"error\": \"Invoice not found\"\n    }\n    ```\n*   **422 Unprocessable Content**:\n    ```json\n    {\n      \"error\": \"AADE Error: Document cannot be cancelled in its current status.\"\n    }\n    ```\n\n---\n\n### Company Endpoints\n\n#### GET /api/v1/companies\n\nRetrieve a list of all companies belonging to the authenticated user.\n\n*   **Authentication**: `auth:sanctum` + `RequireMachineKey`\n*   **HTTP Method**: `GET`\n*   **Headers**:\n    *   `Authorization: Bearer <token>` (Required)\n    *   `X-Machine-Key: <key>` or `X-Machine-Key: <key>` (Required)\n\n##### Success Response (200 OK)\n```json\n[\n  {\n    \"id\": 2,\n    \"name\": \"Acme Corp\",\n    \"url\": \"acme.wefiscal.com\",\n    \"phone\": \"+302100000000\",\n    \"email\": \"info@acme.com\",\n    \"vat_reg_num\": \"EL999999999\",\n    \"country\": \"GR\",\n    \"city\": \"Athens\",\n    \"address\": \"Panepistimiou 10\",\n    \"postal_code\": \"10671\",\n    \"created_at\": \"2026-06-25T10:00:00.000000Z\",\n    \"updated_at\": \"2026-07-05T00:10:00.000000Z\"\n  }\n]\n```\n\n---\n\n#### GET /api/v1/companies/{id}\n\nRetrieve details of a specific company if associated with the authenticated user.\n\n*   **Authentication**: `auth:sanctum` + `RequireMachineKey`\n*   **HTTP Method**: `GET`\n*   **Path Parameters**:\n    *   `id` (Integer, Required): Company database ID.\n*   **Headers**:\n    *   `Authorization: Bearer <token>` (Required)\n    *   `X-Machine-Key: <key>` or `X-Machine-Key: <key>` (Required)\n\n##### Success Response (200 OK)\n```json\n{\n  \"id\": 2,\n  \"name\": \"Acme Corp\",\n  \"url\": \"acme.wefiscal.com\",\n  \"phone\": \"+302100000000\",\n  \"email\": \"info@acme.com\",\n  \"vat_reg_num\": \"EL999999999\",\n  \"country\": \"GR\",\n  \"city\": \"Athens\",\n  \"address\": \"Panepistimiou 10\",\n  \"postal_code\": \"10671\",\n  \"created_at\": \"2026-06-25T10:00:00.000000Z\",\n  \"updated_at\": \"2026-07-05T00:10:00.000000Z\"\n}\n```\n\n##### Error Responses\n*   **404 Not Found** (Company does not exist or user lacks permission)\n    ```json\n    {\n      \"error\": \"Company not found or unauthorized\"\n    }\n    ```\n\n---\n\n#### PUT/PATCH /api/v1/companies/{id}\n\nUpdate the information of a specific company.\n\n*   **Authentication**: `auth:sanctum` + `RequireMachineKey`\n*   **HTTP Method**: `PUT` or `PATCH`\n*   **Path Parameters**:\n    *   `id` (Integer, Required): Company database ID.\n*   **Headers**:\n    *   `Authorization: Bearer <token>` (Required)\n    *   `X-Machine-Key: <key>` or `X-Machine-Key: <key>` (Required)\n\n##### Request Body Fields (JSON)\n\n| Field | Rules | Description |\n| :--- | :--- | :--- |\n| `name`<br>_String_ | Optional (required if present), max 255. | Company name. |\n| `vat_reg_num`<br>_String_ | Optional (required if present), max 255. | Company VAT registration number. |\n| `country`<br>_String_ | Optional (required if present), max 10. | Company country code. |\n| `address`<br>_String_ | Optional (nullable if present), max 255. | Company physical address. |\n\n##### Success Response (200 OK)\nReturns the updated company object.\n```json\n{\n  \"id\": 2,\n  \"name\": \"Acme Corp Ltd\",\n  \"url\": \"acme.wefiscal.com\",\n  \"phone\": \"+302100000000\",\n  \"email\": \"info@acme.com\",\n  \"vat_reg_num\": \"EL999999999\",\n  \"country\": \"GR\",\n  \"city\": \"Athens\",\n  \"address\": \"Panepistimiou 20\",\n  \"postal_code\": \"10671\",\n  \"created_at\": \"2026-06-25T10:00:00.000000Z\",\n  \"updated_at\": \"2026-07-05T00:20:00.000000Z\"\n}\n```\n\n##### Error Responses\n*   **404 Not Found** (Company does not exist or user lacks permission)\n    ```json\n    {\n      \"error\": \"Company not found or unauthorized\"\n    }\n    ```\n*   **422 Unprocessable Content** (Validation failed)\n    ```json\n    {\n      \"message\": \"The vat reg num field is required when present.\",\n      \"errors\": {\n        \"vat_reg_num\": [\n          \"The vat reg num field must be a string.\"\n        ]\n      }\n    }\n    ```\n\n---\n\n### E-Sign Endpoints\n\nThis API allows you to issue and track E-Sign requests directly from an integrated system. By using the appropriate `X-Machine-Key` mapped to an `esign` provider, you can send dynamic templates (Text or HTML with CSS) or pre-generated PDFs.\n\n#### POST /api/v1/esign\n\nCreate a new E-Sign request and email it to the signer. The payload behavior changes depending on how you structure `machine_payload`.\n\n*   **Authentication**: `auth:sanctum`, `RequireMachineKey`\n*   **HTTP Method**: `POST`\n*   **Headers**:\n    *   `Authorization: Bearer <token>`\n    *   `X-Machine-Key: <machine_key>`\n\n##### Request Body (JSON)\n\n| Field | Description | Required |\n| :--- | :--- | :--- |\n| `signer_email`<br>_String_ | The email address of the person who will sign the document. | **Yes** |\n| `expires_in_minutes`<br>_Integer_ | The number of minutes before the document expires automatically. | No |\n| `in_person`<br>_String_ | If set to `\"hand\"`, the terminal directly opens the document signature screen (auto-draw mode). If set to `\"QR\"`, the terminal displays a QR code to be scanned by the user's mobile device. If omitted, the terminal ignores the document. This parameter can be placed at the root level or inside `machine_payload`. | No |\n| `machine_payload`<br>_Object_ | The configuration payload containing the document template or PDF. | **Yes** |\n| `machine_payload.fields_schema`<br>_Array_ | Optional schema defining dynamic fields (e.g., coordinates or inputs). | No |\n\n**You must provide exactly ONE of the following three payload properties inside `machine_payload`:**\n\n| Property | Description |\n| :--- | :--- |\n| `pdf_base64`<br>_String_ | A pre-generated PDF encoded in Base64. Use this if your system already renders the final PDF. |\n| `template_text`<br>_String_ | A simple text template. Rendered via TCPDF. Supports basic placeholders. |\n| `template_base64`<br>_String_ | An **HTML/CSS template** encoded in Base64. Rendered via Headless Chromium for pixel-perfect modern designs. Recommended for advanced templates. |\n\n**Example 1: Creating a Request with an HTML/CSS Template (Base64)**\n```json\n{\n  \"signer_email\": \"client@example.com\",\n  \"machine_payload\": {\n    \"template_base64\": \"PCFkb2N0eXBlIGh0bWw+PGh0bWw+PGJvZHk+PGgxPkhlbGxvIFdvcmxkPC9oMT48L2JvZHk+PC9odG1sPg==\",\n    \"fields_schema\": {}\n  }\n}\n```\n\n**Example 2: Creating a Request with a pre-generated PDF (Base64)**\n```json\n{\n  \"signer_email\": \"client@example.com\",\n  \"machine_payload\": {\n    \"pdf_base64\": \"JVBERi0xLjcKCjEgMCBvYmogICUgZW50cnkgcG9pbnQKPDwKICAvVHlwZSAvQ2F0YWxvZw...\",\n    \"fields_schema\": {}\n  }\n}\n```\n\n##### Success Response (200 OK)\n```json\n{\n  \"message\": \"E-Sign request created successfully.\",\n  \"request_id\": 142,\n  \"public_id\": \"doc_8f9e1b2a4c6d\",\n  \"token\": \"a1b2c3d4e5f6g7h8i9j0\"\n}\n```\n\n---\n\n#### GET /api/v1/esign/{id}\n\nRetrieve the status and details of a specific E-Sign request.\n\n*   **Authentication**: `auth:sanctum`, `RequireMachineKey`\n*   **HTTP Method**: `GET`\n*   **Headers**:\n    *   `Authorization: Bearer <token>`\n    *   `X-Machine-Key: <machine_key>`\n\n##### Success Response (200 OK)\n```json\n{\n  \"data\": {\n    \"id\": 142,\n    \"public_id\": \"doc_8f9e1b2a4c6d\",\n    \"signer_email\": \"client@example.com\",\n    \"status\": \"pending\",\n    \"signed_at\": null,\n    \"created_at\": \"2026-07-07T12:00:00.000000Z\"\n  }\n}\n```\n\n---\n\n### Settings Endpoints\n\n#### GET /api/v1/settings\n\nRetrieve settings for the resolved company.\n\n*   **Authentication**: `auth:sanctum` + `RequireMachineKey`\n*   **HTTP Method**: `GET`\n*   **Headers**:\n    *   `Authorization: Bearer <token>` (Required)\n    *   `X-Machine-Key: <key>` or `X-Machine-Key: <key>` (Required)\n\n##### Success Response (200 OK)\n```json\n{\n  \"company\": {\n    \"name\": \"Acme Corp\",\n    \"vat_reg_num\": \"EL999999999\",\n    \"country\": \"GR\",\n    \"address\": \"Panepistimiou 10\"\n  },\n  \"logo_path\": \"logos/acme.png\",\n  \"fiscal_templates\": [\n    {\n      \"id\": \"tpl_1\",\n      \"e3_classification_type\": \"E3_561_001\",\n      \"category\": \"category1\",\n      \"vat_exemption\": \"vat_exemption_1\",\n      \"invoice_detail_type\": 1\n    }\n  ],\n  \"payment_templates\": [\n    {\n      \"id\": \"pay_tpl_1\",\n      \"payment_method_id\": 1\n    }\n  ],\n  \"aade_provider\": \"direct\"\n}\n```\n\n---\n\n#### PUT/PATCH /api/v1/settings\n\nUpdate the settings and basic info of the resolved company. Flat and nested company structures are both supported.\n\n*   **Authentication**: `auth:sanctum` + `RequireMachineKey`\n*   **HTTP Method**: `PUT` or `PATCH`\n*   **Headers**:\n    *   `Authorization: Bearer <token>` (Required)\n    *   `X-Machine-Key: <key>` or `X-Machine-Key: <key>` (Required)\n\n##### Request Body Fields (JSON)\n\n| Field | Rules | Description |\n| :--- | :--- | :--- |\n| `name`<br>_String_ | Optional (required if present), max 255. | Flat update: Company name. |\n| `vat_reg_num`<br>_String_ | Optional (required if present), max 255. | Flat update: Company VAT number. |\n| `country`<br>_String_ | Optional (required if present), max 10. | Flat update: Company country code. |\n| `address`<br>_String_ | Optional (nullable if present), max 255. | Flat update: Company physical address. |\n| `logo_path`<br>_String_ | Optional (nullable if present), max 2048. | Flat update: Logo path. |\n| `company`<br>_Array/Object_ | Optional. | Nested company parameters object. |\n| `company.name`<br>_String_ | Optional (required if present), max 255. | Nested update: Company name. |\n| `company.vat_reg_num`<br>_String_ | Optional (required if present), max 255. | Nested update: Company VAT number. |\n| `company.country`<br>_String_ | Optional (required if present), max 10. | Nested update: Company country code. |\n| `company.address`<br>_String_ | Optional (nullable if present), max 255. | Nested update: Company physical address. |\n| `company.logo_path`<br>_String_ | Optional (nullable if present), max 2048. | Nested update: Logo path. |\n| `fiscal_templates`<br>_Array_ | Optional (nullable if present). | Predefined templates for invoicing. |\n| `payment_templates`<br>_Array_ | Optional (nullable if present). | Predefined templates for payments. |\n| `aade_provider`<br>_String_ | Optional (required if present), max 255. | Registered AADE transmission provider identifier. |\n\n##### Success Response (200 OK)\n```json\n{\n  \"status\": \"Success\",\n  \"message\": \"Settings updated successfully\"\n}\n```\n\n##### Error Responses\n*   **422 Unprocessable Content** (Validation failed)\n    ```json\n    {\n      \"message\": \"The company.country field must not be greater than 10 characters.\",\n      \"errors\": {\n        \"company.country\": [\n          \"The company.country field must not be greater than 10 characters.\"\n        ]\n      }\n    }\n    ```\n\n\n---\n\n# API Startup Guide\n\nWelcome to the Wefiscal API! Our architecture is designed to be a **pure API-first Fiscal Node**. This means that as an ISV (Independent Software Vendor) or Integrator, you can provision sub-accounts, configure signature mechanisms, and transmit invoices completely headlessly. **You never need to log into the web UI.**\n\nThis guide will walk you through the 3 simple steps to onboard a new client and issue their first invoice dynamically.\n\n---\n\n## The Workflow\n\nThere are three basic API calls required to go from zero to a successfully transmitted myDATA / PEPPOL invoice.\n\n1. **Create the Company (Tenant)**\n2. **Provision a WeFiscal machine**\n3. **Transmit the Invoice**\n\n### Prerequisites\nYou need your **Master API Key** (Sanctum Token). This token identifies you as the ISV and allows you to provision child accounts. Place this token in the `Authorization` header as a Bearer token for the first two setup steps.\n\n---\n\n## Step 1: Create the Company\nFirst, create a new company (tenant) profile for your client. You only need to pass their basic details like Name, VAT number, and Country.\n\n**Endpoint:** `POST /v1/companies`  \n**Headers:** `Authorization: Bearer {YOUR_MASTER_API_KEY}`\n\n```json\n{\n  \"name\": \"Acme Corp Ltd.\",\n  \"vat_reg_num\": \"999999999\",\n  \"country\": \"GR\",\n  \"address\": \"Ermou 15, Athens\"\n}\n```\n\n**Response:**\nYou will receive the created Company object. Note the `public_id` from the response (e.g., `comp_12345`), as you will need it for the next step.\n\n> [!NOTE]\n> **No AADE Credentials Needed!**\n> By default, the system acts as a certified Provider (\u03a5\u03a0\u0391\u0397\u0395\u03a3). It automatically utilizes central `.env` provider credentials to sign invoices on behalf of your sub-companies. You do not need to prompt your users for myDATA credentials unless you explicitly wish to override them.\n\n---\n\n## Step 2: Provision a WeFiscal machine\nNow that the company exists, you must provision a **WeFiscal machine** (Signature Mechanism) for them. A WeFiscal machine acts as the bridge to a specific fiscal authority (e.g., AADE myDATA or PEPPOL).\n\n**Endpoint:** `POST /v1/companies/{public_id}/machines`  \n**Headers:** `Authorization: Bearer {YOUR_MASTER_API_KEY}`\n\n```json\n{\n  \"provider\": \"mydata_prod\" \n}\n```\n*(Accepted providers: `mydata_prod`, `mydata_sandbox`, `peppol_prod`, `peppol_sandbox`, `verifatu`)*\n\n**Response:**\n```json\n{\n  \"wefiscal machine\": { ... },\n  \"machine_key\": \"box_abc123def456\"\n}\n```\n\n> [!IMPORTANT]\n> **Save the `machine_key`!**\n> This key acts as your isolated API Key for all fiscal operations related to this specific company and provider. You will use it in the `X-Machine-Key` header instead of your Master Token to issue invoices.\n\n---\n\n## Step 3: Transmit an Invoice (Fully Decoupled)\nYou are now ready to issue invoices! You do **not** need to pre-create customers, catalog items, or fiscal templates via the API. Our decoupled architecture allows you to inject all necessary data on-the-fly directly into the invoice payload.\n\n**Endpoint:** `POST /v1/invoices`  \n**Headers:** \n- `X-Machine-Key: {THE_WEFISCAL MACHINE_KEY_FROM_STEP_2}`\n\n```json\n{\n  \"series\": \"INV\",\n  \"aa\": \"100\",\n  \"issue_date\": \"2023-10-15\",\n  \"total_net_value\": 100.00,\n  \"total_vat_amount\": 24.00,\n  \"total_gross_value\": 124.00,\n  \n  \"counterpart_name\": \"Customer LLC\",\n  \"counterpart_vat_number\": \"888888888\",\n  \n  \"lines\": [\n    {\n      \"line_number\": 1,\n      \"description\": \"Software Development Services\",\n      \"net_value\": 100.00,\n      \"vat_percent\": 24,\n      \"vat_amount\": 24.00\n    }\n  ],\n  \n  \"payments\": [\n    {\n      \"amount\": 124.00,\n      \"payment_method_id\": 3\n    }\n  ],\n  \n  \"meta\": {\n    \"machine_payload\": {\n      \"classificationType\": \"E3_561_001\",\n      \"classificationCategory\": \"category1_2\",\n      \"isB2G\": false\n    }\n  }\n}\n```\n\n### Why this works:\n*   **Customers:** The system automatically extracts `counterpart_name` and `counterpart_vat_number` and dynamically maps or creates the customer record in the background.\n*   **Items:** The lines array takes raw strings (`description`) and monetary values. No pre-existing catalog item is required.\n*   **Mappings:** Instead of configuring UI templates for tax categories and AADE/PEPPOL mappings, you simply pass the exact overrides you need inside the highly polymorphic `meta.machine_payload` (for myDATA) or `meta.peppol_payload` (for B2G). *(See the [API Payload Reference](API_PAYLOAD_REFERENCE.md) for all available fields).*\n\n---\n\n### Conclusion\nBy following these 3 steps, you can dynamically spin up thousands of merchants, assign them myDATA or PEPPOL signature nodes, and start transmitting valid XMLs entirely from your own backend application. \n\n\n---\n\n# Payload Reference Guide\n\nThis document provides a comprehensive reference for the advanced payload configuration options available when transmitting invoices. These overrides are placed within the `meta` object of your request.\n\n---\n\n## 1. Universal Provider Overrides (`meta.machine_payload`)\nThe `machine_payload` object is highly polymorphic. Its accepted fields change depending on which Provider (WeFiscal machine) is active for the request. It allows you to override default classifications and specific behaviors for that provider.\n\n<details>\n<summary><strong>A. When using MyDATA Provider</strong></summary>\n\n*(Active when `X-Machine-Key` belongs to an AADE myDATA machine)*\n\n### General Overrides\n| Field | Description |\n| :--- | :--- |\n| `classificationType`<br>_String_ | Overrides the default E3 income classification type (e.g. `E3_561_001`). |\n| `classificationCategory`<br>_String_ | Overrides the default E3 category (e.g. `category1_2`). |\n| `vatExemptionCategory`<br>_Integer_ | AADE VAT exemption category ID. |\n| `invoiceDetailType`<br>_Integer_ | AADE specific invoice detail type for the lines. |\n| `paymentMethodDetails`<br>_Array_ | Overrides the default payment methods sent to AADE. |\n| `paymentMethodDetails.*.type`<br>_Integer_ | AADE payment method type (e.g. `1` for domestic bank transfer, `3` for cash). |\n| `paymentMethodDetails.*.amount`<br>_Numeric_ | The amount allocated to this payment type. |\n\n### B2G & Transport Specifics (AADE)\n*(Used when sending B2G through AADE directly, prior to PEPPOL)*\n| Field | Description |\n| :--- | :--- |\n| `isB2G`<br>_Boolean_ | Flags the invoice as Business-to-Government for AADE. |\n| `qrCodeUrl`<br>_String_ | Custom QR URL if provider signature is generated externally. |\n| `otherTransportDetails`<br>_Array_ | Details regarding transportation (e.g. vehicle plates). |\n| `otherTransportDetails.*.vehicleNumber`<br>_String_ | License plate number. |\n| `packingsDeclarations`<br>_Array_ | Details on packings. |\n| `deliveryLifecycle`<br>_Array_ | Lifecycle data of the delivery. |\n| `fuelInvoice`<br>_Boolean_ | Flags as fuel invoice. |\n| `specialInvoiceCategory`<br>_Integer_ | Special invoice category type. |\n| `invoiceVariationType`<br>_Integer_ | Invoice deviation type. |\n| `tableAA`<br>_String_ | Table number for restaurant delivery orders. |\n| `totalCancelDeliveryOrders`<br>_Boolean_ | Cancels all previous delivery orders. |\n| `reverseDeliveryNote`<br>_Boolean_ | Indicates reverse delivery. |\n| `reverseDeliveryNotePurpose`<br>_Integer_ | Purpose of reverse delivery. |\n| `toWeigh`<br>_Boolean_ | To weigh indicator. |\n| `invoiceDeliveryStatus`<br>_Integer_ | Delivery status (1-8). |\n| `downloadingInvoiceUrl`<br>_String_ | URL to download the invoice. |\n\n### Line Level Overrides (`invoiceDetails`)\n*(Used to pass complex tax details and specifics per line)*\n| Field | Description |\n| :--- | :--- |\n| `invoiceDetails`<br>_Array_ | Array of objects matching line items. |\n| `invoiceDetails.*.lineNumber`<br>_Integer_ | **Required**. Associates the override with the specific invoice line. |\n| `invoiceDetails.*.recType`<br>_Integer_ | Record type (1-7). |\n| `invoiceDetails.*.TaricNo`<br>_String_ | Taric Code. |\n| `invoiceDetails.*.fuelCode`<br>_String_ | Fuel Code. |\n| `invoiceDetails.*.invoiceDetailType`<br>_Integer_ | Line-level AADE detail type. |\n| `invoiceDetails.*.withheldAmount`<br>_Numeric_ | Withheld tax amount. |\n| `invoiceDetails.*.withheldPercentCategory`<br>_Integer_ | Withheld tax percent category. |\n| `invoiceDetails.*.stampDutyAmount`<br>_Numeric_ | Stamp duty amount. |\n| `invoiceDetails.*.stampDutyPercentCategory`<br>_Integer_ | Stamp duty percent category. |\n| `invoiceDetails.*.feesAmount`<br>_Numeric_ | Fees amount. |\n| `invoiceDetails.*.feesPercentCategory`<br>_Integer_ | Fees percent category. |\n| `invoiceDetails.*.otherTaxesAmount`<br>_Numeric_ | Other taxes amount. |\n| `invoiceDetails.*.otherTaxesPercentCategory`<br>_Integer_ | Other taxes percent category. |\n| `invoiceDetails.*.deductionsAmount`<br>_Numeric_ | Deductions amount. |\n| `invoiceDetails.*.lineComments`<br>_String_ | Line comments (up to 150 chars). |\n| `invoiceDetails.*.quantity15`<br>_Numeric_ | Quantity at 15 degrees. |\n| `invoiceDetails.*.otherMeasurementUnitQuantity`<br>_Integer_ | Quantity in other units. |\n| `invoiceDetails.*.otherMeasurementUnitTitle`<br>_String_ | Title of other unit. |\n| `invoiceDetails.*.notVAT195`<br>_Boolean_ | Indicates non-participation in VAT (Article 195). |\n| `invoiceDetails.*.movePurposeLine`<br>_Integer_ | Move purpose line. |\n| `invoiceDetails.*.otherMovePurposeLineTitle`<br>_String_ | Move purpose line title. |\n\n</details>\n\n<details>\n<summary><strong>B. When using Verifatu Provider</strong></summary>\n\n*(Active when `X-Machine-Key` belongs to a Verifatu fiscal machine)*\n\n*(List of Verifatu-specific fields will be populated here as the integration expands)*\n\n</details>\n\n---\n\n## 2. PEPPOL & B2G Node (`meta.peppol_payload`)\nThe `peppol_payload` object is used when routing through a PEPPOL WeFiscal machine. It completely decouples the UBL 2.1 generation from the ERP database, allowing you to inject precise elements required by the European EN 16931 and Greek B2G Peppol standards.\n\n<details>\n<summary><strong>View All PEPPOL B2G Fields</strong></summary>\n\n### Routing & References\n| Field | Description |\n| :--- | :--- |\n| `endpoint_id`<br>_String_ | **Required.** The PEPPOL Participant ID of the buyer (e.g. `9908:090025547`). |\n| `buyer_reference`<br>_String_ | (BT-10) Buyer reference code (e.g. \"KAE 1234\"). Often required by B2G. |\n| `purchase_order_reference`<br>_String_ | (BT-13) Purchase order number. |\n| `contract_reference`<br>_String_ | (BT-12) Contract reference number (e.g. \u0391\u0394\u0391\u039c). |\n| `project_reference`<br>_String_ | (BT-11) Project reference number. |\n\n### Supplier Details (Seller)\nOverrides the default Company profile details for the UBL file.\n| Field | Description |\n| :--- | :--- |\n| `supplier.name`<br>_String_ | Seller trading name. |\n| `supplier.vat_number`<br>_String_ | Seller VAT (Without country prefix, e.g. `090000000`). |\n| `supplier.street`<br>_String_ | Street address. |\n| `supplier.city`<br>_String_ | City name. |\n| `supplier.postal_code`<br>_String_ | Postal code. |\n| `supplier.country`<br>_String_ | 2-letter ISO code (e.g. `GR`). |\n| `supplier.email`<br>_String_ | Contact email. |\n| `supplier.telephone`<br>_String_ | Contact phone number. |\n| `supplier.contact_name`<br>_String_ | Contact person name. |\n\n### Customer Details (Buyer)\nOverrides the default Customer profile details.\n| Field | Description |\n| :--- | :--- |\n| `customer.name`<br>_String_ | Buyer name (e.g. \"\u0394\u03ae\u03bc\u03bf\u03c2 \u0391\u03b8\u03b7\u03bd\u03b1\u03af\u03c9\u03bd\"). |\n| `customer.vat_number`<br>_String_ | Buyer VAT. |\n| `customer.street`<br>_String_ | Street address. |\n| `customer.city`<br>_String_ | City name. |\n| `customer.postal_code`<br>_String_ | Postal code. |\n| `customer.country`<br>_String_ | 2-letter ISO code (e.g. `GR`). |\n\n### Line Items (`lines`)\nReplaces the standard invoice lines entirely for PEPPOL generation.\n| Field | Description |\n| :--- | :--- |\n| `lines.*.id`<br>_String_ | Line identifier (e.g. \"1\", \"2\"). |\n| `lines.*.name`<br>_String_ | Item description / name. |\n| `lines.*.quantity`<br>_Numeric_ | Invoiced quantity. |\n| `lines.*.unit_code`<br>_String_ | UN/ECE Unit code (e.g. `C62` for pieces, `H87` for pieces, `DAY` for days). |\n| `lines.*.net_value`<br>_Numeric_ | Total net value for this line. |\n| `lines.*.price`<br>_Numeric_ | Net price per unit. |\n| `lines.*.vat_percent`<br>_Integer_ | VAT percentage rate (e.g. `24`, `13`). |\n| `lines.*.vat_category`<br>_String_ | VAT category code (e.g. `S` for standard, `E` for exempt, `Z` for zero). |\n| `lines.*.vat_exemption_reason`<br>_String_ | Text description of exemption reason if category is E or Z. |\n\n### Taxes & Totals (`taxes`)\nReplaces automatic tax calculations.\n| Field | Description |\n| :--- | :--- |\n| `taxes.*.taxable_amount`<br>_Numeric_ | The net amount subject to this tax rate. |\n| `taxes.*.tax_amount`<br>_Numeric_ | The calculated tax amount for this rate. |\n| `taxes.*.percent`<br>_Integer_ | The tax percentage. |\n| `taxes.*.category`<br>_String_ | Tax category code (`S`, `E`, `Z`, `AE`, `O`). |\n\n### Payment Means (`payments`)\nSpecifies how the invoice should be paid (BT-83).\n| Field | Description |\n| :--- | :--- |\n| `payments.*.means_code`<br>_String_ | UNTDID 4461 Payment Means Code (e.g. `30` for Credit Transfer). |\n| `payments.*.account_id`<br>_String_ | IBAN / Bank Account number (BT-84). |\n| `payments.*.payment_id`<br>_String_ | Remittance Information / Payment Reference (BT-83). |\n\n</details>\n\n---\n\n## 3. Usage Example\n\n```json\n{\n  \"meta\": {\n    \"sign_payload\": {\n      \"isB2G\": true,\n      \"classificationType\": \"E3_561_001\"\n    },\n    \"peppol_payload\": {\n      \"endpoint_id\": \"9908:090025547\",\n      \"buyer_reference\": \"KAE 4123\",\n      \"supplier\": {\n        \"email\": \"accounting@company.gr\"\n      },\n      \"payments\": [\n        {\n          \"means_code\": \"30\",\n          \"account_id\": \"GR1201100000000000000000000\"\n        }\n      ]\n    }\n  }\n}\n```\n"
    },
    "servers": [
        {
            "url": "https://app.wefiscal.com/api",
            "description": "Production"
        }
    ],
    "paths": {
        "/v1/account": {
            "get": {
                "operationId": "account.show",
                "description": "Retrieves the profile and details of the currently authenticated master account (ERP user).",
                "summary": "Get Account Profile",
                "tags": [
                    "Account"
                ],
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/User"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/AuthenticationException"
                    }
                }
            }
        },
        "/v1/account/balance": {
            "get": {
                "operationId": "account.balance",
                "description": "Retrieves the current balance or available credits for the organization's WeFiscal machine account.",
                "summary": "Get Credits Balance",
                "tags": [
                    "Account"
                ],
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "const": "Success"
                                        },
                                        "account_balance": {
                                            "type": "number"
                                        },
                                        "workspace_balance": {
                                            "type": "number"
                                        },
                                        "currency": {
                                            "type": "string",
                                            "const": "EUR"
                                        }
                                    },
                                    "required": [
                                        "status",
                                        "account_balance",
                                        "workspace_balance",
                                        "currency"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/AuthenticationException"
                    }
                }
            }
        },
        "/v1/companies": {
            "post": {
                "operationId": "company.store",
                "description": "Creates a new company under the authenticated organization. The company will be automatically provisioned with default fiscal templates.",
                "summary": "Create Company",
                "tags": [
                    "Company"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "name": {
                                        "type": "string",
                                        "maxLength": 255
                                    },
                                    "vat_reg_num": {
                                        "type": "string",
                                        "description": "The legal name of the company.",
                                        "maxLength": 255
                                    },
                                    "country": {
                                        "type": "string",
                                        "description": "The VAT number of the company.",
                                        "maxLength": 10
                                    },
                                    "address": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "description": "ISO Country Code (e.g. GR).",
                                        "maxLength": 255
                                    }
                                },
                                "required": [
                                    "name",
                                    "vat_reg_num",
                                    "country"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Ensure dynamically generated properties like public_id are loaded",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Company"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "$ref": "#/components/responses/AuthenticationException"
                    }
                }
            },
            "get": {
                "operationId": "company.index",
                "description": "Returns a list of companies/organizations linked to the current user.",
                "summary": "List Companies",
                "tags": [
                    "Company"
                ],
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/AuthenticationException"
                    }
                }
            }
        },
        "/v1/companies/{companyId}": {
            "get": {
                "operationId": "company.show",
                "description": "Returns the details (VAT, address, etc.) of a specific company.",
                "summary": "Get Company Details",
                "tags": [
                    "Company"
                ],
                "parameters": [
                    {
                        "name": "companyId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "allOf": [
                                        {
                                            "$ref": "#/components/schemas/Company"
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "const": "Company not found or unauthorized"
                                        }
                                    },
                                    "required": [
                                        "error"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/AuthenticationException"
                    }
                }
            },
            "put": {
                "operationId": "company.update",
                "description": "Updates the basic information of a company (name, address, tax office, etc.).",
                "summary": "Update Company Information",
                "tags": [
                    "Company"
                ],
                "parameters": [
                    {
                        "name": "companyId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "name": {
                                        "type": "string",
                                        "maxLength": 255
                                    },
                                    "vat_reg_num": {
                                        "type": "string",
                                        "maxLength": 255
                                    },
                                    "country": {
                                        "type": "string",
                                        "maxLength": 10
                                    },
                                    "address": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 255
                                    },
                                    "settings": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "allOf": [
                                        {
                                            "$ref": "#/components/schemas/Company"
                                        },
                                        {
                                            "type": "string"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "const": "Company not found or unauthorized"
                                        }
                                    },
                                    "required": [
                                        "error"
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "$ref": "#/components/responses/AuthenticationException"
                    }
                }
            }
        },
        "/v1/esign": {
            "post": {
                "operationId": "eSign.storeRequest",
                "description": "Requires:\n- X-Machine-Key header\nPayload:\n- pdf_base64: The base64 encoded PDF string\n- signer_email: The email of the person who will sign",
                "summary": "Create",
                "tags": [
                    "ESign"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "signer_email": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "email"
                                    },
                                    "expires_in_minutes": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 1
                                    },
                                    "machine_payload": {
                                        "type": "object",
                                        "properties": {
                                            "pdf_base64": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            },
                                            "template_text": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            },
                                            "template_base64": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            },
                                            "template_id": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            },
                                            "fields_schema": {
                                                "type": "array",
                                                "items": {
                                                    "type": "string"
                                                }
                                            },
                                            "locale": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            },
                                            "email_subject": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "maxLength": 255
                                            },
                                            "email_message": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            },
                                            "auto_extract_fields": {
                                                "type": "boolean",
                                                "description": "Auto-extract fields from template if enabled (default true when fields_schema is empty)",
                                                "default": true
                                            }
                                        }
                                    }
                                },
                                "required": [
                                    "machine_payload"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "const": "E-Sign request created successfully"
                                        },
                                        "request_id": {
                                            "type": "integer"
                                        },
                                        "public_id": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "status": {
                                            "type": "string"
                                        },
                                        "sign_url": {
                                            "type": "string"
                                        },
                                        "terminal_url": {
                                            "type": "string"
                                        },
                                        "qr_code_base64": {
                                            "type": "string"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "credits_used": {
                                                    "type": "integer",
                                                    "const": 1
                                                }
                                            },
                                            "required": [
                                                "credits_used"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "message",
                                        "request_id",
                                        "public_id",
                                        "status",
                                        "sign_url",
                                        "terminal_url",
                                        "qr_code_base64",
                                        "meta"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "error": {
                                                    "type": "string",
                                                    "const": "template_base64 must decode to a valid UTF-8 string (HTML or text). It appears you provided a binary file (e.g. PDF)."
                                                }
                                            },
                                            "required": [
                                                "error"
                                            ]
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "error": {
                                                    "type": "string",
                                                    "const": "Invalid base64 payload"
                                                }
                                            },
                                            "required": [
                                                "error"
                                            ]
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "error": {
                                                    "type": "string",
                                                    "const": "Template does not have a valid document"
                                                }
                                            },
                                            "required": [
                                                "error"
                                            ]
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "error": {
                                            "type": "string"
                                        }
                                    },
                                    "required": [
                                        "error"
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "const": "Template not found"
                                        }
                                    },
                                    "required": [
                                        "error"
                                    ]
                                }
                            }
                        }
                    },
                    "402": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "const": "Insufficient API credits for this company."
                                        }
                                    },
                                    "required": [
                                        "error"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/AuthenticationException"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    }
                }
            }
        },
        "/v1/esign/{id}": {
            "get": {
                "operationId": "eSign.showRequest",
                "summary": "Retrieve",
                "tags": [
                    "ESign"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "id": {
                                            "type": "integer"
                                        },
                                        "status": {
                                            "type": "string"
                                        },
                                        "signer_email": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "created_at": {
                                            "type": [
                                                "string",
                                                "null"
                                            ],
                                            "format": "date-time"
                                        },
                                        "signed_pdf_base64": {
                                            "type": "string"
                                        }
                                    },
                                    "required": [
                                        "id",
                                        "status",
                                        "signer_email",
                                        "created_at",
                                        "signed_pdf_base64"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/AuthenticationException"
                    }
                }
            }
        },
        "/v1/invoices": {
            "post": {
                "operationId": "invoice.store",
                "description": "Sends, signs, and registers a new invoice (e.g. B2B, B2C, or B2G) via the assigned WeFiscal machine mechanism.\n\n### The `meta.machine_payload` Object\n\nThe `machine_payload` object is highly polymorphic and its structure depends entirely on the Provider (WeFiscal machine) your company is using. It allows you to override or inject provider-specific fields directly into the fiscal engine.\n\n#### 1. Provider: `mydata_prod` / `mydata_sandbox` (AADE Direct)\nWhen communicating directly with the AADE myDATA REST API, the `machine_payload` expects specific fields related to Greek accounting standards:\n\n| Field | Description | Example |\n|---|---|---|\n| `classificationType`<br>_string_ | The E3 classification code. | `\"E3_561_003\"` |\n| `classificationCategory`<br>_string_ | The category of the classification. | `\"category1_3\"` |\n| `vatExemptionCategory`<br>_integer_ | Exemption reason if VAT is 0%. | `7` |\n| `paymentMethodDetails`<br>_array_ | AADE specific payment array. | `[{\"type\": 3, \"amount\": 100}]` |\n\n```json\n\"meta\": {\n  \"machine_payload\": {\n    \"classificationType\": \"E3_561_003\",\n    \"classificationCategory\": \"category1_3\",\n    \"vatExemptionCategory\": 1,\n    \"paymentMethodDetails\": [\n      { \"type\": 3, \"amount\": 150.50 }\n    ]\n  }\n}\n```\n\n#### 2. Provider: `verifatu` (Verifatu YPAHES)\nWhen using the Verifatu provider, the payload requires different fiscal parameters specifically required by their engine:\n\n| Field | Description | Example |\n|---|---|---|\n| `documentType`<br>_string_ | Verifatu internal document type code. | `\"INV\"` |\n| `seriesCode`<br>_string_ | Alphanumeric series code. | `\"A\"` |\n| `taxIndicators`<br>_array_ | Specific tax indicator flags. | `[\"EXEMPT_ART_22\"]` |\n\n```json\n\"meta\": {\n  \"machine_payload\": {\n    \"documentType\": \"INV\",\n    \"seriesCode\": \"A\",\n    \"taxIndicators\": [\"EXEMPT_ART_22\"]\n  }\n}\n```\n\n> **Note:** If a field is not provided in `machine_payload`, the system will attempt to automatically fallback to the defaults configured in the Company's `fiscal_templates`.",
                "summary": "Create Invoice",
                "tags": [
                    "Invoice"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/StoreInvoiceRequest"
                            }
                        }
                    }
                },
                "responses": {
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "type": "string"
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "public_id": {
                                                    "type": "string"
                                                },
                                                "status": {},
                                                "uid": {},
                                                "authentication_code": {},
                                                "qr_url": {},
                                                "qr_code": {},
                                                "verify_url": {
                                                    "type": "string"
                                                },
                                                "pdf_url": {
                                                    "type": "string"
                                                },
                                                "meta": {
                                                    "type": "object",
                                                    "properties": {
                                                        "machine_responses": {
                                                            "type": "array",
                                                            "prefixItems": [
                                                                {
                                                                    "type": "array",
                                                                    "items": {}
                                                                }
                                                            ],
                                                            "minItems": 1,
                                                            "maxItems": 1,
                                                            "additionalItems": false
                                                        },
                                                        "credits_used": {
                                                            "type": "integer",
                                                            "const": 1
                                                        }
                                                    },
                                                    "required": [
                                                        "machine_responses",
                                                        "credits_used"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "public_id",
                                                "status",
                                                "uid",
                                                "authentication_code",
                                                "qr_url",
                                                "qr_code",
                                                "verify_url",
                                                "pdf_url",
                                                "meta"
                                            ]
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "error": {
                                            "type": "string"
                                        }
                                    },
                                    "required": [
                                        "error"
                                    ]
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "const": "Account Locked"
                                        },
                                        "message": {
                                            "type": "string",
                                            "const": "\u0397 \u03ad\u03ba\u03b4\u03bf\u03c3\u03b7 \u03bd\u03ad\u03c9\u03bd \u03c0\u03b1\u03c1\u03b1\u03c3\u03c4\u03b1\u03c4\u03b9\u03ba\u03ce\u03bd \u03ad\u03c7\u03b5\u03b9 \u03b4\u03b9\u03b1\u03ba\u03bf\u03c0\u03b5\u03af. \u03a5\u03c0\u03ac\u03c1\u03c7\u03bf\u03c5\u03bd \u03b5\u03ba\u03ba\u03c1\u03b5\u03bc\u03ae \u0394\u03b5\u03bb\u03c4\u03af\u03b1 \u03a0\u03b1\u03c1\u03b1\u03b3\u03b3\u03b5\u03bb\u03af\u03b1\u03c2 (\u03a4\u03cd\u03c0\u03bf\u03c2 8.6) \u03ac\u03bd\u03c9 \u03c4\u03c9\u03bd 24 \u03c9\u03c1\u03ce\u03bd \u03c0\u03bf\u03c5 \u03b4\u03b5\u03bd \u03ad\u03c7\u03bf\u03c5\u03bd \u03c3\u03c5\u03c3\u03c7\u03b5\u03c4\u03b9\u03c3\u03c4\u03b5\u03af \u03bc\u03b5 \u0391\u03c0\u03cc\u03b4\u03b5\u03b9\u03be\u03b7 (\u0391.1112/2025)."
                                        }
                                    },
                                    "required": [
                                        "error",
                                        "message"
                                    ]
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "const": "Sign Box not found in request"
                                        }
                                    },
                                    "required": [
                                        "error"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/AuthenticationException"
                    }
                }
            },
            "get": {
                "operationId": "invoice.index",
                "description": "Returns a paginated list of all invoices issued by the organization. You can use query parameters to filter the results.",
                "summary": "List Invoices",
                "tags": [
                    "Invoice"
                ],
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "schema": {
                            "type": [
                                "string",
                                "null"
                            ],
                            "enum": [
                                "transmitted",
                                "pending",
                                "failed"
                            ]
                        }
                    },
                    {
                        "name": "date_from",
                        "in": "query",
                        "description": "Filter by transmission status. Options: `transmitted`, `pending`, `failed`.",
                        "schema": {
                            "type": [
                                "string",
                                "null"
                            ],
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "date_to",
                        "in": "query",
                        "description": "Filter invoices issued on or after this date (Format: YYYY-MM-DD). Example: 2023-01-01",
                        "schema": {
                            "type": [
                                "string",
                                "null"
                            ],
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "type",
                        "in": "query",
                        "description": "Filter invoices issued on or before this date (Format: YYYY-MM-DD). Example: 2023-12-31",
                        "schema": {
                            "type": [
                                "string",
                                "null"
                            ]
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "description": "Filter by AADE invoice type code (e.g., `1.1`).",
                        "schema": {
                            "type": [
                                "integer",
                                "null"
                            ]
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/LengthAwarePaginator"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "const": "Company not resolved"
                                        }
                                    },
                                    "required": [
                                        "error"
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "$ref": "#/components/responses/AuthenticationException"
                    }
                }
            }
        },
        "/v1/invoices/{id}/pdf": {
            "get": {
                "operationId": "invoice.downloadPdf",
                "description": "Retrieves the PDF of a specific invoice based on its identifier.",
                "summary": "Download Invoice PDF",
                "tags": [
                    "Invoice"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            },
                            "application/xml": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "type": "string"
                                        },
                                        {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        }
                                    ]
                                }
                            },
                            "application/pdf": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "type": "string"
                                        },
                                        {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "const": "PDF generation failed"
                                        }
                                    },
                                    "required": [
                                        "error"
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "const": "Invoice not found"
                                        }
                                    },
                                    "required": [
                                        "error"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "const": "Company not resolved"
                                        }
                                    },
                                    "required": [
                                        "error"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/AuthenticationException"
                    }
                }
            }
        },
        "/v1/invoices/{id}": {
            "get": {
                "operationId": "invoice.show",
                "description": "Retrieves the full details of a specific invoice based on its identifier.\u26a0\ufe0f Cannot generate request documentation: Scope is not initialized for route.",
                "summary": "Get Invoice Details",
                "tags": [
                    "Invoice"
                ],
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            },
                            "application/xml": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "type": "string"
                                        },
                                        {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        }
                                    ]
                                }
                            },
                            "application/pdf": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "type": "string"
                                        },
                                        {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "const": "PDF generation failed"
                                        }
                                    },
                                    "required": [
                                        "error"
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "const": "Invoice not found"
                                        }
                                    },
                                    "required": [
                                        "error"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "const": "Company not resolved"
                                        }
                                    },
                                    "required": [
                                        "error"
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "$ref": "#/components/responses/AuthenticationException"
                    }
                }
            }
        },
        "/v1/invoices/cancel": {
            "post": {
                "operationId": "invoice.cancel",
                "description": "Cancels an invoice through the WeFiscal machine mechanism. You must provide either the invoice's internal `id` or its `mark` in the request body.",
                "summary": "Cancel Invoice",
                "tags": [
                    "Invoice"
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "id": {
                                        "type": "string"
                                    },
                                    "mark": {
                                        "type": "string"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "422": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "error": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "error"
                                            ]
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "error": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "error"
                                            ]
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "message": {
                                                    "type": "string",
                                                    "const": "Invoice cancelled successfully"
                                                },
                                                "data": {
                                                    "type": "array",
                                                    "items": {}
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "message",
                                                "data"
                                            ]
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "const": "Success"
                                                },
                                                "cancellationMark": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "status",
                                                "cancellationMark"
                                            ]
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "const": "Document not found by id"
                                        }
                                    },
                                    "required": [
                                        "error"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/AuthenticationException"
                    },
                    "400": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "error": {
                                                    "type": "string",
                                                    "const": "Please provide either an id or a mark in the request body"
                                                }
                                            },
                                            "required": [
                                                "error"
                                            ]
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "error": {
                                                    "type": "string",
                                                    "const": "Malformed JSON"
                                                }
                                            },
                                            "required": [
                                                "error"
                                            ]
                                        }
                                    ]
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/transmitted-docs": {
            "get": {
                "operationId": "invoice.requestTransmittedDocs",
                "description": "Passthrough endpoint for AADE's RequestTransmittedDocs.",
                "summary": "Request Transmitted Docs",
                "tags": [
                    "Invoice"
                ],
                "parameters": [
                    {
                        "name": "issuervat",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "entityVatNumber",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "date_from",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "date_to",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "500": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "error": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "error"
                                            ]
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "error": {
                                                    "type": "string",
                                                    "const": "Sign Box not found in request"
                                                }
                                            },
                                            "required": [
                                                "error"
                                            ]
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/AuthenticationException"
                    }
                }
            }
        },
        "/v1/pos/terminal/signature": {
            "post": {
                "operationId": "pos.requestSignature",
                "description": "Request a Provider's Signature for EFT/POS (Stateless). \nCalculates the AADE UID and returns the 256-bit ECC Signature required by the POS terminal.",
                "summary": "Request POS Signature",
                "tags": [
                    "POS"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "issuer_tin": {
                                        "type": "string"
                                    },
                                    "issue_date": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "branch_code": {
                                        "type": "integer"
                                    },
                                    "invoice_type_code": {
                                        "type": "string"
                                    },
                                    "series": {
                                        "type": "string"
                                    },
                                    "identifier": {
                                        "type": "string"
                                    },
                                    "total_net_amount": {
                                        "type": "number",
                                        "description": "AA"
                                    },
                                    "total_vat_amount": {
                                        "type": "number"
                                    },
                                    "total_amount": {
                                        "type": "number"
                                    },
                                    "tid_nsp": {
                                        "type": "string",
                                        "maxLength": 50
                                    },
                                    "date_time": {
                                        "type": "string"
                                    }
                                },
                                "required": [
                                    "issuer_tin",
                                    "issue_date",
                                    "branch_code",
                                    "invoice_type_code",
                                    "series",
                                    "identifier",
                                    "total_net_amount",
                                    "total_vat_amount",
                                    "total_amount",
                                    "tid_nsp",
                                    "date_time"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "500": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "message": {
                                            "type": "string"
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "message"
                                    ]
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "invoice_uid": {
                                            "type": "string"
                                        },
                                        "signature": {
                                            "type": "string"
                                        },
                                        "public_id": {
                                            "type": "string"
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "invoice_uid",
                                        "signature",
                                        "public_id"
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "const": "Missing X-Machine-Key header"
                                        }
                                    },
                                    "required": [
                                        "error"
                                    ]
                                }
                            }
                        }
                    }
                },
                "security": []
            }
        },
        "/v1/pos/terminal/finalize": {
            "post": {
                "operationId": "pos.finalizeTransaction",
                "description": "Mark a previously requested POS signature transaction as completed. \nOptionally records the tip amount and payment type.",
                "summary": "Finalize POS Transaction",
                "tags": [
                    "POS"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "signature_token": {
                                        "type": "string"
                                    },
                                    "transaction_id": {
                                        "type": "string",
                                        "maxLength": 100
                                    },
                                    "tip_amount": {
                                        "type": [
                                            "number",
                                            "null"
                                        ],
                                        "description": "Returned by POS"
                                    },
                                    "payment_type": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    }
                                },
                                "required": [
                                    "signature_token",
                                    "transaction_id"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "message": {
                                            "type": "string",
                                            "const": "POS Transaction marked as completed"
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "message"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "error": {
                                                    "type": "string",
                                                    "const": "Signature has expired"
                                                }
                                            },
                                            "required": [
                                                "error"
                                            ]
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "error": {
                                                    "type": "string",
                                                    "const": "Transaction is not pending"
                                                }
                                            },
                                            "required": [
                                                "error"
                                            ]
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "const": "Missing X-Machine-Key header"
                                        }
                                    },
                                    "required": [
                                        "error"
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    }
                },
                "security": []
            }
        },
        "/v1/reports/summary": {
            "post": {
                "operationId": "report.summary",
                "description": "\u03a0\u03b1\u03c1\u03b1\u03b3\u03c9\u03b3\u03ae \u03c3\u03c5\u03b3\u03ba\u03b5\u03bd\u03c4\u03c1\u03c9\u03c4\u03b9\u03ba\u03ce\u03bd \u03c6\u03bf\u03c1\u03bf\u03bb\u03bf\u03b3\u03b9\u03ba\u03ce\u03bd \u03b1\u03bd\u03b1\u03c6\u03bf\u03c1\u03ce\u03bd (\u0396) \u03ba\u03b1\u03b9 \u03b1\u03b8\u03c1\u03bf\u03b9\u03c3\u03bc\u03ac\u03c4\u03c9\u03bd \u03ba\u03b1\u03b8\u03b1\u03c1\u03ae\u03c2 \u03b1\u03be\u03af\u03b1\u03c2/\u03a6\u03a0\u0391.",
                "summary": "Generate Summary Report",
                "tags": [
                    "Report"
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "date_from": {
                                        "type": "string"
                                    },
                                    "date_to": {
                                        "type": "string"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "report_id": {
                                            "type": "string"
                                        },
                                        "company_vat": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "period": {
                                            "type": "object",
                                            "properties": {
                                                "from": {},
                                                "to": {}
                                            },
                                            "required": [
                                                "from",
                                                "to"
                                            ]
                                        },
                                        "summary": {
                                            "type": "object",
                                            "properties": {
                                                "total_net_value": {
                                                    "type": "number"
                                                },
                                                "total_vat_amount": {
                                                    "type": "number"
                                                },
                                                "total_gross_value": {
                                                    "type": "number"
                                                },
                                                "invoices_count": {
                                                    "type": "integer"
                                                }
                                            },
                                            "required": [
                                                "total_net_value",
                                                "total_vat_amount",
                                                "total_gross_value",
                                                "invoices_count"
                                            ]
                                        },
                                        "message": {
                                            "type": "string",
                                            "const": "To endpoint \u03c3\u03c5\u03b3\u03ba\u03b5\u03bd\u03c4\u03c1\u03c9\u03c4\u03b9\u03ba\u03ce\u03bd \u03b1\u03bd\u03b1\u03c6\u03bf\u03c1\u03ce\u03bd \u03b5\u03af\u03bd\u03b1\u03b9 \u03b4\u03b9\u03b1\u03b8\u03ad\u03c3\u03b9\u03bc\u03bf."
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "report_id",
                                        "company_vat",
                                        "period",
                                        "summary",
                                        "message"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "const": "Missing X-Machine-Key header"
                                        }
                                    },
                                    "required": [
                                        "error"
                                    ]
                                }
                            }
                        }
                    }
                },
                "security": []
            }
        },
        "/v1/companies/{companyId}/machines": {
            "get": {
                "operationId": "machine.index",
                "description": "Returns a list of all WeFiscal machines (Signature Mechanisms) assigned to the specified company.",
                "summary": "List WeFiscal machines",
                "tags": [
                    "WeFiscal machine"
                ],
                "parameters": [
                    {
                        "name": "companyId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "const": "Company not found or unauthorized"
                                        }
                                    },
                                    "required": [
                                        "error"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/AuthenticationException"
                    }
                }
            },
            "post": {
                "operationId": "machine.store",
                "description": "Provisions a new WeFiscal machine (Signature Mechanism) for the specified company. Returns the secure `machine_key` which acts as the API key for all fiscal operations.",
                "summary": "Create WeFiscal machine",
                "tags": [
                    "WeFiscal machine"
                ],
                "parameters": [
                    {
                        "name": "companyId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "provider": {
                                        "type": "string",
                                        "enum": [
                                            "mydata_prod",
                                            "mydata_sandbox",
                                            "peppol_prod",
                                            "peppol_sandbox",
                                            "novus",
                                            "esign",
                                            "soft1_dualsync"
                                        ]
                                    }
                                },
                                "required": [
                                    "provider"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "machine": {
                                            "$ref": "#/components/schemas/SignMachine"
                                        },
                                        "machine_key": {
                                            "type": "string"
                                        }
                                    },
                                    "required": [
                                        "machine",
                                        "machine_key"
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "const": "Company not found or unauthorized"
                                        }
                                    },
                                    "required": [
                                        "error"
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "$ref": "#/components/responses/AuthenticationException"
                    }
                }
            }
        },
        "/v1/statements/send": {
            "post": {
                "operationId": "statement.send",
                "description": "\u03a5\u03c0\u03bf\u03b2\u03bf\u03bb\u03ae \u0394\u03ae\u03bb\u03c9\u03c3\u03b7\u03c2 \u0388\u03bd\u03b1\u03c1\u03be\u03b7\u03c2 \u0388\u03ba\u03b4\u03bf\u03c3\u03b7\u03c2 \u03a3\u03c4\u03bf\u03b9\u03c7\u03b5\u03af\u03c9\u03bd (SendStatement) \u03c3\u03c4\u03b7\u03bd \u0391\u0391\u0394\u0395 \u03b3\u03b9\u03b1 \u03c4\u03b7 \u03c3\u03c5\u03b3\u03ba\u03b5\u03ba\u03c1\u03b9\u03bc\u03ad\u03bd\u03b7 \u03bf\u03bd\u03c4\u03cc\u03c4\u03b7\u03c4\u03b1.",
                "summary": "Send Statement (\u0394\u03ae\u03bb\u03c9\u03c3\u03b7 \u0388\u03bd\u03b1\u03c1\u03be\u03b7\u03c2)",
                "tags": [
                    "Statement"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "contract_number": {
                                        "type": "string"
                                    },
                                    "contract_date": {
                                        "type": "string",
                                        "format": "date-time"
                                    }
                                },
                                "required": [
                                    "contract_number",
                                    "contract_date"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "500": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "error": {
                                            "type": "string"
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "error"
                                    ]
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "message": {
                                            "type": "string",
                                            "const": "\u0397 \u03b4\u03ae\u03bb\u03c9\u03c3\u03b7 \u03ad\u03bd\u03b1\u03c1\u03be\u03b7\u03c2 \u03c5\u03c0\u03bf\u03b2\u03bb\u03ae\u03b8\u03b7\u03ba\u03b5 \u03b5\u03c0\u03b9\u03c4\u03c5\u03c7\u03ce\u03c2."
                                        },
                                        "aade_response": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "timestamp": {
                                            "type": "string"
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "message",
                                        "aade_response",
                                        "timestamp"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "error": {
                                            "anyOf": [
                                                {
                                                    "type": "string"
                                                },
                                                {
                                                    "type": "string",
                                                    "enum": [
                                                        "AADE Error"
                                                    ]
                                                }
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "error"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "const": "Missing X-Machine-Key header"
                                        }
                                    },
                                    "required": [
                                        "error"
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    }
                },
                "security": []
            }
        },
        "/v1/statements/recall": {
            "post": {
                "operationId": "statement.recall",
                "description": "\u03a5\u03c0\u03bf\u03b2\u03bf\u03bb\u03ae \u0394\u03ae\u03bb\u03c9\u03c3\u03b7\u03c2 \u0391\u03bd\u03ac\u03ba\u03bb\u03b7\u03c3\u03b7\u03c2 (RecallStatement) \u03c3\u03c4\u03bf Taxisnet \u03c3\u03b5 \u03c0\u03b5\u03c1\u03af\u03c0\u03c4\u03c9\u03c3\u03b7 \u03bb\u03cd\u03c3\u03b7\u03c2 \u03c3\u03cd\u03bc\u03b2\u03b1\u03c3\u03b7\u03c2.",
                "summary": "Recall Statement (\u0394\u03ae\u03bb\u03c9\u03c3\u03b7 \u0391\u03bd\u03ac\u03ba\u03bb\u03b7\u03c3\u03b7\u03c2)",
                "tags": [
                    "Statement"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "statement_id": {
                                        "type": "string"
                                    },
                                    "recall_reason": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    }
                                },
                                "required": [
                                    "statement_id"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "500": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "error": {
                                            "type": "string"
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "error"
                                    ]
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "message": {
                                            "type": "string",
                                            "const": "\u0397 \u03b4\u03ae\u03bb\u03c9\u03c3\u03b7 \u03b1\u03bd\u03ac\u03ba\u03bb\u03b7\u03c3\u03b7\u03c2 \u03c5\u03c0\u03bf\u03b2\u03bb\u03ae\u03b8\u03b7\u03ba\u03b5 \u03b5\u03c0\u03b9\u03c4\u03c5\u03c7\u03ce\u03c2."
                                        },
                                        "statement_id": {
                                            "type": "string"
                                        },
                                        "recall_reason": {
                                            "type": "string"
                                        },
                                        "aade_response": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "timestamp": {
                                            "type": "string"
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "message",
                                        "statement_id",
                                        "recall_reason",
                                        "aade_response",
                                        "timestamp"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "error": {
                                            "anyOf": [
                                                {
                                                    "type": "string"
                                                },
                                                {
                                                    "type": "string",
                                                    "enum": [
                                                        "AADE Error"
                                                    ]
                                                }
                                            ]
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "error"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "const": "Missing X-Machine-Key header"
                                        }
                                    },
                                    "required": [
                                        "error"
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    }
                },
                "security": []
            }
        },
        "/v1/verify/{authCode}": {
            "get": {
                "operationId": "validation.verify",
                "summary": "Verify Invoice or E-Sign Document via AuthCode (Public URL)",
                "tags": [
                    "Validation"
                ],
                "parameters": [
                    {
                        "name": "authCode",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "404": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "message": {
                                            "type": "string",
                                            "const": "Document not found or invalid code."
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "message"
                                    ]
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "type": {
                                                            "type": "string",
                                                            "const": "esign"
                                                        },
                                                        "signature_hash": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "status": {
                                                            "type": "string"
                                                        },
                                                        "document_name": {
                                                            "type": "string"
                                                        },
                                                        "created_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "type",
                                                        "signature_hash",
                                                        "status",
                                                        "document_name",
                                                        "created_at"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data"
                                            ]
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "type": {
                                                            "type": "string",
                                                            "const": "invoice"
                                                        },
                                                        "uid": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "mark": {
                                                            "type": [
                                                                "integer",
                                                                "null"
                                                            ]
                                                        },
                                                        "authentication_code": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "status": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "issuer_name": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "issuer_vat": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "counterpart_name": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "counterpart_vat": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "issue_date": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "total_gross_value": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "required": [
                                                        "type",
                                                        "uid",
                                                        "mark",
                                                        "authentication_code",
                                                        "status",
                                                        "issuer_name",
                                                        "issuer_vat",
                                                        "counterpart_name",
                                                        "counterpart_vat",
                                                        "issue_date",
                                                        "total_gross_value"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "success",
                                                "data"
                                            ]
                                        }
                                    ]
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/webhooks": {
            "post": {
                "operationId": "webhook.store",
                "description": "\u0395\u03b3\u03b3\u03c1\u03b1\u03c6\u03ae \u03ba\u03b1\u03b9 \u03b4\u03b9\u03b1\u03c7\u03b5\u03af\u03c1\u03b9\u03c3\u03b7 \u03b1\u03c3\u03cd\u03b3\u03c7\u03c1\u03bf\u03bd\u03c9\u03bd \u03b5\u03b9\u03b4\u03bf\u03c0\u03bf\u03b9\u03ae\u03c3\u03b5\u03c9\u03bd \u03bc\u03b5 \u03ba\u03c1\u03c5\u03c0\u03c4\u03bf\u03b3\u03c1\u03b1\u03c6\u03b9\u03ba\u03ae \u03c5\u03c0\u03bf\u03b3\u03c1\u03b1\u03c6\u03ae HMAC-SHA256.",
                "summary": "Register Webhook",
                "tags": [
                    "Webhook"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "target_url": {
                                        "type": "string",
                                        "format": "uri"
                                    },
                                    "event_type": {
                                        "type": "string"
                                    }
                                },
                                "required": [
                                    "target_url",
                                    "event_type"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "webhook_id": {
                                            "type": "string"
                                        },
                                        "target_url": {
                                            "type": "string"
                                        },
                                        "event_type": {
                                            "type": "string"
                                        },
                                        "secret": {
                                            "type": "string"
                                        },
                                        "message": {
                                            "type": "string",
                                            "const": "\u03a4\u03bf webhook \u03ba\u03b1\u03c4\u03b1\u03c7\u03c9\u03c1\u03ae\u03b8\u03b7\u03ba\u03b5 \u03b5\u03c0\u03b9\u03c4\u03c5\u03c7\u03ce\u03c2."
                                        }
                                    },
                                    "required": [
                                        "success",
                                        "webhook_id",
                                        "target_url",
                                        "event_type",
                                        "secret",
                                        "message"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "const": "Missing X-Machine-Key header"
                                        }
                                    },
                                    "required": [
                                        "error"
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    }
                },
                "security": []
            }
        }
    },
    "components": {
        "schemas": {
            "Company": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "name": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "plan": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "vat_reg_num": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "country": {
                        "type": "string"
                    },
                    "settings": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "created_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "updated_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "address": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "city": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "postal_code": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "alias": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "public_id": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "credits_balance": {
                        "type": "string"
                    },
                    "is_guest": {
                        "type": "integer"
                    },
                    "is_locked": {
                        "type": "integer"
                    }
                },
                "required": [
                    "id",
                    "name",
                    "plan",
                    "vat_reg_num",
                    "country",
                    "settings",
                    "created_at",
                    "updated_at",
                    "address",
                    "city",
                    "postal_code",
                    "alias",
                    "public_id",
                    "credits_balance",
                    "is_guest",
                    "is_locked"
                ],
                "title": "Company"
            },
            "LengthAwarePaginator": {
                "type": "object",
                "properties": {
                    "current_page": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "data": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "first_page_url": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "from": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "minimum": 1
                    },
                    "last_page_url": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "last_page": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "links": {
                        "type": "array",
                        "description": "Generated paginator links.",
                        "items": {
                            "type": "object",
                            "properties": {
                                "url": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "label": {
                                    "type": "string"
                                },
                                "active": {
                                    "type": "boolean"
                                }
                            },
                            "required": [
                                "url",
                                "label",
                                "active"
                            ]
                        }
                    },
                    "next_page_url": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "path": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Base path for paginator generated URLs."
                    },
                    "per_page": {
                        "type": "integer",
                        "description": "Number of items shown per page.",
                        "minimum": 0
                    },
                    "prev_page_url": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "to": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "description": "Number of the last item in the slice.",
                        "minimum": 1
                    },
                    "total": {
                        "type": "integer",
                        "description": "Total number of items being paginated.",
                        "minimum": 0
                    }
                },
                "required": [
                    "current_page",
                    "data",
                    "first_page_url",
                    "from",
                    "last_page_url",
                    "last_page",
                    "links",
                    "next_page_url",
                    "path",
                    "per_page",
                    "prev_page_url",
                    "to",
                    "total"
                ],
                "title": "LengthAwarePaginator"
            },
            "SignMachine": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "company_id": {
                        "type": "integer"
                    },
                    "provider": {
                        "type": "string"
                    },
                    "machine_key": {
                        "type": "string"
                    },
                    "settings": {
                        "type": [
                            "array",
                            "null"
                        ],
                        "items": {}
                    },
                    "is_active": {
                        "type": "boolean"
                    },
                    "created_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "updated_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "public_id": {
                        "type": [
                            "string",
                            "null"
                        ]
                    }
                },
                "required": [
                    "id",
                    "company_id",
                    "provider",
                    "machine_key",
                    "settings",
                    "is_active",
                    "created_at",
                    "updated_at",
                    "public_id"
                ],
                "title": "SignMachine"
            },
            "StoreInvoiceRequest": {
                "type": "object",
                "properties": {
                    "invoice_number": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "issuer_vat_number": {
                        "type": "string",
                        "description": "Universal identifier"
                    },
                    "series": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "aa": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Kept for backwards compatibility"
                    },
                    "invoice_type_id": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Kept for backwards compatibility"
                    },
                    "issue_date": {
                        "type": "string",
                        "format": "date",
                        "description": "MyData specific"
                    },
                    "currency": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "minLength": 3,
                        "maxLength": 3
                    },
                    "total_net_value": {
                        "type": "number",
                        "minimum": 0
                    },
                    "total_vat_amount": {
                        "type": "number",
                        "minimum": 0
                    },
                    "total_gross_value": {
                        "type": "number",
                        "minimum": 0
                    },
                    "exchange_rate": {
                        "type": [
                            "number",
                            "null"
                        ]
                    },
                    "customer_street": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "counterpart_name": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "counterpart_vat_number": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "counterpart_country": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "minLength": 2,
                        "maxLength": 2
                    },
                    "counterpart_address": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "counterpart_city": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "counterpart_postal_code": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "issuer_name": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "issuer_address": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "issuer_city": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "issuer_postal_code": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "isv_id": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "meta": {
                        "type": "object",
                        "properties": {
                            "fiscal_template_id": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "description": "Custom metadata and overrides"
                            },
                            "payment_template_id": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "description": "Preset classification template"
                            },
                            "isv_id": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "description": "Preset payment template"
                            },
                            "machine_payload": {
                                "type": [
                                    "object",
                                    "null"
                                ],
                                "description": "ISV override",
                                "properties": {
                                    "authenticationCode": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "description": "Universal WeFiscal machine Provider Overrides (myDATA, Verifatu, etc.)"
                                    },
                                    "uid": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "description": "YPAHES Provider Signature"
                                    },
                                    "mark": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "description": "YPAHES Provider UID"
                                    },
                                    "cancelledByMark": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "description": "YPAHES Provider MARK"
                                    },
                                    "classificationType": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "description": "YPAHES Provider Cancelled By MARK"
                                    },
                                    "classificationCategory": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "description": "Overrides E3 income classification type (e.g. E3_561_001)"
                                    },
                                    "vatExemptionCategory": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "description": "Overrides E3 category (e.g. category1_2)"
                                    },
                                    "invoiceDetailType": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "description": "AADE VAT exemption category ID"
                                    },
                                    "paymentMethodDetails": {
                                        "type": [
                                            "array",
                                            "null"
                                        ],
                                        "description": "AADE specific invoice detail type",
                                        "items": {
                                            "type": "object",
                                            "properties": {
                                                "type": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Overrides default payment methods"
                                                },
                                                "amount": {
                                                    "type": [
                                                        "number",
                                                        "null"
                                                    ],
                                                    "description": "AADE payment method type (1=bank, 3=cash)"
                                                }
                                            }
                                        }
                                    },
                                    "isB2G": {
                                        "type": [
                                            "boolean",
                                            "null"
                                        ],
                                        "description": "Amount allocated to this payment type"
                                    },
                                    "qrCodeUrl": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "description": "Flags invoice as Business-to-Government"
                                    },
                                    "otherTransportDetails": {
                                        "type": [
                                            "array",
                                            "null"
                                        ],
                                        "description": "Custom QR URL",
                                        "items": {
                                            "type": "object",
                                            "properties": {
                                                "vehicleNumber": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Transportation details"
                                                }
                                            }
                                        }
                                    },
                                    "packingsDeclarations": {
                                        "type": [
                                            "array",
                                            "null"
                                        ],
                                        "description": "License plate number",
                                        "items": {
                                            "type": "string"
                                        }
                                    },
                                    "deliveryLifecycle": {
                                        "type": [
                                            "array",
                                            "null"
                                        ],
                                        "description": "Packings details",
                                        "items": {
                                            "type": "string"
                                        }
                                    },
                                    "taxesTotals": {
                                        "type": [
                                            "array",
                                            "null"
                                        ],
                                        "description": "Delivery lifecycle data",
                                        "items": {
                                            "type": "string"
                                        }
                                    },
                                    "fuelInvoice": {
                                        "type": [
                                            "boolean",
                                            "null"
                                        ],
                                        "description": "Total withholdings and taxes\nAdditional AADE Header Overrides"
                                    },
                                    "specialInvoiceCategory": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "invoiceVariationType": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "tableAA": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "totalCancelDeliveryOrders": {
                                        "type": [
                                            "boolean",
                                            "null"
                                        ]
                                    },
                                    "reverseDeliveryNote": {
                                        "type": [
                                            "boolean",
                                            "null"
                                        ]
                                    },
                                    "reverseDeliveryNotePurpose": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "toWeigh": {
                                        "type": [
                                            "boolean",
                                            "null"
                                        ]
                                    },
                                    "invoiceDeliveryStatus": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "downloadingInvoiceUrl": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "correlatedInvoices": {
                                        "type": [
                                            "array",
                                            "null"
                                        ],
                                        "description": "AADE Line Level Overrides (invoiceDetails)\nCorrelation to an already transmitted document (5.1, 9.1, 10.1, 1.6, 2.4 ...)",
                                        "items": {
                                            "type": "integer"
                                        }
                                    },
                                    "invoiceDetails": {
                                        "type": [
                                            "array",
                                            "null"
                                        ],
                                        "description": "MARK is a bigint; \"numeric\" lets MySQL round 1.5 into a real MARK",
                                        "items": {
                                            "type": "object",
                                            "properties": {
                                                "lineNumber": {
                                                    "type": "integer"
                                                },
                                                "recType": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "vat_exemption_category_id": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "TaricNo": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "fuelCode": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "invoiceDetailType": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "dienergia": {
                                                    "type": [
                                                        "array",
                                                        "null"
                                                    ],
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                },
                                                "discountOption": {
                                                    "type": [
                                                        "boolean",
                                                        "null"
                                                    ]
                                                },
                                                "withheldAmount": {
                                                    "type": [
                                                        "number",
                                                        "null"
                                                    ]
                                                },
                                                "withheldPercentCategory": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "stampDutyAmount": {
                                                    "type": [
                                                        "number",
                                                        "null"
                                                    ]
                                                },
                                                "stampDutyPercentCategory": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "feesAmount": {
                                                    "type": [
                                                        "number",
                                                        "null"
                                                    ]
                                                },
                                                "feesPercentCategory": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "otherTaxesPercentCategory": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "otherTaxesAmount": {
                                                    "type": [
                                                        "number",
                                                        "null"
                                                    ]
                                                },
                                                "deductionsAmount": {
                                                    "type": [
                                                        "number",
                                                        "null"
                                                    ]
                                                },
                                                "lineComments": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "quantity15": {
                                                    "type": [
                                                        "number",
                                                        "null"
                                                    ]
                                                },
                                                "otherMeasurementUnitQuantity": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "otherMeasurementUnitTitle": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "notVAT195": {
                                                    "type": [
                                                        "boolean",
                                                        "null"
                                                    ]
                                                },
                                                "movePurposeLine": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "otherMovePurposeLineTitle": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            }
                                        }
                                    },
                                    "recipient": {
                                        "type": [
                                            "array",
                                            "null"
                                        ],
                                        "description": "Extra Entities (Not mapped to AADE directly, but accepted for PEPPOL/PDF/Internal use)",
                                        "items": {
                                            "type": "string"
                                        }
                                    },
                                    "billingContractor": {
                                        "type": [
                                            "array",
                                            "null"
                                        ],
                                        "items": {
                                            "type": "string"
                                        }
                                    },
                                    "originator": {
                                        "type": [
                                            "array",
                                            "null"
                                        ],
                                        "items": {
                                            "type": "string"
                                        }
                                    },
                                    "sender": {
                                        "type": [
                                            "array",
                                            "null"
                                        ],
                                        "items": {
                                            "type": "string"
                                        }
                                    },
                                    "onBehalfOf": {
                                        "type": [
                                            "array",
                                            "null"
                                        ],
                                        "items": {
                                            "type": "string"
                                        }
                                    },
                                    "transporter": {
                                        "type": [
                                            "array",
                                            "null"
                                        ],
                                        "items": {
                                            "type": "string"
                                        }
                                    },
                                    "additionalTransporters": {
                                        "type": [
                                            "array",
                                            "null"
                                        ],
                                        "items": {
                                            "type": "string"
                                        }
                                    },
                                    "otherRelatedEntities": {
                                        "type": [
                                            "array",
                                            "null"
                                        ],
                                        "items": {
                                            "type": "string"
                                        }
                                    },
                                    "vatMediator": {
                                        "type": [
                                            "array",
                                            "null"
                                        ],
                                        "items": {
                                            "type": "string"
                                        }
                                    },
                                    "seller": {
                                        "type": [
                                            "array",
                                            "null"
                                        ],
                                        "items": {
                                            "type": "string"
                                        }
                                    },
                                    "buyer": {
                                        "type": [
                                            "array",
                                            "null"
                                        ],
                                        "items": {
                                            "type": "string"
                                        }
                                    },
                                    "collector": {
                                        "type": [
                                            "array",
                                            "null"
                                        ],
                                        "items": {
                                            "type": "string"
                                        }
                                    },
                                    "distributionDetails": {
                                        "type": [
                                            "object",
                                            "null"
                                        ],
                                        "description": "Distribution",
                                        "properties": {
                                            "dispatchDate": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "format": "date-time"
                                            },
                                            "dispatchTime": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            },
                                            "vehicleNumber": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            },
                                            "vehileNumber": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            }
                                        }
                                    },
                                    "isFuelInvoice": {
                                        "type": [
                                            "boolean",
                                            "null"
                                        ],
                                        "description": "Fuel and Vessel Details"
                                    },
                                    "vesselDetails": {
                                        "type": [
                                            "object",
                                            "null"
                                        ],
                                        "properties": {
                                            "name": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            },
                                            "boatNumber": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            },
                                            "registryNo": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            },
                                            "vesseltype": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            },
                                            "flag": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            },
                                            "length": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            },
                                            "capacity": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            }
                                        }
                                    },
                                    "vatPaymentSuspension": {
                                        "type": [
                                            "boolean",
                                            "null"
                                        ],
                                        "description": "Additional Flags"
                                    },
                                    "selfPricing": {
                                        "type": [
                                            "boolean",
                                            "null"
                                        ]
                                    },
                                    "transmissionFailure": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "enum": [
                                            "1",
                                            "2"
                                        ]
                                    }
                                }
                            },
                            "peppol_payload": {
                                "type": [
                                    "object",
                                    "null"
                                ],
                                "properties": {
                                    "issuer_details": {
                                        "type": [
                                            "object",
                                            "null"
                                        ],
                                        "description": "PEPPOL & B2G Node Overrides",
                                        "properties": {
                                            "name": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            },
                                            "vat_number": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "description": "BT-27"
                                            },
                                            "tax_scheme": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "description": "BT-31"
                                            },
                                            "street": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            },
                                            "city": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "description": "BT-35"
                                            },
                                            "postal_code": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "description": "BT-37"
                                            },
                                            "country_code": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "description": "BT-38",
                                                "minLength": 2,
                                                "maxLength": 2
                                            }
                                        }
                                    },
                                    "customer_details": {
                                        "type": [
                                            "object",
                                            "null"
                                        ],
                                        "description": "BT-40",
                                        "properties": {
                                            "name": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            },
                                            "vat_number": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "description": "BT-44"
                                            },
                                            "tax_scheme": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "description": "BT-48"
                                            },
                                            "street": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            },
                                            "city": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "description": "BT-50"
                                            },
                                            "postal_code": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "description": "BT-52"
                                            },
                                            "country_code": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "description": "BT-53",
                                                "minLength": 2,
                                                "maxLength": 2
                                            }
                                        }
                                    },
                                    "tax_representative": {
                                        "type": [
                                            "object",
                                            "null"
                                        ],
                                        "description": "BT-55",
                                        "properties": {
                                            "name": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "description": "BG-11"
                                            },
                                            "vat_number": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "description": "BT-62"
                                            }
                                        }
                                    },
                                    "delivery": {
                                        "type": [
                                            "object",
                                            "null"
                                        ],
                                        "description": "BT-63",
                                        "properties": {
                                            "street": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "description": "BG-15"
                                            },
                                            "city": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "description": "BT-75"
                                            },
                                            "postal_code": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "description": "BT-77"
                                            },
                                            "country_code": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "description": "BT-78",
                                                "minLength": 2,
                                                "maxLength": 2
                                            }
                                        }
                                    },
                                    "document_allowances": {
                                        "type": [
                                            "array",
                                            "null"
                                        ],
                                        "items": {
                                            "type": "object",
                                            "properties": {
                                                "amount": {
                                                    "type": "number",
                                                    "description": "BG-20"
                                                },
                                                "reason": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            }
                                        }
                                    },
                                    "payment_means": {
                                        "type": [
                                            "object",
                                            "null"
                                        ],
                                        "properties": {
                                            "type_code": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            },
                                            "payee_account_id": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "description": "BT-81"
                                            }
                                        }
                                    },
                                    "tax_totals": {
                                        "type": [
                                            "array",
                                            "null"
                                        ],
                                        "description": "BT-84 (IBAN)",
                                        "items": {
                                            "type": "object",
                                            "properties": {
                                                "tax_category_code": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "tax_percent": {
                                                    "type": [
                                                        "number",
                                                        "null"
                                                    ],
                                                    "description": "BT-118 (S, Z, E)"
                                                },
                                                "taxable_amount": {
                                                    "type": [
                                                        "number",
                                                        "null"
                                                    ],
                                                    "description": "BT-119"
                                                },
                                                "tax_amount": {
                                                    "type": [
                                                        "number",
                                                        "null"
                                                    ],
                                                    "description": "BT-116"
                                                }
                                            }
                                        }
                                    },
                                    "allowances_charges": {
                                        "type": [
                                            "array",
                                            "null"
                                        ],
                                        "description": "BT-117",
                                        "items": {
                                            "type": "object",
                                            "properties": {
                                                "charge_indicator": {
                                                    "type": [
                                                        "boolean",
                                                        "null"
                                                    ]
                                                },
                                                "reason_code": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "BT-92"
                                                },
                                                "amount": {
                                                    "type": [
                                                        "number",
                                                        "null"
                                                    ],
                                                    "description": "BT-98"
                                                }
                                            }
                                        }
                                    },
                                    "lines": {
                                        "type": [
                                            "array",
                                            "null"
                                        ],
                                        "description": "BT-92/BT-99",
                                        "items": {
                                            "type": "object",
                                            "properties": {
                                                "line_number": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "peppol_item_name": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "peppol_unit_code": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "BT-153"
                                                },
                                                "peppol_tax_category": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "BT-130"
                                                },
                                                "allowances": {
                                                    "type": [
                                                        "array",
                                                        "null"
                                                    ],
                                                    "description": "BT-151",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "amount": {
                                                                "type": "number",
                                                                "description": "BG-27"
                                                            },
                                                            "reason": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "lines": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "line_number": {
                                    "type": "integer"
                                },
                                "net_value": {
                                    "type": "number",
                                    "minimum": 0
                                },
                                "vat_amount": {
                                    "type": "number",
                                    "minimum": 0
                                },
                                "vat_percent": {
                                    "type": "integer"
                                },
                                "vat_exemption_category_id": {
                                    "type": [
                                        "number",
                                        "null"
                                    ]
                                },
                                "quantity": {
                                    "type": [
                                        "number",
                                        "null"
                                    ],
                                    "description": "myDATA vatExemptionCategory"
                                },
                                "measurement_unit": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ]
                                },
                                "measurementUnit": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ]
                                },
                                "description": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "classificationCategory": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "classificationType": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "description": "myDATA classification category"
                                },
                                "line_comments": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "description": "myDATA E3 code"
                                },
                                "lineComments": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                }
                            },
                            "required": [
                                "line_number",
                                "net_value",
                                "vat_amount",
                                "vat_percent"
                            ]
                        },
                        "minItems": 1
                    },
                    "payments": {
                        "type": [
                            "array",
                            "null"
                        ],
                        "items": {
                            "type": "object",
                            "properties": {
                                "amount": {
                                    "type": "number",
                                    "minimum": 0
                                },
                                "payment_method_id": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ]
                                },
                                "pos_transaction_id": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "description": "myDATA payment method (1-8)"
                                },
                                "session_transaction_id": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                }
                            },
                            "required": [
                                "amount"
                            ]
                        }
                    }
                },
                "required": [
                    "issuer_vat_number",
                    "issue_date",
                    "total_net_value",
                    "total_vat_amount",
                    "total_gross_value",
                    "meta",
                    "lines"
                ],
                "title": "StoreInvoiceRequest"
            },
            "User": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "name": {
                        "type": "string"
                    },
                    "email": {
                        "type": "string"
                    },
                    "email_verified_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "created_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "updated_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "two_factor_secret": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "two_factor_enabled": {
                        "type": "integer"
                    },
                    "current_company_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "credits_balance": {
                        "type": "string"
                    }
                },
                "required": [
                    "id",
                    "name",
                    "email",
                    "email_verified_at",
                    "created_at",
                    "updated_at",
                    "two_factor_secret",
                    "two_factor_enabled",
                    "current_company_id",
                    "credits_balance"
                ],
                "title": "User"
            }
        },
        "responses": {
            "AuthenticationException": {
                "description": "Unauthenticated",
                "content": {
                    "application/json": {
                        "schema": {
                            "type": "object",
                            "properties": {
                                "message": {
                                    "type": "string",
                                    "description": "Error overview."
                                }
                            },
                            "required": [
                                "message"
                            ]
                        }
                    }
                }
            },
            "ValidationException": {
                "description": "Validation error",
                "content": {
                    "application/json": {
                        "schema": {
                            "type": "object",
                            "properties": {
                                "message": {
                                    "type": "string",
                                    "description": "Errors overview."
                                },
                                "errors": {
                                    "type": "object",
                                    "description": "A detailed description of each field that failed validation.",
                                    "additionalProperties": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        }
                                    }
                                }
                            },
                            "required": [
                                "message",
                                "errors"
                            ]
                        }
                    }
                }
            }
        }
    }
}