{
  "components": {
    "responses": {
      "APIError": {
        "content": {
          "application/json": {
            "schema": {
              "externalDocs": {
                "url": "https://pkg.go.dev/encore.dev/beta/errs#Error"
              },
              "properties": {
                "code": {
                  "description": "Error code",
                  "example": "not_found",
                  "externalDocs": {
                    "url": "https://pkg.go.dev/encore.dev/beta/errs#ErrCode"
                  },
                  "type": "string"
                },
                "details": {
                  "description": "Error details",
                  "type": "object"
                },
                "message": {
                  "description": "Error message",
                  "type": "string"
                }
              },
              "title": "APIError",
              "type": "object"
            }
          }
        },
        "description": "Error response"
      }
    },
    "schemas": {
      "publicapi.Account": {
        "properties": {
          "code": {
            "format": "int64",
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "type": {
            "title": "Type is one of: asset, liability, equity, income, expense.\n",
            "type": "string"
          }
        },
        "required": [
          "code",
          "name",
          "type"
        ],
        "title": "Account is a Norwegian standard chart-of-accounts (NS 4102) account.\n",
        "type": "object"
      },
      "publicapi.BankTransaction": {
        "properties": {
          "amountMinor": {
            "format": "int64",
            "title": "AmountMinor is negative for money out, positive for money in.\n",
            "type": "integer"
          },
          "bookingDate": {
            "title": "YYYY-MM-DD\n",
            "type": "string"
          },
          "counterparty": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "remittance": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "bookingDate",
          "amountMinor",
          "currency",
          "counterparty",
          "remittance"
        ],
        "title": "BankTransaction is a transaction as fetched from the company's bank.\n",
        "type": "object"
      },
      "publicapi.CreateInvoiceLine": {
        "properties": {
          "description": {
            "type": "string"
          },
          "quantity": {
            "type": "number"
          },
          "unitCode": {
            "title": "UnitCode is a UN/ECE rec 20 unit; defaults to EA.\n",
            "type": "string"
          },
          "unitPriceMinor": {
            "format": "int64",
            "type": "integer"
          },
          "vatRate": {
            "description": "A company outside the MVA register always gets 0 regardless of what is sent here — it may not charge MVA, and honouring the caller would produce an illegal invoice.\n",
            "format": "int64",
            "title": "VATRate is the MVA percentage: 0, 12, 15 or 25. Omit to default to 25.\n",
            "type": "integer"
          }
        },
        "required": [
          "description",
          "quantity",
          "unitPriceMinor",
          "vatRate",
          "unitCode"
        ],
        "type": "object"
      },
      "publicapi.Customer": {
        "properties": {
          "city": {
            "type": "string"
          },
          "countryCode": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "orgNr": {
            "type": "string"
          },
          "postalCode": {
            "type": "string"
          },
          "street": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "orgNr",
          "email",
          "street",
          "postalCode",
          "city",
          "countryCode"
        ],
        "type": "object"
      },
      "publicapi.Invoice": {
        "properties": {
          "customerId": {
            "format": "int64",
            "type": "integer"
          },
          "dueDate": {
            "type": "string"
          },
          "grossMinor": {
            "format": "int64",
            "type": "integer"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "issueDate": {
            "type": "string"
          },
          "kid": {
            "type": "string"
          },
          "kind": {
            "title": "Kind: invoice | credit_note.\n",
            "type": "string"
          },
          "lines": {
            "items": {
              "$ref": "#/components/schemas/publicapi.InvoiceLine"
            },
            "type": "array"
          },
          "netMinor": {
            "format": "int64",
            "type": "integer"
          },
          "number": {
            "description": "it is still a draft).\n",
            "format": "int64",
            "title": "Number is the invoice number, assigned when the invoice is sent (0 while\n",
            "type": "integer"
          },
          "status": {
            "title": "Status: draft | sent | paid | overdue | credited.\n",
            "type": "string"
          },
          "vatMinor": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "id",
          "customerId",
          "number",
          "kind",
          "status",
          "issueDate",
          "dueDate",
          "netMinor",
          "vatMinor",
          "grossMinor",
          "kid",
          "lines"
        ],
        "type": "object"
      },
      "publicapi.InvoiceLine": {
        "properties": {
          "description": {
            "type": "string"
          },
          "quantity": {
            "type": "number"
          },
          "unitCode": {
            "title": "UnitCode is a UN/ECE rec 20 unit, e.g. EA (each), HUR (hour).\n",
            "type": "string"
          },
          "unitPriceMinor": {
            "format": "int64",
            "type": "integer"
          },
          "vatRate": {
            "format": "int64",
            "title": "VATRate is the MVA percentage: 0, 12, 15 or 25.\n",
            "type": "integer"
          }
        },
        "required": [
          "description",
          "quantity",
          "unitPriceMinor",
          "vatRate",
          "unitCode"
        ],
        "type": "object"
      },
      "publicapi.JournalEntry": {
        "description": "Amounts are always in minor units (øre). There is no float anywhere in this API — a rounding error in an accounting system is not a bug you find later, it is a bug an auditor finds later.\n",
        "properties": {
          "description": {
            "type": "string"
          },
          "docNumber": {
            "description": "the entry is still a draft.\n",
            "format": "int64",
            "title": "DocNumber is the sequential bilagsnummer, assigned on posting. Null while\n",
            "type": "integer"
          },
          "entryDate": {
            "title": "YYYY-MM-DD\n",
            "type": "string"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "lines": {
            "items": {
              "$ref": "#/components/schemas/publicapi.JournalLine"
            },
            "type": "array"
          },
          "needsDoc": {
            "title": "NeedsDoc is true when the entry is still missing its receipt (bilag).\n",
            "type": "boolean"
          },
          "sourceTransactionId": {
            "description": "from; empty when the entry was not bank-driven.\n",
            "title": "SourceTransactionID links the entry to the bank transaction it was booked\n",
            "type": "string"
          },
          "status": {
            "title": "Status: draft | posted.\n",
            "type": "string"
          }
        },
        "required": [
          "id",
          "docNumber",
          "entryDate",
          "description",
          "status",
          "needsDoc",
          "sourceTransactionId",
          "lines"
        ],
        "title": "JournalEntry is a bilag: a posted (or draft) accounting entry.\n",
        "type": "object"
      },
      "publicapi.JournalLine": {
        "description": "and creditMinor is non-zero, and an entry's debits always equal its credits.\n",
        "properties": {
          "accountCode": {
            "format": "int64",
            "title": "AccountCode is an NS 4102 account, e.g. 3000 (salgsinntekt) or 1920 (bank).\n",
            "type": "integer"
          },
          "creditMinor": {
            "format": "int64",
            "type": "integer"
          },
          "debitMinor": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "accountCode",
          "debitMinor",
          "creditMinor"
        ],
        "title": "JournalLine is one side of a double-entry posting. Exactly one of debitMinor\n",
        "type": "object"
      },
      "publicapi.TrialBalanceRow": {
        "properties": {
          "closingMinor": {
            "format": "int64",
            "type": "integer"
          },
          "code": {
            "format": "int64",
            "type": "integer"
          },
          "creditMinor": {
            "format": "int64",
            "type": "integer"
          },
          "debitMinor": {
            "format": "int64",
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "openingMinor": {
            "format": "int64",
            "type": "integer"
          },
          "type": {
            "type": "string"
          }
        },
        "required": [
          "code",
          "name",
          "type",
          "openingMinor",
          "debitMinor",
          "creditMinor",
          "closingMinor"
        ],
        "type": "object"
      },
      "webhooks.Delivery": {
        "properties": {
          "attempts": {
            "format": "int64",
            "type": "integer"
          },
          "createdAt": {
            "type": "string"
          },
          "eventId": {
            "type": "string"
          },
          "eventType": {
            "type": "string"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "lastError": {
            "type": "string"
          },
          "lastStatus": {
            "format": "int64",
            "type": "integer"
          },
          "status": {
            "title": "Status: pending | sending | delivered | failed\n",
            "type": "string"
          }
        },
        "required": [
          "id",
          "eventType",
          "eventId",
          "status",
          "attempts",
          "lastStatus",
          "lastError",
          "createdAt"
        ],
        "title": "Delivery is one attempt to deliver one event, as shown in the log.\n",
        "type": "object"
      },
      "webhooks.Subscription": {
        "properties": {
          "active": {
            "type": "boolean"
          },
          "createdAt": {
            "type": "string"
          },
          "disabledReason": {
            "description": "hidden: \"my webhooks stopped and I don't know why\" is the single most common integration support ticket in this category, and it is entirely avoidable.\n",
            "title": "DisabledReason explains an auto-disabled subscription. Surfaced rather than\n",
            "type": "string"
          },
          "eventTypes": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "url",
          "eventTypes",
          "active",
          "disabledReason",
          "createdAt"
        ],
        "type": "object"
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "A personal API key (mynto_sk_…) or an OAuth 2.1 access token (mynto_at_…)."
      }
    }
  },
  "info": {
    "title": "Mynto API",
    "version": "1",
    "description": "The Mynto API lets you read and write a Norwegian company's accounting data:\nreceipts, bank transactions, the ledger, invoices and customers.\n\n## Authentication\n\nEvery request carries a bearer token:\n\n    Authorization: Bearer mynto_sk_…\n\nThere are two kinds of credential:\n\n- **Personal API key** (`mynto_sk_…`) — for connecting your own system. Created\n  in Mynto under Settings → API, locked to one company. This is the fastest way\n  to get started, and you do not need to build an app.\n- **OAuth 2.1 access token** (`mynto_at_…`) — for an app used by *other*\n  companies. The user approves your app in a consent screen and picks which\n  company it may act on. See the OAuth guide.\n\n## Scopes\n\nA credential may only do what it was granted. Scopes are `resource:action`, e.g.\n`faktura:les` (read invoices) or `regnskap:skriv` (post to the ledger). A request\nwithout the required scope is refused with `permission_denied`.\n\nScopes never *widen* what the underlying user may do — they only narrow it. An app\ngranted `faktura:skriv` on behalf of a read-only user still cannot write.\n\nScopes that move money or file with the government (`betaling:skriv`,\n`lonn:kjor`, `mva:innsend`, …) are **sensitive**: they cannot be granted to a\npersonal API key at all, and an app needs review to request them.\n\nThe live catalogue is at `GET /platform/scopes`.\n\n## Money\n\nAll amounts are integers in **minor units** (øre). `12500` is 125,00 kr. There\nare no floats in this API — a rounding error in an accounting system is not a bug\nyou find later, it is a bug an auditor finds later.\n\n## VAT (MVA)\n\n**A company outside the Norwegian VAT register always gets 0 VAT, whatever\n`vatRate` you send.** This is not your bug and it is not us ignoring you: a\ncompany that is not VAT-registered may not charge VAT, and an invoice that did\nwould be illegal. We refuse to produce one, so an integration cannot make a\ncustomer break the law by accident.\n\nIf you send `vatRate: 25` and get `vatMinor: 0` back, check whether the company\nis VAT-registered. It becomes registered automatically once it passes the\nthreshold, and invoices issued after that carry VAT normally.\n\nFor a registered company, `vatRate` is the MVA percentage: 0, 12, 15 or 25. Omit\nit to default to 25.\n\n## Pagination\n\nList endpoints take `?limit` (max 200) and `?offset`, and return a `total`.\nCheck `total` before concluding something does not exist.\n\n## Webhooks\n\nSubscribe an HTTPS endpoint and we POST events to it as they happen, so you do not\nhave to poll. Requires the `webhook:abonner` scope.\n\n**Verify the signature.** Every delivery carries:\n\n    Mynto-Event:      invoice.sent\n    Mynto-Event-Id:   evt_9f2c…\n    Mynto-Signature:  t=1752490000,v1=6b3a…\n\n`v1` is HMAC-SHA256 of `\"{t}.{raw_body}\"`, keyed with the subscription secret we\nreturned once at creation. Verify against the **raw body**, before any JSON\nparsing — re-serialising the JSON will change the bytes and the signature will\nnot match.\n\nThe timestamp is inside the signed material, so a captured delivery cannot be\nreplayed later. Reject anything older than your tolerance (5 minutes is typical).\n\n```python\nexpected = hmac.new(secret, f\"{t}.\".encode() + raw_body, hashlib.sha256).hexdigest()\nif not hmac.compare_digest(expected, v1):\n    return 401\n```\n\n**Delivery is at-least-once.** You *will* eventually receive the same event twice —\na retry after a timeout you actually processed, for example. Deduplicate on\n`Mynto-Event-Id`. An integration that assumes exactly-once will double-book\nsomething; this is not hypothetical.\n\n**Respond 2xx quickly.** Anything else is a failure. We retry with exponential\nbackoff (~1m, 2m, 4m, 8m, 16m) and then dead-letter the event. An endpoint that\nfails persistently is auto-disabled — check `disabledReason` on the subscription.\nDo your real work asynchronously and acknowledge immediately.\n\nInspect what we actually sent, and why it failed, at\n`GET /v1/companies/{companyID}/webhooks/{subID}/deliveries`.\n\n## Rate limits\n\nPer minute: 60 for an app, 120 for a personal API key, 180 per company across all\ncredentials.\n\nPer day: **5,000 requests per company**, across every credential.\n\nOver either limit you get `429` — back off and retry. The daily quota is the one\nto design around: use **webhooks** instead of polling and you will not come close\nto it. Polling every minute burns 1,440 calls a day for information we would have\npushed you for free.\n\n## Testing your integration\n\nDraft apps work immediately against companies **you are a member of** — no review,\nno waiting. So the way to test is to point your app at your own company: create it\nin the developer portal, complete the OAuth flow, and call the API for real.\n\nA dedicated sandbox environment with synthetic data is coming. Until then, use your\nown company and stick to a test company if you would rather not touch live books."
  },
  "openapi": "3.0.0",
  "paths": {
    "/v1/companies/{companyID}/accounts": {
      "get": {
        "operationId": "GET:publicapi.ListAccounts",
        "parameters": [
          {
            "allowEmptyValue": true,
            "explode": false,
            "in": "path",
            "name": "companyID",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            },
            "style": "simple"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "accounts": {
                      "items": {
                        "$ref": "#/components/schemas/publicapi.Account"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "accounts"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success response"
          },
          "default": {
            "$ref": "#/components/responses/APIError"
          }
        },
        "summary": "ListAccounts returns the chart of accounts.\n",
        "tags": [
          "Ledger"
        ]
      }
    },
    "/v1/companies/{companyID}/bank-transactions": {
      "get": {
        "operationId": "GET:publicapi.ListBankTransactions",
        "parameters": [
          {
            "allowEmptyValue": true,
            "explode": false,
            "in": "path",
            "name": "companyID",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            },
            "style": "simple"
          },
          {
            "allowEmptyValue": true,
            "explode": true,
            "in": "query",
            "name": "limit",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            },
            "style": "form"
          },
          {
            "allowEmptyValue": true,
            "explode": true,
            "in": "query",
            "name": "offset",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            },
            "style": "form"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "total": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "transactions": {
                      "items": {
                        "$ref": "#/components/schemas/publicapi.BankTransaction"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "transactions",
                    "total"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success response"
          },
          "default": {
            "$ref": "#/components/responses/APIError"
          }
        },
        "summary": "ListBankTransactions returns bank transactions, newest first. Paginated.\n",
        "tags": [
          "Bank"
        ]
      }
    },
    "/v1/companies/{companyID}/customers": {
      "get": {
        "operationId": "GET:publicapi.ListCustomers",
        "parameters": [
          {
            "allowEmptyValue": true,
            "explode": false,
            "in": "path",
            "name": "companyID",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            },
            "style": "simple"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "customers": {
                      "items": {
                        "$ref": "#/components/schemas/publicapi.Customer"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "customers"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success response"
          },
          "default": {
            "$ref": "#/components/responses/APIError"
          }
        },
        "summary": "ListCustomers returns the company's customers.\n",
        "tags": [
          "Invoicing"
        ]
      },
      "post": {
        "operationId": "POST:publicapi.CreateCustomer",
        "parameters": [
          {
            "allowEmptyValue": true,
            "explode": false,
            "in": "path",
            "name": "companyID",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            },
            "style": "simple"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "city": {
                    "type": "string"
                  },
                  "countryCode": {
                    "title": "defaults to NO\n",
                    "type": "string"
                  },
                  "email": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "orgNr": {
                    "type": "string"
                  },
                  "postalCode": {
                    "type": "string"
                  },
                  "street": {
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "orgNr",
                  "email",
                  "street",
                  "postalCode",
                  "city",
                  "countryCode"
                ],
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "city": {
                      "type": "string"
                    },
                    "countryCode": {
                      "type": "string"
                    },
                    "email": {
                      "type": "string"
                    },
                    "id": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "name": {
                      "type": "string"
                    },
                    "orgNr": {
                      "type": "string"
                    },
                    "postalCode": {
                      "type": "string"
                    },
                    "street": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "orgNr",
                    "email",
                    "street",
                    "postalCode",
                    "city",
                    "countryCode"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success response"
          },
          "default": {
            "$ref": "#/components/responses/APIError"
          }
        },
        "summary": "CreateCustomer creates a customer.\n",
        "tags": [
          "Invoicing"
        ]
      }
    },
    "/v1/companies/{companyID}/invoices": {
      "get": {
        "operationId": "GET:publicapi.ListInvoices",
        "parameters": [
          {
            "allowEmptyValue": true,
            "explode": false,
            "in": "path",
            "name": "companyID",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            },
            "style": "simple"
          },
          {
            "allowEmptyValue": true,
            "explode": true,
            "in": "query",
            "name": "limit",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            },
            "style": "form"
          },
          {
            "allowEmptyValue": true,
            "explode": true,
            "in": "query",
            "name": "offset",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            },
            "style": "form"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "invoices": {
                      "items": {
                        "$ref": "#/components/schemas/publicapi.Invoice"
                      },
                      "type": "array"
                    },
                    "total": {
                      "format": "int64",
                      "type": "integer"
                    }
                  },
                  "required": [
                    "invoices",
                    "total"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success response"
          },
          "default": {
            "$ref": "#/components/responses/APIError"
          }
        },
        "summary": "ListInvoices returns invoices, newest first. Paginated.\n",
        "tags": [
          "Invoicing"
        ]
      },
      "post": {
        "description": "and is not booked until you call the send endpoint — so a partial or mistaken create is harmless and can be deleted.\n",
        "operationId": "POST:publicapi.CreateInvoice",
        "parameters": [
          {
            "allowEmptyValue": true,
            "explode": false,
            "in": "path",
            "name": "companyID",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            },
            "style": "simple"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "customerId": {
                    "format": "int64",
                    "type": "integer"
                  },
                  "deliveryDate": {
                    "description": "Required on the document by bokf.forskr. § 5-1-1 nr. 4; defaults to the issue date when the invoice is sent.\n",
                    "title": "DeliveryDate (YYYY-MM-DD) is when the goods or services were delivered.\n",
                    "type": "string"
                  },
                  "dueInDays": {
                    "format": "int64",
                    "title": "DueInDays is the payment term; defaults to 14.\n",
                    "type": "integer"
                  },
                  "kid": {
                    "description": "KID setting.\n",
                    "title": "KID is the payment reference. Leave empty to use the company's automatic\n",
                    "type": "string"
                  },
                  "lines": {
                    "items": {
                      "$ref": "#/components/schemas/publicapi.CreateInvoiceLine"
                    },
                    "type": "array"
                  }
                },
                "required": [
                  "customerId",
                  "dueInDays",
                  "kid",
                  "deliveryDate",
                  "lines"
                ],
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "customerId": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "dueDate": {
                      "type": "string"
                    },
                    "grossMinor": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "id": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "issueDate": {
                      "type": "string"
                    },
                    "kid": {
                      "type": "string"
                    },
                    "kind": {
                      "title": "Kind: invoice | credit_note.\n",
                      "type": "string"
                    },
                    "lines": {
                      "items": {
                        "$ref": "#/components/schemas/publicapi.InvoiceLine"
                      },
                      "type": "array"
                    },
                    "netMinor": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "number": {
                      "description": "it is still a draft).\n",
                      "format": "int64",
                      "title": "Number is the invoice number, assigned when the invoice is sent (0 while\n",
                      "type": "integer"
                    },
                    "status": {
                      "title": "Status: draft | sent | paid | overdue | credited.\n",
                      "type": "string"
                    },
                    "vatMinor": {
                      "format": "int64",
                      "type": "integer"
                    }
                  },
                  "required": [
                    "id",
                    "customerId",
                    "number",
                    "kind",
                    "status",
                    "issueDate",
                    "dueDate",
                    "netMinor",
                    "vatMinor",
                    "grossMinor",
                    "kid",
                    "lines"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success response"
          },
          "default": {
            "$ref": "#/components/responses/APIError"
          }
        },
        "summary": "CreateInvoice creates a DRAFT invoice. It is not sent, does not get a number,\n",
        "tags": [
          "Invoicing"
        ]
      }
    },
    "/v1/companies/{companyID}/invoices/{invoiceID}/send": {
      "post": {
        "description": "to the ledger, and delivers the document (EHF where the customer supports it, otherwise email). This is not reversible — an invoice that has been sent can only be undone with a credit note, because that is what the law requires.\n",
        "operationId": "POST:publicapi.SendInvoice",
        "parameters": [
          {
            "allowEmptyValue": true,
            "explode": false,
            "in": "path",
            "name": "companyID",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            },
            "style": "simple"
          },
          {
            "allowEmptyValue": true,
            "explode": false,
            "in": "path",
            "name": "invoiceID",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            },
            "style": "simple"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "customerId": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "dueDate": {
                      "type": "string"
                    },
                    "grossMinor": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "id": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "issueDate": {
                      "type": "string"
                    },
                    "kid": {
                      "type": "string"
                    },
                    "kind": {
                      "title": "Kind: invoice | credit_note.\n",
                      "type": "string"
                    },
                    "lines": {
                      "items": {
                        "$ref": "#/components/schemas/publicapi.InvoiceLine"
                      },
                      "type": "array"
                    },
                    "netMinor": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "number": {
                      "description": "it is still a draft).\n",
                      "format": "int64",
                      "title": "Number is the invoice number, assigned when the invoice is sent (0 while\n",
                      "type": "integer"
                    },
                    "status": {
                      "title": "Status: draft | sent | paid | overdue | credited.\n",
                      "type": "string"
                    },
                    "vatMinor": {
                      "format": "int64",
                      "type": "integer"
                    }
                  },
                  "required": [
                    "id",
                    "customerId",
                    "number",
                    "kind",
                    "status",
                    "issueDate",
                    "dueDate",
                    "netMinor",
                    "vatMinor",
                    "grossMinor",
                    "kid",
                    "lines"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success response"
          },
          "default": {
            "$ref": "#/components/responses/APIError"
          }
        },
        "summary": "SendInvoice finalizes a draft: it assigns the invoice number, books the income\n",
        "tags": [
          "Invoicing"
        ]
      }
    },
    "/v1/companies/{companyID}/journal": {
      "get": {
        "description": "(limit max 200). Check \\`total\\` before concluding something is absent.\n",
        "operationId": "GET:publicapi.ListJournal",
        "parameters": [
          {
            "allowEmptyValue": true,
            "explode": false,
            "in": "path",
            "name": "companyID",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            },
            "style": "simple"
          },
          {
            "allowEmptyValue": true,
            "explode": true,
            "in": "query",
            "name": "limit",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            },
            "style": "form"
          },
          {
            "allowEmptyValue": true,
            "explode": true,
            "in": "query",
            "name": "offset",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            },
            "style": "form"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "entries": {
                      "items": {
                        "$ref": "#/components/schemas/publicapi.JournalEntry"
                      },
                      "type": "array"
                    },
                    "total": {
                      "format": "int64",
                      "type": "integer"
                    }
                  },
                  "required": [
                    "entries",
                    "total"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success response"
          },
          "default": {
            "$ref": "#/components/responses/APIError"
          }
        },
        "summary": "ListJournal returns the bilagsjournal, newest first. Paginated: ?limit&offset\n",
        "tags": [
          "Ledger"
        ]
      }
    },
    "/v1/companies/{companyID}/trial-balance": {
      "get": {
        "operationId": "GET:publicapi.GetTrialBalance",
        "parameters": [
          {
            "allowEmptyValue": true,
            "explode": false,
            "in": "path",
            "name": "companyID",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            },
            "style": "simple"
          },
          {
            "allowEmptyValue": true,
            "description": "inclusive YYYY-MM-DD\n",
            "explode": true,
            "in": "query",
            "name": "from",
            "required": true,
            "schema": {
              "type": "string"
            },
            "style": "form"
          },
          {
            "allowEmptyValue": true,
            "description": "inclusive YYYY-MM-DD\n",
            "explode": true,
            "in": "query",
            "name": "to",
            "required": true,
            "schema": {
              "type": "string"
            },
            "style": "form"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "from": {
                      "type": "string"
                    },
                    "rows": {
                      "items": {
                        "$ref": "#/components/schemas/publicapi.TrialBalanceRow"
                      },
                      "type": "array"
                    },
                    "to": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "from",
                    "to",
                    "rows"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success response"
          },
          "default": {
            "$ref": "#/components/responses/APIError"
          }
        },
        "summary": "GetTrialBalance returns the saldobalanse for a period: ?from=YYYY-MM-DD&to=…\n",
        "tags": [
          "Ledger"
        ]
      }
    },
    "/v1/companies/{companyID}/webhooks": {
      "get": {
        "operationId": "GET:webhooks.ListSubscriptions",
        "parameters": [
          {
            "allowEmptyValue": true,
            "explode": false,
            "in": "path",
            "name": "companyID",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            },
            "style": "simple"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "availableEventTypes": {
                      "description": "subscribe to without a second call or a hardcoded list that goes stale.\n",
                      "items": {
                        "type": "string"
                      },
                      "title": "EventTypes is the full catalogue, so a client can discover what it may\n",
                      "type": "array"
                    },
                    "subscriptions": {
                      "items": {
                        "$ref": "#/components/schemas/webhooks.Subscription"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "subscriptions",
                    "availableEventTypes"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success response"
          },
          "default": {
            "$ref": "#/components/responses/APIError"
          }
        },
        "summary": "ListSubscriptions returns the company's webhook subscriptions.\n",
        "tags": [
          "Webhooks"
        ]
      },
      "post": {
        "operationId": "POST:webhooks.CreateSubscription",
        "parameters": [
          {
            "allowEmptyValue": true,
            "explode": false,
            "in": "path",
            "name": "companyID",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            },
            "style": "simple"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "eventTypes": {
                    "items": {
                      "type": "string"
                    },
                    "type": "array"
                  },
                  "url": {
                    "type": "string"
                  }
                },
                "required": [
                  "url",
                  "eventTypes"
                ],
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "active": {
                      "type": "boolean"
                    },
                    "createdAt": {
                      "type": "string"
                    },
                    "eventTypes": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "id": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "secret": {
                      "title": "Secret signs every delivery. Returned exactly once — store it now.\n",
                      "type": "string"
                    },
                    "url": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "url",
                    "eventTypes",
                    "active",
                    "createdAt",
                    "secret"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success response"
          },
          "default": {
            "$ref": "#/components/responses/APIError"
          }
        },
        "summary": "CreateSubscription registers an endpoint to receive events.\n",
        "tags": [
          "Webhooks"
        ]
      }
    },
    "/v1/companies/{companyID}/webhooks/{subID}": {
      "delete": {
        "operationId": "DELETE:webhooks.DeleteSubscription",
        "parameters": [
          {
            "allowEmptyValue": true,
            "explode": false,
            "in": "path",
            "name": "companyID",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            },
            "style": "simple"
          },
          {
            "allowEmptyValue": true,
            "explode": false,
            "in": "path",
            "name": "subID",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            },
            "style": "simple"
          }
        ],
        "responses": {
          "200": {
            "description": "Success response"
          },
          "default": {
            "$ref": "#/components/responses/APIError"
          }
        },
        "summary": "DeleteSubscription removes a subscription and its delivery history.\n",
        "tags": [
          "Webhooks"
        ]
      }
    },
    "/v1/companies/{companyID}/webhooks/{subID}/deliveries": {
      "get": {
        "description": "This exists so a partner can debug their own integration without asking us. Every webhook system that lacks it generates the same support ticket forever: \"are you sending events? I'm not getting them.\"\n",
        "operationId": "GET:webhooks.ListDeliveries",
        "parameters": [
          {
            "allowEmptyValue": true,
            "explode": false,
            "in": "path",
            "name": "companyID",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            },
            "style": "simple"
          },
          {
            "allowEmptyValue": true,
            "explode": false,
            "in": "path",
            "name": "subID",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            },
            "style": "simple"
          },
          {
            "allowEmptyValue": true,
            "explode": true,
            "in": "query",
            "name": "limit",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            },
            "style": "form"
          },
          {
            "allowEmptyValue": true,
            "explode": true,
            "in": "query",
            "name": "offset",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            },
            "style": "form"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "deliveries": {
                      "items": {
                        "$ref": "#/components/schemas/webhooks.Delivery"
                      },
                      "type": "array"
                    },
                    "total": {
                      "format": "int64",
                      "type": "integer"
                    }
                  },
                  "required": [
                    "deliveries",
                    "total"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success response"
          },
          "default": {
            "$ref": "#/components/responses/APIError"
          }
        },
        "summary": "ListDeliveries is the delivery log for a subscription.\n",
        "tags": [
          "Webhooks"
        ]
      }
    }
  },
  "servers": [
    {
      "url": "https://production-mynto-ukmi.encr.app",
      "description": "Production — real accounting data"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "Ledger"
    },
    {
      "name": "Bank"
    },
    {
      "name": "Invoicing"
    },
    {
      "name": "Webhooks"
    }
  ]
}
