Skip to content

Customer files · Reference

Mapping card format

Every key of a mapping card, its reader blocks, converters, code rules and errors.

A mapping card is a JSON document. It tells the engine how to read a customer’s file, and how to turn each record into an invoice in Certinvo’s model. This page lists every key, converter, code rule and error.

Top-level keys

Key Required Meaning
configSchema The card format version, currently 1.
version yes The card’s name and version. Lower-case letters, digits, dots and hyphens, starting with a letter or digit. Recorded as meta.mappingConfigVersion in every invoice it produces.
target {"name", "version"} of a target model the company registered. Absent means Certinvo’s own invoice model.
targetSchemaVersion without target A model version the schema knows, 0.2, 0.3 or 0.4. The produced invoice is always written as 0.4.
codelistVersion without target The dictionary version, currently 1.0.0. A card with a target may name one too, and needs it only to look words up.
input for files How to read a file. Without it, the card can only map single records.
fields yes Rules for single fields.
repeats Rules for repeating groups such as lines and taxBreakdown.
columns Every place of the file the card has seen, and what was decided about it. See columns.
system The name of the source system, as text, such as Handwerk-Software. The mappings of one system share it across file formats, and the list of saved mappings keeps them together. The mapper never reads it.
source, note, and other text keys Notes for people. The engine ignores them.

columns

Every place of the customer’s file the card has seen, each with what a person decided about it. A place is a value’s position in a record, written as a JSON Pointer with the row numbers left out: /Kostenstelle, /lines/Menge. An entry of a list the card reads by a qualifier is named by it: /segments/E1EDKA1/[PARVW=AG]/NAME1.

Key Meaning
source The place.
decision mapped: a field of the card reads it. ignored: left out on purpose. unmapped: open, nobody decided it. A card saved before open columns were refused may hold one.
optional true: a file may lack this column. Only on a mapped column, and never on one whose field the model requires.

A file converts with no note only when nothing in it is new to the card. A place is new when no field reads it and the card does not list it as mapped or ignored. An unmapped column counts as new: nobody decided it. A card without columns has seen exactly the places it reads, so every other place of its files is new. A file with a new place converts, and the answer notes it as new_fields.

A file that lacks a place the card reads converts too, and the answer notes it as missing_fields, or as optional_fields_absent when the column is optional. A column the invoice cannot be made without, gone, is refused. Each column also keeps header, group, reasons and candidate, what the mapping view showed. The engine ignores them.

A card into a customer’s own model

A card with a target writes into the model the company registered under that name and version, not into ours. The engine loads it only against that exact model, which the API hands it with the card. Its fields’ to pointers are places in that model. The differences:

  • Every error names a field by its place in their model, since it has no BT id.
  • A number in their schema is a decimal, so the field needs a decimal converter. A date string needs a date converter. Any other string is text.
  • The result carries no schemaVersion and no meta, and nothing is derived into it.
  • type, required, enum and a date format are checked. A decimal becomes a JSON number after every check, and one a JSON number cannot hold exactly is refused.

A company registers such a model with Register a target model.

input

format Block Keys
csv csv delimiter, encoding, groupBy (absent means one row is one whole invoice), lineColumns, taxColumns, allowanceColumns
json json recordsAt: a JSON Pointer to the invoices, or "" for the whole document. one: true when the pointer lands on ONE invoice object rather than a list
xml xml recordsAt, encoding (utf-8, windows-1252 or iso-8859-15), repeats
idoc idoc type: INVOIC02; form: flat (default) or xml
xlsx xlsx groupBy, lineColumns, taxColumns, allowanceColumns. An .xlsx or .xlsm file with exactly one worksheet; each cell is turned into text.
edifact edifact message: INVOIC; directory: D93A, D96A, D98A, D98B, D01B or D14B. One message is one invoice.
document document lineColumns: the column titles of the PDF’s line table; lineStart: the one of them whose cell opens a new line; lineOneRow (optional): the columns read from a line’s first row only; lineParts (optional): word ranges [from, to or null] of a column’s first-row text, keyed <title> (words a-b); lineStartShape (optional): the pattern a line’s first cell matches, so a line opens only there and the table carries on over a page with no headings; anchors (optional): values read by their heading, each {heading, at: "right" or "below", row, words?, nth?} with row from 1, words a word range of the value and nth which printing of the heading (from 1). A text PDF, read into one record: each label with its value, each anchored value under its heading, and lines, one object per line keyed by the column titles.

Where one invoice ends in a table

A csv or xlsx card must say this, in one of two ways. A card that names neither is refused when it is loaded.

  • groupBy names the column whose value says which invoice a row belongs to. Rows that share a value are one invoice, and its lineColumns are its lines. This is the export with one row per line item.
  • No groupBy, but lineColumns means every row is one whole invoice: the row’s own fields, and its lineColumns are that invoice’s single line. This is the export with one row per invoice.

Either way, taxColumns are the VAT breakdown of that invoice, one row per distinct combination the file states. Nothing is summed: a per-rate total is read from the file, or it is not read at all.

allowanceColumns are the columns of the Invoice level discount (BG-20) and Invoice level surcharge (BG-21), read the same way: one per distinct combination, in the order the file first states it.

  • Cells that are all empty state none.
  • A row that states an allowance and no line cell is not a line, so an invoice can list more allowances than it has lines.
  • Any other row whose line cells are all empty is an empty line, and the file is refused.
  • An allowance on a single line has no column group, so a flat CSV file cannot state one. A format that nests a line’s own lists is read by a repeat inside the lines repeat (below).

What each reader refuses

Each reader reads the file as the card declares it. The one thing a reader finds by itself is the header row of an Excel sheet, by the rule under Excel below. Any refusal applies to the whole file.

CSV. The reader refuses:

  • bytes that are not valid in the declared encoding, and an empty file
  • a missing declared column, or two columns with the same name
  • a column called lines or taxBreakdown, the names it nests under
  • a row with the wrong number of fields
  • invoice-level values that differ between rows of the same invoice

CRLF, LF and CR each end a row anywhere in the file, and a line end inside quotes is part of the value. A row with nothing in it, or only delimiters and spaces, is skipped like a blank line. Under windows-1252 every byte decodes, so the reader refuses the signs of another encoding instead: a UTF-8 byte order mark, one of ä, ö, ü, Ä, Ö, Ü, ß or € written in UTF-8, and the five bytes Windows-1252 leaves undefined (0x81, 0x8D, 0x8F, 0x90 and 0x9D). The refusal says what it found and where.

XML. The reader refuses a file whose XML declaration names another encoding than the card’s. ISO-8859-1 counts as windows-1252, and ASCII fits every card. Under windows-1252 or iso-8859-15 it also refuses the same signs of another encoding as the CSV reader, also when the file has no declaration. The five undefined bytes count only under windows-1252, because ISO-8859-15 defines them.

JSON. A JSON file must be UTF-8, and one that is not is refused. A file that writes one key twice in one object is refused too, naming the key and its JSON Pointer.

EDIFACT. The reader refuses the whole interchange when any message in it cannot be read, a message whose type or directory is not the card’s, and a decimal mark other than ..

PDF. The page reader refuses a PDF that carries its invoice as XML, which is a finished invoice, and a PDF with no text layer, such as a scan. It refuses a page on which the declared column titles are not found.

Excel. The Excel reader refuses the same table faults as the CSV reader. It also refuses:

  • a file that is not a zip, a password-protected file, or an .xls file
  • a damaged workbook: cut short, a part missing, a part that fails its CRC-32 checksum, or XML that is not well-formed
  • a workbook with more than one worksheet
  • a sheet with no value, a column of the header without a name, or an error cell in the header. The header is the first row that names every column a row below it fills; a title row above it is skipped.
  • a value beyond the last named column, or a formula with no stored result
  • a cell whose value is not of its type
  • a cell beyond the 1,048,576 rows and 16,384 columns a sheet can have
  • a date outside the calendar Excel can show, or a date cell whose ISO 8601 text names no real day
  • a whole number too long to read exactly
  • a workbook that opens to more than 256 MB

The Excel reader’s own refusals begin “Certinvo’s own rule:”. A fault in the reader itself does not blame the file: it is answered as our failure.

Refusals are in our words. A file the CSV, JSON, XML or IDoc parser cannot read is refused in our words, such as “a quoted value is never closed”. The refusal gives the line where the parser gave one, and for JSON the column. A workbook part that cannot be unpacked, or that is not well-formed XML, is named, with no line. The parser’s or the unzipper’s own message goes to our log, never into the refusal.

A field rule

{ "to": "/issueDate", "from": "/RechDatum", "format": "date:DD.MM.YYYY" }
Key Meaning
to Where in the model, as a JSON Pointer. Must exist in the model schema. /schemaVersion and /meta cannot be written. A field rule outside a repeat may not write inside a list; that belongs in a repeat onto the list. A field writes one value, so it may not write a whole list, which only a repeat fills, or a whole group such as /seller, whose fields are written one by one.
from Where in the record, as a JSON Pointer starting with /.
aliases Other confirmed names of the same source, pointers like from: "aliases": ["/Gross"]. Only beside a from. The field reads from, or the one alias the record has. A record with two of its names is refused, naming both: two answers for one field, never one picked. An alias is never new to the card.
fallback A second pointer to the same fact, only beside a from. It is read only when the record has no block at all where from sits, never field by field, so one party’s fields are never filled from another’s. The SAP card reads the buyer from the sold-to party [PARVW=AG], with "fallback" naming the bill-to party [PARVW=RE] for an IDoc that names no sold-to party. The trace names the place it was read.
const A fixed value instead of from. Exactly one of from and const is required.
when Beside a const: a pointer the record must hold a value at, or the constant is not written. The SAP card writes the payment means code 30 only "when": "/segments/E1EDK28", the IDoc’s bank data.
format A converter. Required for date, decimal, boolean and whole-number fields.
unit % or one ISO 4217 currency code that the gate accepts for the invoice currency, such as EUR. Only on a field whose format is a decimal converter. See Units.
codelist A dictionary that turns a word into a code.
codes The customer’s own codes, each mapped to a code on the field’s official list, or to null for no value: {"U": "E", "X": null}. Only on a field that takes an official code, and only with a from. See Official codes.
fromRecord true on a field inside a repeat: its from reads the whole record, not the item.
fallbackFromRecord true beside a fallback inside a repeat: the fallback reads the whole record, not the item. An EANCOM allowance with no VAT of its own reads its VAT from the message’s VAT summary. A summary with two rates is two answers, and the field is refused, not guessed.
decidesRow true on a field with codes inside a repeat: its code decides whether the row is written. See A code that decides its row.
paymentKeys The customer’s own payment keys, each to the payment terms it stands for: {"NT30": {"note": "30 days net"}, "ZB14": {"note": "2 % within 14 days", "discounts": [{"days": 14, "percent": "2.00"}]}}. A step may also carry a baseAmount. Only on the field onto /paymentTerms/note, and only with a from. The note is written with one Skonto row per step under it, and the steps as data.

No field may be written twice.

A repeat rule

{ "to": "/lines", "from": "/lines", "fields": [ { "to": "/quantity", "from": "/Menge", "format": "decimal:de" } ] }
  • to must be a list in the model. A list inside a line is filled by a repeat inside the repeat onto /lines (below). A list takes one repeat, or several when each says where. Their rows follow in card order.
  • from may point to a list or a single object. "" reads the whole record as one row, for a list an invoice usually states once, such as a note or an allowance. It is refused for /lines.
  • where is one selector, such as [?PRZNT]. Only the items it picks become rows. Absent, every item is a row.
  • first names a group that takes the first row, the list taking the rest: "first": "/paymentMeans" on the repeat onto /paymentMeans/additionalAccounts. The model keeps the first bank account in /paymentMeans and the others in its list, and a file that lists its accounts with no qualifier is read in its own order. Only on a repeat onto a list of the invoice itself that no other repeat fills, and each field must be a field of that group too.
  • The inner fields use pointers relative to one item, and may not write into a list inside that item.

A repeat inside a repeat

A line holds lists of its own: its allowances and charges, its item attributes and its item classifications. A repeat may carry repeats, one level deep, each read from the outer row’s item and written into that row:

{ "to": "/lines", "from": "/SG27", "fields": [ … ],
  "repeats": [ { "to": "/itemAttributes", "from": "/FTX", "where": "[4451=ACF]",
                 "fields": [ { "to": "/name", "from": "/C108.4440" }, { "to": "/value", "from": "/C108.4440_2" } ] } ] }
  • An inner to and from are relative to the outer row and its item. Its to must be a list directly inside the outer list’s item.
  • where and two repeats onto one list work as in an outer repeat, row by row.
  • An inner repeat carries no repeats of its own.
  • The mapping view shows a saved card’s inner repeats, each under its whole path, and a preview value inside a line’s list points at its column. The profiler drafts one from a JSON or XML file, and a person can name one it left open. A draft of an EDIFACT message or an SAP IDoc starts from its shipped standard card, so it takes that card’s inner repeats.

Selectors

A step of a from pointer can pick one item of a repeated group by its qualifier:

/segments/E1EDK02/[QUALF=009]/BELNR

The form is exactly [FIELD=VALUE], or [?FIELD] for the item that holds FIELD, whatever its value. A step is read as a selector when it starts with [, or when it ends with ] after an = and holds no [, such as PARVW=RS]. A malformed selector, such as [FIELD] without the ?, is refused when the card is loaded. Any other step is an ordinary key, so a column called Menge [Stk] is read as it is.

When a selector matches more than one item, the rest of the pointer is read in each. If every match reads the same value, that value is used. If they differ, the field gets an unreadable-value error.

A text in parts

Two more steps read a text that a file splits:

  • A last step ending in _*, such as /FTX/[4451=AAB]/C108.4440_*, reads the element and its parts _2 to _9, in order, as one text. EDIFACT splits a long text where its element is full, so a part as long as the element’s longest value is continued by the next with no space, and a shorter one is followed by a space. The longest value is the one the card’s EDIFACT directory defines: 7008 is 35 characters in D96A and 256 in D01B. With no length known, every part is followed by a space.
  • [*] reads every row of a list, in order, and joins the values the rest of the pointer reads, with a space. The SAP card reads one note per header text as /segments/E1EDKT2/[*]/TDLINE, its lines in order.

Converters

Converter Reads Example
date:DD.MM.YYYY German dates 15.10.2026 becomes 2026-10-15
date:YYYY-MM-DD ISO dates 2026-10-15 stays
date:YYYYMMDD SAP dates; 00000000 is refused 20261015 becomes 2026-10-15
date:odata-epoch SAP OData dates, read in UTC as a calendar day /Date(1492041600000)/ becomes 2017-04-13
date:DD/MM/YYYY slash dates, day first 15/02/2026 becomes 2026-02-15
date:MM/DD/YYYY slash dates, month first 02/15/2026 becomes 2026-02-15
date:iso-datetime a date with a time, T or a space between, seconds, fraction and zone optional; the day as written, never moved by the zone 2026-02-15T23:30:00-05:00 becomes 2026-02-15
decimal:de German numbers with , and optional . grouping; refuses 288.79, a group that starts with 0, such as 0.500, and any value the customer wrote as a JSON number 1.234,56 becomes 1234.56
decimal:dot-trailing-sign SAP amounts; no grouping 123.45- becomes -123.45
decimal:en English numbers with . and optional , grouping; refuses 1.234,56 and a group that starts with 0, such as 0,500 1,234.56 becomes 1234.56
boolean:plus-minus SAP indicators + becomes true
trim any text, and a code such as a country removes surrounding spaces, so a padded code can be fixed on the card
integer whole numbers: digits only, at most 15; a fraction or a sign is refused 014 becomes the number 14

Every converter checks its input and refuses anything it does not recognise. It never rounds. A slash date is two different days in the two orders, so the card names the order. 02/03/2026 is 2 March under date:DD/MM/YYYY and 3 February under date:MM/DD/YYYY.

A value a customer’s JSON file wrote as a number carries that fact to the mapper. decimal:de over such a value is refused whatever the digits are. In JSON a dot separates the decimals, so 1.500 is one and a half, and the German reading would make it fifteen hundred. Declare decimal:dot-trailing-sign for such a field. The same digits sent as a string are still read as German. The refusal is an ordinary unreadable-value field error, and names the card’s own from pointer.

Units

A decimal field may declare a unit, for a value written with a percent sign or a currency:

{ "to": "/tax/percent", "from": "/Satz", "format": "decimal:de", "unit": "%" }
  • The engine removes exactly that unit, then the field’s converter reads the number. 19 %, 19% and 19 all read as 19.
  • A currency unit is written as its code or, for EUR only, as €. It may stand before or after the number, with one space or none: 4,90 €, €4,90 and EUR 4,90 all read as 4.90. A no-break space counts as a space. No other currency sign is read, because no pinned list of signs exists.
  • Any other unit is refused, never removed. Under "unit": "EUR", $4,90 and 4,90 USD are refused.
  • A currency unit must equal the invoice currency. When the card’s unit and the invoice currency differ, every value of that field is refused, with or without the unit written. Nothing is converted.
  • A card is refused when it is loaded if a unit is neither % nor a code on the currency list the gate accepts, or if the field has no decimal converter.

Dictionaries

The dictionaries come in versions. A card’s codelistVersion names the one it uses. Version 1.0.0 holds four dictionaries: unit, vatCategory, documentType and paymentMeans. A word is looked up after trimming, Unicode normalisation, lower-casing and collapsing inner spaces, and nothing else. A word that is not found is never guessed.

The codes each dictionary produces are held to a pinned code list:

Dictionary Pinned list
paymentMeans Payment.gc, from the EN 16931 code list package the European Commission publishes
vatCategory 5305.gc, from the same package
unit Unit.gc, from the same package
documentType UNTDID 1001, as KoSIT publishes it

Each list is pinned to one published version. Every code a dictionary gives is one the list defines, and every documentType code is also one of the invoice type codes the XRechnung rule BR-DE-17 names.

One name is worth knowing before you read the unit list. The pinned unit list titles the code C62 as “one”, not “piece”. Sending the German word for a piece to C62 is correct, and anyone checking that mapping against the published list should expect to find “one” there.

Official codes

A code field, such as a VAT category or a unit, takes a code from one official list. The list holds the codes the official validator accepts for that field. A supporting document’s type code has no list, because no code-list rule binds it.

A field with codes or codelist reads its code in this order:

  1. its codes table; a code mapped to null writes no value
  2. the company’s code book
  3. an official code, kept as written
  4. the dictionary its codelist names
  5. otherwise an unmapped-code error

A field with neither reads its code from the code book, then keeps an official code as written; any other code is an unmapped-code error, listed under review. A field with no official list writes its code as it was read, and the validator decides.

A code that decides its row

On a field with "decidesRow": true, the code decides whether its row is written at all. An SAP line condition is an allowance, a charge or the line’s price, and only the customer’s own condition type says which. The code is read first, an absent or empty one as the empty code "":

  1. in the codes table with an official code: the row is written
  2. in the codes table with null: no row is written, since it is no allowance or charge
  3. in the company’s code book: the row is written
  4. an official code as written: the row is written
  5. otherwise: no row is written, and the code is listed under review with an unmapped-code error

Only such a field may name the empty code in its codes table, as {"": null}.

Mapping results

For each record, mapping returns:

Key Meaning
invoice The invoice, or null if there is any error.
partial What could be built, for showing on a screen.
errors Problems, each with a code, the business term bt, the target and source pointers and a detail. A value its converter refused may also carry readsAs, when other converters of the same kind read every value of its column in the file.
review Codes and words nothing could read, for a person to decide.
configVersion The card’s version.
trace One entry for each value in partial: its place at, its business term bt, and its origin. The origin is source with the source pointer it was read at, card for a constant the card sets, or derived with a sentence from saying what it was worked out from.
unreached The places the card reads that the record does not have: a CSV or Excel column the file lacks, or a place that holds another shape. An empty cell, and a key one record of nested data leaves out, are not listed.
unseen The places the record has that the card has never seen, each once, with row numbers left out. Mapping runs all the same; the API decides whether the file waits for a person.
places Every place the record has, each once, with row numbers left out. With unseen and unreached, the API measures how much of a file’s layout the card knows.
Error code Meaning
missing-required A required field has no value, or the card produces nothing for it. For BT-116, which no card can produce, the message instead says why the engine could not add it up.
unreadable-value A value could not be read or converted, a selector was ambiguous, or the card cannot reach a value: a CSV or Excel column it reads is missing and not marked optional, or its pointer runs into a value of another kind, such as text or a list where it reads an object. The same holds for the from of an optional repeat. An Excel cell it reads that holds an error, such as #N/A, is one too, and the detail names the cell and the code. So is an amount whose card unit is not the invoice currency. So is a value the canonical invoice model refuses: the error names the field’s business term and the card’s from pointer, and the detail names the value and the rule it breaks. This holds for optional fields too.
unmapped-code A value is not in the card’s codes table, not on the field’s official list, and not a word the dictionary knows. Or a payment key is not in the card’s paymentKeys table. The same value is listed under review. A code off its official list on a field with no dictionary is one too, such as the country DE with a trailing space.
source-drift The mapped invoice does not hold a value as the customer sent it. This is a defect in Certinvo, not in the data.

An empty CSV or Excel cell maps to nothing. So does a key the card reads that a JSON, XML, IDoc or EDIFACT record does not have, because those files often leave out an empty value. For an optional field neither is an error. A required field with nothing behind it is missing-required in every format.

An item of an optional repeat that gets no value from the record, such as a note or a VAT row whose cells are all empty, maps to nothing too, and the items after it move up. An empty line is still refused, naming its required fields.

Refusals when the card is loaded

A card is checked when it is loaded, before anything is mapped. The API refuses a wrong card with 400 invalid_mapping_config, and the detail says why. A card is refused for:

  • a bad version name, or an unknown model version or dictionary version
  • a to that does not exist in the model
  • a missing converter, or a converter that does not suit the field
  • a unit that is neither % nor a currency code the gate accepts, or a unit on a field with no decimal converter
  • an unknown dictionary
  • a field written twice
  • an unknown input format
  • a CSV or Excel input that names neither groupBy nor lineColumns
  • an EDIFACT input other than INVOIC in a directory with a table
  • a codes table on a field that takes no official code, or without a from
  • a codes answer, or a fixed const code, that is not on the field’s official list
  • fromRecord outside a repeat, or on a field with no from
  • when on a field with no const, or a when that is not a pointer
  • first on an inner repeat or on a list two repeats fill, a first that is no group, or a field of the repeat that is not a field of that group
  • a document input with no lineColumns, a lineStart that is not one of them, a lineOneRow or lineParts that names a column it does not have, a word range whose start is below 0 or whose end is not past its start, or an anchor with no heading, a side other than right or below, or a row below 1
  • a paymentKeys table on any field but /paymentTerms/note, or without a from
  • a payment key with no text, text that starts a line with #, or a step that is not a whole number of days with a percent and base amount of at most two decimals
  • payment keys that grant steps beside a repeat onto /paymentTerms/discounts
  • a repeat onto /lines whose from is ""
  • a where that is not one selector
  • a field that writes inside a list without a repeat onto that list
  • a field that writes a whole list or a whole group
  • a field that writes into a list inside a line, outside a repeat inside the lines repeat
  • an inner repeat onto a list that is not directly inside the outer list’s item
  • a repeat inside a repeat inside a repeat
  • two repeats onto one list, unless each says where
  • a columns entry with no source, or a decision other than mapped, ignored or unmapped
  • a mapped column no field reads: its values would be dropped from every invoice
  • an alias that is not a pointer, is its field’s own from, or is a place another field reads under another source
  • a fallback that is not a pointer, sits beside no from, or is one of its field’s own names (from or an alias)
  • fallbackFromRecord outside a repeat, or on a field with no fallback
  • optional on a column that is not mapped, or whose field the model requires
  • a system that is not text, is empty, or is longer than 200 characters

A card with a target is checked against that model. It is refused without that model, with another model, or when the model is not an object of fields. A model handed to a card that names none is refused too.

See also

Navigation

Type to search…

↑↓ navigate↵ selectEsc close