{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/mynto-no/json-schema/mynto-no-publicapi-journal-entry-schema.json",
  "title": "JournalEntry is a bilag: a posted (or draft) accounting entry.\n",
  "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",
  "x-generated": "2026-11-18",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/mynto-no-openapi.yml#/components/schemas/publicapi.JournalEntry",
  "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": "#/$defs/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"
  ],
  "type": "object",
  "$defs": {
    "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"
    }
  }
}