/v1/previews/dutiesAccepts one canonical JSON invoice, complete or not, as an invoice the company makes. Answers the countries whose invoicing duty, naming the rule set that validates it, the policy engine’s decision requires for it (today France’s). The decision reads the facts a check of it would declare: the company facts, the buyer card and the establishment the invoice follows. The create form shows a country’s terms only for these. It also answers the strength of every rulebook a check of the draft would run, from the same decision: the create form marks what those rulebooks require before any check. It also answers files: the files the draft is made as when nobody chooses them, who the buyer is taken to be, and why. A German seller’s invoice to a business or a consumer is made as the Factur-X PDF, and to a public buyer as XRechnung; a choice in Settings, on the buyer card or on the invoice wins. The files are planned as a check of the draft plans them: each moves up to the lowest level of its format that carries the invoice, so a draft with sub-lines is made as the ZUGFeRD EXTENDED PDF. ticked and unticked are the ticks on the form. Nothing is kept and no quota is used. A draft the engine cannot decide gets an empty list and no rulebooks.
Query parameters
- tickedstring
Files ticked on for this draft, by their ids, comma-separated. A file Certinvo does not make is refused with 400
invalid_operation. - untickedstring
Files ticked off for this draft, by their ids, comma-separated. A file ticked off is never moved to.
Request body
application/json, required: object
Response
A 200 answer carries these fields.
- countriesarray of stringRequired
- rulebooksobject
Each rulebook's strength for a check of this draft. Absent under manual selection.
- filesobjectRequired
The files the draft is made as when nobody ticks one, by their ids in the list of files Certinvo makes.
Show 5 child fields
- formatsobjectRequired
- buyerTypestringRequired
Who the buyer is taken to be, declared or assumed. Null when nothing says.
One ofB2B,B2C,B2G. - chosenarray of objectRequired
Why the files are these. A file that moved up a level, or to the one file of another format that carries the draft, first, with the codes of what required it, such as
sub-lines.buyer_B2B,buyer_B2Corbuyer_B2G: the default for that buyer type.no_national_duty: a business or consumer buyer in another country, so no national duty applies and the file is the company's default.xrechnung_for_B2Borxrechnung_for_B2C: XRechnung was chosen for a buyer that is no public one, andneedsnames the terms XRechnung also requires that the draft leaves empty.Show 3 child fields
- renderingstringRequired
- becausearray of stringRequired
- needsarray of string
- choicesarray of stringRequired
The files a tick on the invoice or a buyer's saved files choose. Once one of them is chosen, the default by buyer type no longer applies.
- conflictobject
Present when no level of a format asked carries the draft and two or more files of other formats do.
refusedare the files asked,becausethe codes of why, andoptionsthe files that carry it. With exactly one such file, it is made instead and listed inchosen.Show 3 child fields
- refusedarray of stringRequired
- becausearray of stringRequired
- optionsarray of stringRequired
Status codes
| Status | Meaning |
|---|---|
200 |
The countries, as ISO 3166-1 alpha-2 codes, sorted. Empty when no such duty applies. |
400 |
The body is not JSON (invalid_json), or ticked or unticked names a file Certinvo does not make (invalid_operation). |
401 |
No usable credential was sent (invalid_credentials). |
/v1/previews/dutiescurl -X POST https://api.certinvo.com/v1/previews/duties \
-H "Authorization: Bearer $CERTINVO_API_KEY" \
-H "Content-Type: application/json" \
--data-binary @body.jsonimport { readFile } from 'node:fs/promises'
const response = await fetch(`https://api.certinvo.com/v1/previews/duties`, {
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/previews/duties",
headers={"Authorization": f"Bearer {os.environ['CERTINVO_API_KEY']}", "Content-Type": "application/json"},
data=open("body.json", "rb"),
)
print(response.status_code, response.text){
"countries": [
"string"
],
"rulebooks": {},
"files": {
"formats": {},
"buyerType": "B2B",
"chosen": [
{
"rendering": "string",
"because": [
"string"
],
"needs": [
"string"
]
}
],
"choices": [
"string"
],
"conflict": {
"refused": [
"string"
],
"because": [
"string"
],
"options": [
"string"
]
}
}
}