Skip to content

API reference

Preview a mapping

Mappings API

POST/v1/mappings/previews

Runs one record through a draft mapping config and shows the invoice it produces. Use it to review a config before you freeze it. Send the draft config itself, not a stored version. It is checked the same way as when you freeze it, so a refusal here is the same refusal you would get later. Nothing is stored. Without check, nothing is validated either: a previewed invoice is then only well-formed. With check: true, a complete invoice is also validated under your validation policy, as a real invoice of yours would be, and the answer carries policies. invoice: null together with named errors is a normal preview result, not a failure.

Request body

application/json, required

  • configobjectRequired

    The draft mapping config, exactly as the reviewer sees it.

  • datastring (byte)

    The customer's own file, base64-encoded. It is read with the config's input block, the same reader a mapped-file conversion uses, and its first invoice is used as the record. When data is sent, row is ignored.

  • rowany

    One record of the customer's sample, as the reader returns it.

  • checkboolean

    true validates the previewed invoice under your validation policy: the strengths for the invoices you make, and the files your policy makes. Nothing is stored. Left out, nothing is validated.

Status codes

Status Meaning
200 {invoice, partial, errors, review, peppol}, with fromSettings and policies when they apply: - invoice: the canonical invoice, or null when anything is wrong. errors then names each problem. - partial: what the record produced so far, even when there are errors. It is for display next to the errors only. It is not an invoice and is never validated or stored. - review: the unknown codes that need a person to confirm them. - peppol: when your validation policy makes Peppol files, each code in partial that Peppol BIS refuses although the XRechnung lists accept it, as {bt, target, code, lists}. Otherwise null. It is a warning: nothing else in the answer changes, and the XRechnung files are made as before. - fromSettings: the seller fields filled from the company’s seller details because the card does not write them, as {to, value}, when its useOnInvoices is ticked. Absent when none was. - policies: only with check: true. {checked: false, why} when nothing was validated: incomplete while invoice is null, unavailable when the validator could not run. Otherwise {checked: true, verdict, runs, findings, notApplicable, refused}: the validator’s verdict under your policy, each run as {rulebook, strength, rendering, verdict}, and each rule finding once as {rule, severity, text, rulebooks, decides, terms, fields}. terms are the business terms the rule names and fields the mapping fields they name, such as /buyerReference for BT-10. notApplicable and refused are as in the check report. The preview runs the same code as a frozen mapping.
400 The config does not load (invalid_mapping_config). Freezing it would fail the same way.
401 No usable credential was sent (invalid_credentials).
POST/v1/mappings/previews
Example
curl -X POST https://api.certinvo.com/v1/mappings/previews \
  -H "Authorization: Bearer $CERTINVO_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @body.json
import { readFile } from 'node:fs/promises'

const response = await fetch(`https://api.certinvo.com/v1/mappings/previews`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.CERTINVO_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: await readFile('body.json'),
})
console.log(response.status, await response.json())
import os

import requests

response = requests.post(
    "https://api.certinvo.com/v1/mappings/previews",
    headers={"Authorization": f"Bearer {os.environ['CERTINVO_API_KEY']}", "Content-Type": "application/json"},
    data=open("body.json", "rb"),
)
print(response.status_code, response.text)
200
No response body.
Success response
POST
/v1/mappings/previews
Preview a mapping
All
›AuthenticationRequiredBearerAuth

Provide your API key in the Authorization: Bearer <key> header. Keys are stored locally in your browser.

›Headers2
›Bodyapplication/json
›Code Snippet
curl -X POST "https://api.certinvo.com/v1/mappings/previews" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "config": {},
  "data": "string",
  "row": "string",
  "check": true
}...'
Response

No request sent yet

Configure parameters and click Send to view the response.

Navigation

Type to search…

↑↓ navigate↵ selectEsc close