/v1/datev-exportsExports the invoices of one period to DATEV: one EXTF CSV (datev-extf), or one invoice data package (datev-ledger) split into as many parts as DATEV’s limits require.
The export takes the invoices of one direction whose Invoice issue date (BT-2) is in the range. It runs in the background. The response is the export’s id. GET /v1/datev-exports/{id} shows the outcome: each invoice written, or left out with the writer’s code and reason, and the gate’s verdict on each. Fetch the files from GET /v1/datev-exports/{id}/download.
An invoice you issued goes into the file only with an accepting verdict. An invoice you received goes in whatever the verdict, because it is the sender’s invoice and yours to book; its verdict says when the gate rejected it.
What is taken
- By default, only invoices not yet exported. DATEV does not detect duplicate imports.
- With
includeExported: true, invoices that an earlier, successful export of the same format already holds are taken again and markedresent. - For an edited invoice, only the newest version.
Corrections
A correction is an invoice with a confirmed class (PUT /v1/invoices/{id}/correction), or a newer version of an exported invoice. It is booked against the version of the original that an earlier export of the same format holds, and never changes that booking:
non-financial: nothing is booked.financial: the difference only.replacement: the original is reversed, and the correction is booked as a new invoice.
In the CSV, the original’s invoice number is in Belegfeld 1 and the correction’s in Belegfeld 2 (when it has 12 characters or fewer). In the package, a reversal or a lower difference is a negative amount under the original’s invoice number.
When the original went out only in the other format, or in an export that has not finished, the export answers 409 reconciliation_needed with the list in reconcile. Ask again with their ids in reconciled to take them. A newer version of an exported invoice with no confirmed class is listed the same way; confirmed here, it is booked as a replacement.
Refused before anything is recorded
- A CSV without DATEV settings.
- A CSV range that crosses the start of a fiscal year (one CSV holds one fiscal year).
- A range with nothing to export.
- Corrections whose original’s way to DATEV is not confirmed (
reconciliation_needed).
Request body
application/json, required
- directionstringRequired
infor invoices this company received,outfor invoices it sent.One ofin,out. - formatstringRequired
datev-ledgeris the DATEV invoice data package (a zip).datev-extfis the Buchungsstapel CSV and requires/v1/datev-settings.One ofdatev-ledger,datev-extf. - issuedFromstring (date)Required
The earliest Invoice issue date (BT-2) to include.
- issuedTostring (date)Required
The latest Invoice issue date (BT-2) to include. That day is included.
- includeExportedboolean
Also take invoices that an earlier export of this format already holds, and mark them
resent. - reconciledarray of string (uuid)
The invoices from a
reconciliation_neededlist that you confirm. Each is taken, and the confirmation is recorded on its export item.
Response
A 202 answer carries these fields.
- idstring (uuid)Required
- invoicesintegerRequired
The number of invoices the export took.
- resentintegerRequired
The number of those invoices an earlier export already holds.
Status codes
| Status | Meaning |
|---|---|
202 |
The export was recorded and queued. The file is not in the response. |
400 |
The body is not a valid export request (invalid_datev_export), or a CSV range crosses the start of a fiscal year (range_crosses_fiscal_year, the message says where to split it). Nothing was recorded. |
401 |
No usable credential was sent (invalid_credentials). |
409 |
A CSV was requested without DATEV settings (no_datev_settings), the range has nothing to export (nothing_to_export), or corrections need confirming (reconciliation_needed, with the list in reconcile). Nothing was recorded. |
/v1/datev-exportscurl -X POST https://api.certinvo.com/v1/datev-exports \
-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/datev-exports`, {
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/datev-exports",
headers={"Authorization": f"Bearer {os.environ['CERTINVO_API_KEY']}", "Content-Type": "application/json"},
data=open("body.json", "rb"),
)
print(response.status_code, response.text){
"id": "3f0c2a5e-8d1b-4c7a-9e2f-6b5d4a3c2b1a",
"invoices": 0,
"resent": 0
}