---
updatedAt: 2026-05-27T09:29:13.000Z
agentTools:
  projectIndex: https://pennylane.readme.io/llms.txt
---

# Import a supplier invoice with a file attached

This endpoint allows you to import a supplier invoice with a file
attached.


> ℹ️
> This endpoint requires the following scope: `supplier_invoices:all`

# OpenAPI definition

```json
{
  "openapi": "3.0.1",
  "info": {
    "title": "Company V2",
    "description": "Automate your accounting with the Pennylane API. [Documentation](https://pennylane.readme.io/)",
    "contact": {
      "email": "tech@pennylane.com"
    },
    "version": "2.0"
  },
  "x-readme": {
    "samples-languages": [
      "curl",
      "node",
      "ruby",
      "php",
      "python",
      "java"
    ]
  },
  "servers": [
    {
      "url": "https://app.pennylane.com"
    }
  ],
  "paths": {
    "/api/external/v2/supplier_invoices/import": {
      "post": {
        "operationId": "importSupplierInvoice",
        "summary": "Import a supplier invoice with a file attached",
        "description": "This endpoint allows you to import a supplier invoice with a file\nattached.\n\n\n> ℹ️\n> This endpoint requires the following scope: `supplier_invoices:all`",
        "tags": [
          "Supplier Invoices"
        ],
        "security": [
          {
            "oauth2": [
              "supplier_invoices:all"
            ]
          }
        ],
        "parameters": [
          {
            "name": "X-Company-Id",
            "description": "Numeric ID of the company to act on. Required when authenticating with a firm token. Ignored when the token is already bound to a company.",
            "in": "header",
            "schema": {
              "type": "string",
              "example": "12345"
            },
            "required": false
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "file_attachment_id": {
                    "description": "ID of a previously uploaded file attachment. The attachment must already have a file.\nIf the file is not available yet, the API returns 409; retry after a few seconds.\n",
                    "type": "integer",
                    "format": "int64",
                    "example": 123
                  },
                  "import_as_incomplete": {
                    "description": "This will mark the invoice as incomplete.",
                    "type": "boolean",
                    "default": false
                  },
                  "supplier_id": {
                    "description": "The ID of the supplier to import the invoice for",
                    "type": "integer",
                    "format": "int64",
                    "example": 456
                  },
                  "date": {
                    "description": "The date of the invoice (ISO 8601)",
                    "type": "string",
                    "format": "date",
                    "example": "2021-01-30"
                  },
                  "deadline": {
                    "description": "Invoice payment deadline (ISO 8601)",
                    "type": "string",
                    "format": "date",
                    "example": "2021-01-30"
                  },
                  "invoice_number": {
                    "allOf": [
                      {
                        "type": "string",
                        "pattern": "^[^\\x00]*$"
                      },
                      {
                        "description": "The invoice number",
                        "example": "F20230001"
                      }
                    ]
                  },
                  "currency": {
                    "type": "string",
                    "default": "EUR",
                    "enum": [
                      "EUR",
                      "USD",
                      "GBP",
                      "AED",
                      "AFN",
                      "ALL",
                      "AMD",
                      "ANG",
                      "AOA",
                      "ARS",
                      "AUD",
                      "AWG",
                      "AZN",
                      "BAM",
                      "BBD",
                      "BDT",
                      "BGN",
                      "BHD",
                      "BIF",
                      "BMD",
                      "BND",
                      "BOB",
                      "BRL",
                      "BSD",
                      "BTN",
                      "BWP",
                      "BYN",
                      "BYR",
                      "BZD",
                      "CAD",
                      "CDF",
                      "CHE",
                      "CHF",
                      "CLF",
                      "CLP",
                      "CNY",
                      "COP",
                      "CRC",
                      "CUC",
                      "CUP",
                      "CVE",
                      "CZK",
                      "DJF",
                      "DKK",
                      "DOP",
                      "DZD",
                      "EGP",
                      "ERN",
                      "ETB",
                      "FJD",
                      "FKP",
                      "GEL",
                      "GGP",
                      "GHS",
                      "GIP",
                      "GMD",
                      "GNF",
                      "GTQ",
                      "GYD",
                      "HKD",
                      "HNL",
                      "HRK",
                      "HTG",
                      "HUF",
                      "IDR",
                      "ILS",
                      "IMP",
                      "INR",
                      "IQD",
                      "IRR",
                      "ISK",
                      "JEP",
                      "JMD",
                      "JOD",
                      "JPY",
                      "KES",
                      "KGS",
                      "KHR",
                      "KMF",
                      "KPW",
                      "KRW",
                      "KWD",
                      "KYD",
                      "KZT",
                      "LAK",
                      "LBP",
                      "LKR",
                      "LRD",
                      "LSL",
                      "LTL",
                      "LVL",
                      "LYD",
                      "MAD",
                      "MDL",
                      "MGA",
                      "MKD",
                      "MMK",
                      "MNT",
                      "MOP",
                      "MRO",
                      "MRU",
                      "MUR",
                      "MVR",
                      "MWK",
                      "MXN",
                      "MYR",
                      "MZN",
                      "NAD",
                      "NGN",
                      "NIO",
                      "NOK",
                      "NPR",
                      "NZD",
                      "OMR",
                      "PAB",
                      "PEN",
                      "PGK",
                      "PHP",
                      "PKR",
                      "PLN",
                      "PYG",
                      "QAR",
                      "RON",
                      "RSD",
                      "RUB",
                      "RWF",
                      "SAR",
                      "SBD",
                      "SCR",
                      "SDG",
                      "SEK",
                      "SGD",
                      "SHP",
                      "SLL",
                      "SLE",
                      "SOS",
                      "SRD",
                      "STD",
                      "SVC",
                      "SYP",
                      "SZL",
                      "THB",
                      "TJS",
                      "TMT",
                      "TND",
                      "TOP",
                      "TRY",
                      "TTD",
                      "TWD",
                      "TZS",
                      "UAH",
                      "UGX",
                      "UYU",
                      "UZS",
                      "VEF",
                      "VES",
                      "VND",
                      "VUV",
                      "WST",
                      "XAF",
                      "XCD",
                      "XDR",
                      "XOF",
                      "XPF",
                      "YER",
                      "ZAR",
                      "ZMK",
                      "ZMW",
                      "ZWL"
                    ]
                  },
                  "currency_amount_before_tax": {
                    "allOf": [
                      {
                        "type": "string",
                        "pattern": "^-?\\d+(\\.\\d+)?$",
                        "example": "100.00"
                      },
                      {
                        "description": "Invoice currency amount before tax (total value before tax of the invoice in the currency of the invoice)",
                        "example": "100.00"
                      }
                    ]
                  },
                  "currency_amount": {
                    "allOf": [
                      {
                        "type": "string",
                        "pattern": "^(-?\\d+(\\.\\d+)?)?$",
                        "example": "100.00"
                      },
                      {
                        "description": "Invoice currency amount (total value of the invoice in the currency of the invoice)",
                        "example": "120.00"
                      }
                    ]
                  },
                  "amount": {
                    "allOf": [
                      {
                        "type": "string",
                        "pattern": "^(-?\\d+(\\.\\d+)?)?$",
                        "example": "100.00"
                      },
                      {
                        "description": "Invoice amount in euros (total value of the invoice in euros). If the currency is euro, `currency_amount` and `amount` are identical.",
                        "example": "120.00"
                      }
                    ]
                  },
                  "currency_tax": {
                    "allOf": [
                      {
                        "type": "string",
                        "pattern": "^-?\\d+(\\.\\d+)?$",
                        "example": "100.00"
                      },
                      {
                        "description": "Invoice taxable amount (in invoice currency)",
                        "example": "20.00"
                      }
                    ]
                  },
                  "tax": {
                    "allOf": [
                      {
                        "type": "string",
                        "pattern": "^(-?\\d+(\\.\\d+)?)?$",
                        "example": "100.00"
                      },
                      {
                        "description": "Invoice taxable amount (in euros). If the currency is euro, `currency_tax` and `tax` are identical.",
                        "example": "20.00"
                      }
                    ]
                  },
                  "label": {
                    "allOf": [
                      {
                        "type": "string",
                        "pattern": "^[^\\x00]*$"
                      },
                      {
                        "description": "Custom label for the invoice used on accounting (ledger) entries. If not provided, Pennylane generates a label automatically.",
                        "type": "string",
                        "maxLength": 2000,
                        "nullable": true,
                        "example": "Custom accounting label"
                      }
                    ]
                  },
                  "transaction_reference": {
                    "description": "By adding this field you can automatically reconcile the newly imported invoice with a transaction. See documentation about [automatic payment matching](https://pennylane.readme.io/v2.0/docs/automating-payment-matching).",
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "banking_provider": {
                        "description": "The banking provider for the transaction",
                        "type": "string",
                        "example": "bank",
                        "enum": [
                          "stripe",
                          "gocardless",
                          "bank",
                          "budgetinsight",
                          "helloasso"
                        ]
                      },
                      "provider_field_name": {
                        "description": "Name of the field that you want to match",
                        "type": "string",
                        "example": "label",
                        "enum": [
                          "payment_id",
                          "charge_id",
                          "report_id",
                          "webid",
                          "label",
                          "order_id"
                        ]
                      },
                      "provider_field_value": {
                        "allOf": [
                          {
                            "type": "string",
                            "pattern": "^[^\\x00]*$"
                          },
                          {
                            "description": "Value that you want to match.\n\nWith `banking_provider: stripe` or `gocardless`, the value is matched exactly against the reference with the same `provider_field_name` synced from that provider, on non-archived transactions.\n\nWith `banking_provider: bank` and `provider_field_name: label`, every non-archived bank transaction whose label contains this value as a whole word is matched, including transactions already matched to other documents. The match is case-sensitive, and a value that does not start and end with a letter, digit or underscore never matches. Use a value that identifies a single payment, such as a card transaction ID: a merchant name or a short generic value groups unrelated documents together. Pass the literal string `invoice_number` to match on this invoice's number instead of a fixed value.\n\nOther combinations do not match any transaction.\n\nIn all cases, matching runs again on every update of this invoice.",
                            "type": "string",
                            "example": "invoice_number"
                          }
                        ]
                      }
                    },
                    "required": [
                      "banking_provider",
                      "provider_field_name",
                      "provider_field_value"
                    ]
                  },
                  "invoice_lines": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "label": {
                          "allOf": [
                            {
                              "type": "string",
                              "pattern": "^[^\\x00]*$"
                            },
                            {
                              "description": "Invoice line label\n\n> ⚠️ This attribute is deprecated and will be removed soon.\n",
                              "example": "Demo label",
                              "deprecated": true
                            }
                          ]
                        },
                        "description": {
                          "allOf": [
                            {
                              "type": "string",
                              "pattern": "^[^\\x00]*$"
                            },
                            {
                              "description": "Invoice line description\n\n> ⚠️ This attribute is deprecated and will be removed soon.\n",
                              "example": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor",
                              "deprecated": true
                            }
                          ]
                        },
                        "currency_amount": {
                          "allOf": [
                            {
                              "type": "string",
                              "pattern": "^(-?\\d+(\\.\\d+)?)?$",
                              "example": "100.00"
                            },
                            {
                              "description": "Invoice line total amount in the currency of the invoice.",
                              "example": "120.00"
                            }
                          ]
                        },
                        "amount": {
                          "allOf": [
                            {
                              "type": "string",
                              "pattern": "^(-?\\d+(\\.\\d+)?)?$",
                              "example": "100.00"
                            },
                            {
                              "description": "Invoice line amount in euros. If the currency is euro, `currency_amount` and `amount` are identical.",
                              "example": "120.00"
                            }
                          ]
                        },
                        "currency_tax": {
                          "allOf": [
                            {
                              "type": "string",
                              "pattern": "^(-?\\d+(\\.\\d+)?)?$",
                              "example": "100.00"
                            },
                            {
                              "description": "Invoice line taxable amount (in invoice currency)",
                              "example": "20.00"
                            }
                          ]
                        },
                        "tax": {
                          "allOf": [
                            {
                              "type": "string",
                              "pattern": "^(-?\\d+(\\.\\d+)?)?$",
                              "example": "100.00"
                            },
                            {
                              "description": "Invoice line taxable amount (in euros). If the currency is euro, `currency_tax` and `tax` are identical.",
                              "example": "20.00"
                            }
                          ]
                        },
                        "ledger_account_id": {
                          "description": "The ledger account ID",
                          "type": "integer",
                          "format": "int64",
                          "example": 1255
                        },
                        "vat_rate": {
                          "description": "Product VAT rate. A 20% VAT in France is FR_200.",
                          "type": "string",
                          "example": "FR_200",
                          "enum": [
                            "FR_1_05",
                            "FR_1_75",
                            "FR_09",
                            "FR_21",
                            "FR_40",
                            "FR_50",
                            "FR_55",
                            "FR_60",
                            "FR_65",
                            "FR_85",
                            "FR_92",
                            "FR_100",
                            "FR_130",
                            "FR_15_385",
                            "FR_160",
                            "FR_196",
                            "FR_200",
                            "AD_10",
                            "AD_45",
                            "AD_95",
                            "AT_100",
                            "AT_130",
                            "AT_190",
                            "AT_200",
                            "BE_60",
                            "BE_120",
                            "BE_210",
                            "BG_90",
                            "BG_200",
                            "CH_25",
                            "CH_37",
                            "CH_77",
                            "CH_26",
                            "CH_38",
                            "CH_81",
                            "CY_30",
                            "CY_50",
                            "CY_80",
                            "CY_90",
                            "CY_190",
                            "CZ_100",
                            "CZ_120",
                            "CZ_150",
                            "CZ_210",
                            "DE_70",
                            "DE_190",
                            "DK_250",
                            "EE_90",
                            "EE_200",
                            "EE_220",
                            "EE_240",
                            "ES_40",
                            "ES_70",
                            "ES_100",
                            "ES_210",
                            "FI_100",
                            "FI_135",
                            "FI_140",
                            "FI_240",
                            "FI_255",
                            "GB_50",
                            "GB_200",
                            "GR_60",
                            "GR_130",
                            "GR_170",
                            "GR_240",
                            "GR_40",
                            "HR_50",
                            "HR_130",
                            "HR_250",
                            "HU_50",
                            "HU_180",
                            "HU_270",
                            "IE_48",
                            "IE_90",
                            "IE_135",
                            "IE_210",
                            "IE_230",
                            "IT_40",
                            "IT_50",
                            "IT_100",
                            "IT_220",
                            "LT_50",
                            "LT_90",
                            "LT_120",
                            "LT_210",
                            "LU_30",
                            "LU_70",
                            "LU_80",
                            "LU_120",
                            "LU_130",
                            "LU_140",
                            "LU_160",
                            "LU_170",
                            "LV_50",
                            "LV_120",
                            "LV_210",
                            "MC_09",
                            "MC_21",
                            "MC_55",
                            "MC_85",
                            "MC_100",
                            "MC_200",
                            "MT_50",
                            "MT_70",
                            "MT_120",
                            "MT_180",
                            "MU_150",
                            "NL_90",
                            "NL_210",
                            "PL_50",
                            "PL_80",
                            "PL_230",
                            "PT_60",
                            "PT_130",
                            "PT_160",
                            "PT_180",
                            "PT_220",
                            "PT_230",
                            "RO_50",
                            "RO_90",
                            "RO_110",
                            "RO_190",
                            "RO_210",
                            "SE_60",
                            "SE_120",
                            "SE_250",
                            "SI_50",
                            "SI_95",
                            "SI_220",
                            "SK_50",
                            "SK_100",
                            "SK_190",
                            "SK_200",
                            "SK_230",
                            "NO_120",
                            "NO_150",
                            "NO_250",
                            "DE_70_BU0002",
                            "DE_190_BU0003",
                            "DE_70_BU0008",
                            "DE_190_BU0009",
                            "DE_intracom_70_BU0012",
                            "DE_intracom_190_BU0013",
                            "DE_190_electronic_BU0226",
                            "exempt",
                            "DE_intracom_exempt_BU0011",
                            "DE_intracom_exempt_BU0047",
                            "DE_intracom_exempt_BU0233",
                            "DE_exempt_BU0001",
                            "DE_exempt_BU0181",
                            "DE_exempt_BU0490",
                            "intracom_21",
                            "intracom_55",
                            "intracom_85",
                            "intracom_100",
                            "crossborder",
                            "ES_intracom_sales_goods",
                            "ES_intracom_sales_services",
                            "DE_intracom_70_BU0018",
                            "DE_intracom_190_BU0019",
                            "DE_intracom_190_BU0506",
                            "extracom",
                            "DE_extracom_BU0173",
                            "DE_extracom_BU0191",
                            "DE_extracom_190_BU0511",
                            "ES_isp_sales",
                            "ES_suplido",
                            "FR_85_construction",
                            "FR_100_construction",
                            "FR_200_construction",
                            "DE_exempt_construction_BU0046",
                            "DE_70_construction_BU0091",
                            "DE_190_construction_BU0094",
                            "DE_190_construction_BU0526",
                            "DE_190_construction_BU0546",
                            "ES_isp_purchases_210",
                            "ES_isp_purchases_100",
                            "mixed"
                          ]
                        },
                        "imputation_dates": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "start_date": {
                              "description": "Start date of the imputation period (ISO 8601)",
                              "type": "string",
                              "format": "date",
                              "example": "2020-06-30"
                            },
                            "end_date": {
                              "description": "End date of the imputation period (ISO 8601)",
                              "type": "string",
                              "format": "date",
                              "example": "2021-06-30"
                            }
                          },
                          "required": [
                            "start_date",
                            "end_date"
                          ]
                        },
                        "performance_period": {
                          "description": "Date range during which the service or delivery was performed (ISO 8601). Used for German VAT accounting (Leistungsdatum).",
                          "type": "object",
                          "nullable": true,
                          "additionalProperties": false,
                          "properties": {
                            "start_date": {
                              "description": "Start date of the performance period (ISO 8601)",
                              "type": "string",
                              "format": "date",
                              "nullable": true,
                              "example": "2023-07-01"
                            },
                            "end_date": {
                              "description": "End date of the performance period (ISO 8601)",
                              "type": "string",
                              "format": "date",
                              "example": "2023-07-31"
                            },
                            "date_type": {
                              "description": "Whether the performance period represents a single date or a range, and whether it is a delivery or service.\n- delivery_date: single delivery date (end_date only)\n- service_date: single service date (end_date only)\n- delivery_period: delivery date range (start_date and end_date)\n- service_period: service date range (start_date and end_date)\n",
                              "type": "string",
                              "enum": [
                                "delivery_date",
                                "service_date",
                                "delivery_period",
                                "service_period"
                              ]
                            }
                          },
                          "required": [
                            "end_date",
                            "date_type"
                          ]
                        },
                        "ledger_entry_line": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "label": {
                              "allOf": [
                                {
                                  "type": "string",
                                  "pattern": "^[^\\x00]*$"
                                },
                                {
                                  "description": "Ledger entry line label.\nLedger entry lines with identical labels, tax, and ledger accounts will be automatically compacted into a single line.\n",
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 255,
                                  "example": "Demo label"
                                }
                              ]
                            }
                          },
                          "required": [
                            "label"
                          ]
                        }
                      },
                      "required": [
                        "currency_amount",
                        "currency_tax",
                        "vat_rate"
                      ]
                    },
                    "minItems": 1
                  },
                  "external_reference": {
                    "allOf": [
                      {
                        "type": "string",
                        "pattern": "^[^\\x00]*$"
                      },
                      {
                        "description": "A unique external reference you can provide to track this supplier. If not provided, Pennylane will generate an identifier for you.",
                        "example": "FR123"
                      }
                    ]
                  }
                },
                "required": [
                  "file_attachment_id",
                  "supplier_id",
                  "date",
                  "deadline",
                  "currency_amount_before_tax",
                  "currency_amount",
                  "currency_tax",
                  "invoice_lines"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The imported supplier invoice",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "id": {
                      "description": "The ID of the supplier invoice",
                      "type": "integer",
                      "format": "int64",
                      "example": 123
                    },
                    "label": {
                      "type": "string",
                      "nullable": true,
                      "example": "Demo label"
                    },
                    "invoice_number": {
                      "type": "string",
                      "example": "F20230001"
                    },
                    "currency": {
                      "type": "string",
                      "default": "EUR",
                      "enum": [
                        "EUR",
                        "USD",
                        "GBP",
                        "AED",
                        "AFN",
                        "ALL",
                        "AMD",
                        "ANG",
                        "AOA",
                        "ARS",
                        "AUD",
                        "AWG",
                        "AZN",
                        "BAM",
                        "BBD",
                        "BDT",
                        "BGN",
                        "BHD",
                        "BIF",
                        "BMD",
                        "BND",
                        "BOB",
                        "BRL",
                        "BSD",
                        "BTN",
                        "BWP",
                        "BYN",
                        "BYR",
                        "BZD",
                        "CAD",
                        "CDF",
                        "CHE",
                        "CHF",
                        "CLF",
                        "CLP",
                        "CNY",
                        "COP",
                        "CRC",
                        "CUC",
                        "CUP",
                        "CVE",
                        "CZK",
                        "DJF",
                        "DKK",
                        "DOP",
                        "DZD",
                        "EGP",
                        "ERN",
                        "ETB",
                        "FJD",
                        "FKP",
                        "GEL",
                        "GGP",
                        "GHS",
                        "GIP",
                        "GMD",
                        "GNF",
                        "GTQ",
                        "GYD",
                        "HKD",
                        "HNL",
                        "HRK",
                        "HTG",
                        "HUF",
                        "IDR",
                        "ILS",
                        "IMP",
                        "INR",
                        "IQD",
                        "IRR",
                        "ISK",
                        "JEP",
                        "JMD",
                        "JOD",
                        "JPY",
                        "KES",
                        "KGS",
                        "KHR",
                        "KMF",
                        "KPW",
                        "KRW",
                        "KWD",
                        "KYD",
                        "KZT",
                        "LAK",
                        "LBP",
                        "LKR",
                        "LRD",
                        "LSL",
                        "LTL",
                        "LVL",
                        "LYD",
                        "MAD",
                        "MDL",
                        "MGA",
                        "MKD",
                        "MMK",
                        "MNT",
                        "MOP",
                        "MRO",
                        "MRU",
                        "MUR",
                        "MVR",
                        "MWK",
                        "MXN",
                        "MYR",
                        "MZN",
                        "NAD",
                        "NGN",
                        "NIO",
                        "NOK",
                        "NPR",
                        "NZD",
                        "OMR",
                        "PAB",
                        "PEN",
                        "PGK",
                        "PHP",
                        "PKR",
                        "PLN",
                        "PYG",
                        "QAR",
                        "RON",
                        "RSD",
                        "RUB",
                        "RWF",
                        "SAR",
                        "SBD",
                        "SCR",
                        "SDG",
                        "SEK",
                        "SGD",
                        "SHP",
                        "SLL",
                        "SLE",
                        "SOS",
                        "SRD",
                        "STD",
                        "SVC",
                        "SYP",
                        "SZL",
                        "THB",
                        "TJS",
                        "TMT",
                        "TND",
                        "TOP",
                        "TRY",
                        "TTD",
                        "TWD",
                        "TZS",
                        "UAH",
                        "UGX",
                        "UYU",
                        "UZS",
                        "VEF",
                        "VES",
                        "VND",
                        "VUV",
                        "WST",
                        "XAF",
                        "XCD",
                        "XDR",
                        "XOF",
                        "XPF",
                        "YER",
                        "ZAR",
                        "ZMK",
                        "ZMW",
                        "ZWL"
                      ]
                    },
                    "amount": {
                      "description": "Invoice amount (total value of the invoice in euros). If the currency is euro, `currency_amount` and `amount` are identical.",
                      "type": "string",
                      "example": "230.32"
                    },
                    "currency_amount": {
                      "description": "Invoice currency amount (total value of the invoice in the currency of the invoice)",
                      "type": "string",
                      "example": "230.32"
                    },
                    "currency_amount_before_tax": {
                      "description": "Invoice currency amount before tax (total value before tax of the invoice in the currency of the invoice)",
                      "type": "string",
                      "example": "196.32"
                    },
                    "exchange_rate": {
                      "description": "Invoice exchange rate (used to convert the invoice to euros. If the invoice currency is euro it will be 1.0)",
                      "type": "string",
                      "example": "1.0"
                    },
                    "date": {
                      "description": "Invoice issue date (ISO 8601)",
                      "type": "string",
                      "format": "date",
                      "nullable": true,
                      "example": "2023-08-30"
                    },
                    "deadline": {
                      "description": "Invoice payment deadline (ISO 8601)",
                      "type": "string",
                      "format": "date",
                      "nullable": true,
                      "example": "2023-09-30"
                    },
                    "performance_date": {
                      "description": "End date of the performance period of the first invoice line that has one (ISO 8601). Used for German VAT accounting (Leistungsdatum). Null if the company does not use German accounting, or if no invoice line has a performance period.",
                      "type": "string",
                      "format": "date",
                      "nullable": true,
                      "example": "2023-07-31"
                    },
                    "currency_tax": {
                      "description": "Invoice taxable amount (in invoice currency)",
                      "type": "string",
                      "example": "34.0"
                    },
                    "tax": {
                      "description": "Invoice taxable amount (in euros). If the currency is euro, `currency_tax` and `tax` are identical.",
                      "type": "string",
                      "example": "34.0"
                    },
                    "reconciled": {
                      "description": "Whether the invoice has been reconciled or not",
                      "type": "boolean",
                      "example": false
                    },
                    "accounting_status": {
                      "description": "The accounting state of the invoice.\n- `draft`: The invoice is not yet sent to the accountant.\n- `archived`: The invoice has been archived.\n- `entry`: The invoice is incomplete. Some information is missing on the invoice and needs to be completed by SME.\n- `validation_needed`: The invoice is sent to the accountant and needs validation.\n- `complete`: The invoice has been validated by the accountant.\n",
                      "type": "string",
                      "enum": [
                        "draft",
                        "archived",
                        "entry",
                        "validation_needed",
                        "complete"
                      ]
                    },
                    "filename": {
                      "description": "Name of the file attached to the invoice",
                      "type": "string",
                      "nullable": true,
                      "example": "my_file.pdf"
                    },
                    "public_file_url": {
                      "description": "Public URL of the invoice file. The URL will expire after 30 minutes.",
                      "type": "string",
                      "nullable": true,
                      "example": "https://app.pennylane.com/public/invoice/pdf?encrypted_id=bzjoVJe...3D%3D"
                    },
                    "remaining_amount_with_tax": {
                      "description": "The remaining amount with VAT to pay for the invoice to be considered paid",
                      "type": "string",
                      "nullable": true,
                      "example": "20.0"
                    },
                    "remaining_amount_without_tax": {
                      "description": "The remaining amount without VAT to pay for the invoice to be considered paid",
                      "type": "string",
                      "nullable": true,
                      "example": "16.0"
                    },
                    "ledger_entry": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "id": {
                          "description": "Ledger entry identifier",
                          "type": "integer",
                          "format": "int64",
                          "example": 42003
                        }
                      },
                      "required": [
                        "id"
                      ]
                    },
                    "supplier": {
                      "type": "object",
                      "nullable": true,
                      "additionalProperties": false,
                      "properties": {
                        "id": {
                          "type": "integer",
                          "format": "int64",
                          "example": 456
                        },
                        "url": {
                          "description": "URL to get the supplier.",
                          "type": "string",
                          "example": "https://app.pennylane.com/api/external/v2/suppliers/42"
                        }
                      },
                      "required": [
                        "id",
                        "url"
                      ]
                    },
                    "payment_method_ledger_account": {
                      "description": "Ledger account used for reconciliation by payment method.\nWhen present, the receivable/payable was transferred to this account.\n",
                      "type": "object",
                      "nullable": true,
                      "additionalProperties": false,
                      "properties": {
                        "id": {
                          "type": "integer",
                          "format": "int64",
                          "example": 1255
                        },
                        "url": {
                          "description": "URL to get the ledger account.",
                          "type": "string",
                          "example": "https://app.pennylane.com/api/external/v2/ledger_accounts/1255"
                        }
                      },
                      "required": [
                        "id",
                        "url"
                      ]
                    },
                    "invoice_lines": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "url": {
                          "description": "URL to get the invoice lines of the invoice.",
                          "type": "string",
                          "example": "https://app.pennylane.com/api/external/v2/supplier_invoices/42/invoice_lines"
                        }
                      },
                      "required": [
                        "url"
                      ]
                    },
                    "categories": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "url": {
                          "description": "URL to get the categories of the invoice.",
                          "type": "string",
                          "example": "https://app.pennylane.com/api/external/v2/supplier_invoices/42/categories"
                        }
                      },
                      "required": [
                        "url"
                      ]
                    },
                    "transaction_reference": {
                      "description": "This reconciles the invoice with a transaction. See documentation about [automatic payment matching](https://pennylane.readme.io/v2.0/docs/automating-payment-matching).",
                      "type": "object",
                      "nullable": true,
                      "additionalProperties": false,
                      "properties": {
                        "banking_provider": {
                          "description": "The banking provider for the transaction",
                          "type": "string",
                          "example": "bank"
                        },
                        "provider_field_name": {
                          "description": "Name of the field that you want to match",
                          "type": "string",
                          "example": "label"
                        },
                        "provider_field_value": {
                          "description": "Value that you want to match",
                          "type": "string",
                          "example": "invoice_number"
                        }
                      },
                      "required": [
                        "banking_provider",
                        "provider_field_name",
                        "provider_field_value"
                      ]
                    },
                    "payment_status": {
                      "type": "string",
                      "enum": [
                        "to_be_processed",
                        "to_be_paid",
                        "partially_paid",
                        "payment_error",
                        "payment_scheduled",
                        "payment_in_progress",
                        "payment_emitted",
                        "payment_found",
                        "paid_offline",
                        "fully_paid"
                      ]
                    },
                    "paid": {
                      "description": "Invoice paid status (set to true if the invoice is paid)",
                      "type": "boolean",
                      "example": false
                    },
                    "payments": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "url": {
                          "description": "URL to get the payments of the invoice.",
                          "type": "string",
                          "example": "https://app.pennylane.com/api/external/v2/supplier_invoices/42/payments"
                        }
                      },
                      "required": [
                        "url"
                      ]
                    },
                    "matched_transactions": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "url": {
                          "description": "URL to get the transactions of the invoice.",
                          "type": "string",
                          "example": "https://app.pennylane.com/api/external/v2/supplier_invoices/42/matched_transactions"
                        }
                      },
                      "required": [
                        "url"
                      ]
                    },
                    "external_reference": {
                      "description": "The unique external reference that was assigned during creation either by you or Pennylane",
                      "type": "string",
                      "example": "FR123"
                    },
                    "import_source": {
                      "description": "Origin file information for invoices imported via a file connector\n(Dropbox or Google Drive). Null for invoices created by other means.\n",
                      "type": "object",
                      "nullable": true,
                      "additionalProperties": false,
                      "properties": {
                        "source": {
                          "description": "The connector type that imported this invoice.",
                          "type": "string",
                          "example": "dropbox",
                          "enum": [
                            "dropbox",
                            "gdrive"
                          ]
                        },
                        "path": {
                          "description": "The file path of the invoice in the connector's storage.",
                          "type": "string",
                          "example": "/ACCOUNTING INVOICES/2024/invoice.pdf"
                        }
                      },
                      "required": [
                        "source",
                        "path"
                      ]
                    },
                    "e_invoicing": {
                      "description": "E-invoicing lifecycle information managed by the PA.\nContains the current status and associated reason when applicable.\nThis field is only present for invoices received through e-invoicing.\n",
                      "type": "object",
                      "nullable": true,
                      "additionalProperties": false,
                      "properties": {
                        "status": {
                          "anyOf": [
                            {
                              "type": "string",
                              "enum": [
                                "waiting_for_validation",
                                "approved",
                                "rejected",
                                "disputed",
                                "refused",
                                "collected",
                                "partially_collected"
                              ]
                            },
                            {
                              "nullable": true,
                              "type": "string",
                              "enum": [
                                null
                              ]
                            }
                          ]
                        },
                        "reason": {
                          "anyOf": [
                            {
                              "type": "string",
                              "enum": [
                                "incorrect_vat_rate",
                                "incorrect_unit_prices",
                                "incorrect_billed_quantity",
                                "incorrect_billed_item",
                                "defective_delivered_item",
                                "delivery_issue",
                                "bank_details_error",
                                "incorrect_payment_terms",
                                "missing_legal_notice",
                                "missing_contractual_reference",
                                "recipient_error",
                                "contract_completed",
                                "duplicate_invoice",
                                "incorrect_prices",
                                "non_compliant_invoice"
                              ]
                            },
                            {
                              "nullable": true,
                              "type": "string",
                              "enum": [
                                null
                              ]
                            }
                          ]
                        },
                        "flow": {
                          "description": "The AFNOR flow associated with this e-invoice.",
                          "type": "object",
                          "nullable": true,
                          "additionalProperties": false,
                          "properties": {
                            "id": {
                              "type": "string",
                              "format": "uuid"
                            }
                          },
                          "required": [
                            "id"
                          ]
                        },
                        "source_file_url": {
                          "description": "URL to download the original e-invoice file as received from the PA\n(CII, UBL, or Factur-X). Pennylane may replace the main invoice file\nwith a generated PDF; this field preserves the untouched file received\nfrom the PA.\n",
                          "type": "string",
                          "nullable": true,
                          "example": "https://app.pennylane.com/rails/active_storage/blobs/redirect/abc123/invoice.xml"
                        },
                        "electronic_billing_address": {
                          "description": "The electronic billing address (Peppol address) that received this\ne-invoice. Use it to isolate invoices routed to a specific entity.\n",
                          "type": "string",
                          "nullable": true,
                          "example": "0009:123456789"
                        }
                      },
                      "required": [
                        "status",
                        "reason",
                        "flow",
                        "source_file_url",
                        "electronic_billing_address"
                      ]
                    },
                    "archived_at": {
                      "description": "The time the invoice has been archived",
                      "type": "string",
                      "format": "date-time",
                      "nullable": true,
                      "example": "2023-08-30T10:08:08.146343Z"
                    },
                    "created_at": {
                      "description": "The time the invoice has been created",
                      "type": "string",
                      "format": "date-time",
                      "example": "2023-08-30T10:08:08.146343Z"
                    },
                    "updated_at": {
                      "description": "The last time the invoice has been updated",
                      "type": "string",
                      "format": "date-time",
                      "example": "2023-08-30T10:08:08.146343Z"
                    }
                  },
                  "required": [
                    "id",
                    "label",
                    "invoice_number",
                    "currency",
                    "amount",
                    "currency_amount",
                    "currency_amount_before_tax",
                    "exchange_rate",
                    "date",
                    "deadline",
                    "performance_date",
                    "currency_tax",
                    "tax",
                    "reconciled",
                    "accounting_status",
                    "filename",
                    "public_file_url",
                    "remaining_amount_with_tax",
                    "remaining_amount_without_tax",
                    "ledger_entry",
                    "supplier",
                    "payment_method_ledger_account",
                    "invoice_lines",
                    "categories",
                    "transaction_reference",
                    "payment_status",
                    "paid",
                    "payments",
                    "matched_transactions",
                    "external_reference",
                    "import_source",
                    "e_invoicing",
                    "archived_at",
                    "created_at",
                    "updated_at"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "error": {
                          "type": "string"
                        },
                        "status": {
                          "type": "integer"
                        }
                      },
                      "required": [
                        "error",
                        "status"
                      ]
                    },
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "message"
                      ]
                    },
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "message": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string",
                          "enum": [
                            "InvalidDateFormat",
                            "InvalidDateTimeFormat",
                            "InvalidEmailFormat",
                            "InvalidPattern",
                            "InvalidUUIDFormat",
                            "LessThanExclusiveMinimum",
                            "LessThanMinimum",
                            "LessThanMinItems",
                            "LessThanMinLength",
                            "MoreThanExclusiveMaximum",
                            "MoreThanMaximum",
                            "MoreThanMaxItems",
                            "MoreThanMaxLength",
                            "NotAMultipartFile",
                            "NotAnyOf",
                            "NotEnumInclude",
                            "NotExistContentTypeDefinition",
                            "NotExistDiscriminatorMappedSchema",
                            "NotExistDiscriminatorPropertyName",
                            "NotExistPropertyDefinition",
                            "NotExistRequiredKey",
                            "NotExistStatusCodeDefinition",
                            "NotNullError",
                            "NotOneOf",
                            "ValidateError"
                          ]
                        }
                      },
                      "required": [
                        "message",
                        "code"
                      ]
                    },
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "message": {
                          "type": "string"
                        },
                        "field": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string",
                          "enum": [
                            "InvalidDateFormat",
                            "InvalidDateTimeFormat",
                            "InvalidEmailFormat",
                            "InvalidPattern",
                            "InvalidUUIDFormat",
                            "LessThanExclusiveMinimum",
                            "LessThanMinimum",
                            "LessThanMinItems",
                            "LessThanMinLength",
                            "MoreThanExclusiveMaximum",
                            "MoreThanMaximum",
                            "MoreThanMaxItems",
                            "MoreThanMaxLength",
                            "NotAMultipartFile",
                            "NotAnyOf",
                            "NotEnumInclude",
                            "NotExistContentTypeDefinition",
                            "NotExistDiscriminatorMappedSchema",
                            "NotExistDiscriminatorPropertyName",
                            "NotExistPropertyDefinition",
                            "NotExistRequiredKey",
                            "NotExistStatusCodeDefinition",
                            "NotNullError",
                            "NotOneOf",
                            "ValidateError"
                          ]
                        }
                      },
                      "required": [
                        "message",
                        "field",
                        "code"
                      ]
                    },
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "message": {
                          "type": "string"
                        },
                        "payload": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string",
                          "enum": [
                            "InvalidDateFormat",
                            "InvalidDateTimeFormat",
                            "InvalidEmailFormat",
                            "InvalidPattern",
                            "InvalidUUIDFormat",
                            "LessThanExclusiveMinimum",
                            "LessThanMinimum",
                            "LessThanMinItems",
                            "LessThanMinLength",
                            "MoreThanExclusiveMaximum",
                            "MoreThanMaximum",
                            "MoreThanMaxItems",
                            "MoreThanMaxLength",
                            "NotAMultipartFile",
                            "NotAnyOf",
                            "NotEnumInclude",
                            "NotExistContentTypeDefinition",
                            "NotExistDiscriminatorMappedSchema",
                            "NotExistDiscriminatorPropertyName",
                            "NotExistPropertyDefinition",
                            "NotExistRequiredKey",
                            "NotExistStatusCodeDefinition",
                            "NotNullError",
                            "NotOneOf",
                            "ValidateError"
                          ]
                        }
                      },
                      "required": [
                        "message",
                        "payload",
                        "code"
                      ]
                    },
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "message": {
                          "type": "string"
                        },
                        "field": {
                          "type": "string"
                        },
                        "payload": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string",
                          "enum": [
                            "InvalidDateFormat",
                            "InvalidDateTimeFormat",
                            "InvalidEmailFormat",
                            "InvalidPattern",
                            "InvalidUUIDFormat",
                            "LessThanExclusiveMinimum",
                            "LessThanMinimum",
                            "LessThanMinItems",
                            "LessThanMinLength",
                            "MoreThanExclusiveMaximum",
                            "MoreThanMaximum",
                            "MoreThanMaxItems",
                            "MoreThanMaxLength",
                            "NotAMultipartFile",
                            "NotAnyOf",
                            "NotEnumInclude",
                            "NotExistContentTypeDefinition",
                            "NotExistDiscriminatorMappedSchema",
                            "NotExistDiscriminatorPropertyName",
                            "NotExistPropertyDefinition",
                            "NotExistRequiredKey",
                            "NotExistStatusCodeDefinition",
                            "NotNullError",
                            "NotOneOf",
                            "ValidateError"
                          ]
                        }
                      },
                      "required": [
                        "message",
                        "field",
                        "payload",
                        "code"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Access token is missing or invalid",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "error": {
                      "type": "string",
                      "example": "The access token is invalid"
                    },
                    "status": {
                      "type": "integer",
                      "example": 401
                    }
                  },
                  "required": [
                    "error",
                    "status"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Access to this resource forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "error": {
                      "type": "string",
                      "example": "Access to this resource requires scope \"ledger\"."
                    },
                    "status": {
                      "type": "integer",
                      "example": 403
                    }
                  },
                  "required": [
                    "error",
                    "status"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "The resource was not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "error": {
                      "type": "string",
                      "example": "Not Found"
                    },
                    "status": {
                      "type": "integer",
                      "example": 404
                    }
                  },
                  "required": [
                    "error",
                    "status"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "Conflict with the current state of the target resource, such as when trying to create a resource that already exists.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "error": {
                      "type": "string",
                      "example": "Conflict with the current state of the target resource. Resource already exists."
                    },
                    "status": {
                      "type": "integer",
                      "example": 409
                    }
                  },
                  "required": [
                    "error",
                    "status"
                  ]
                }
              }
            }
          },
          "414": {
            "description": "URI Too Long: the request URL exceeds the maximum length. Shorten the query string, for example by sending fewer values per query parameter and splitting them across several requests."
          },
          "422": {
            "description": "Unprocessable content",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "error": {
                      "type": "string",
                      "example": "Entry lines are not balanced"
                    },
                    "status": {
                      "type": "integer",
                      "example": 422
                    }
                  },
                  "required": [
                    "error",
                    "status"
                  ]
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "oauth2": {
        "type": "oauth2",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "https://app.pennylane.com/oauth/authorize",
            "tokenUrl": "https://app.pennylane.com/oauth/oauth/token",
            "refreshUrl": "https://app.pennylane.com/oauth/oauth/token",
            "scopes": {
              "ledger": "Grant create, update and read access to Ledger Entries and its related resources"
            }
          }
        }
      }
    }
  }
}
```