---
title: "Export a period to DATEV"
description: "Learn how to export one invoice or a whole period to DATEV and collect the files."
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.certinvo.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Export a period to DATEV

Use this guide to hand invoices to a tax adviser for import into DATEV, the German bookkeeping system. You can
download one invoice's DATEV file, or export a whole period as a background job. 

## Before you begin

Enter the company's DATEV settings first. See [Set up DATEV](/how-to/datev/set-up-datev).

## Choose the file

| Format | When to use it | Needs DATEV settings |
|---|---|---|
| `datev-extf` | The adviser imports booking rows (DATEV-Format, Buchungsstapel). | Yes |
| `datev-ledger` | The adviser imports invoices with their images (Rechnungsdatenservice package). | No. Accounts are added when they are set up. |

## Download one invoice

```bash
curl -s -o datev.csv -H "Authorization: Bearer cvo_live_sk_..." \
  "https://<api-host>/v1/invoices/<id>/download?format=datev-extf"
```

Use `format=datev-ledger` for the package, a zip file. The file is made on the spot and not stored.

An outgoing invoice that was rejected or never checked gets no DATEV file. The answer is 409
`invoice_rejected` or `invoice_not_validated`. An invoice already sent is decided by the check it was sent with,
so a later check under a newer policy does not keep it out of DATEV.

## Export a period in the console

1. Open **Inbound** or **Outbound**, depending on which invoices to export.
2. Click the **Export** icon beside the Upload button, then choose **DATEV period export**. In the invoice studio,
   **Manage** has the same menu behind its **Export for bookkeeping** button, for outbound invoices.
3. Pick the months and the format (ZIP package or CSV). Choose whether to include invoices that were already
   exported.
   Each invoice version in a ZIP package carries a fixed ID. DATEV's schema says it skips a document whose ID it
   already holds, so the same version is not booked twice from a package. A corrected version has a new ID.
4. Start the export. If the screen lists corrections to confirm, read each line. Click **Confirm and export** to
   book them against the original as listed, or **Cancel** to leave the export unstarted.
5. Download the file when it is ready.

The screen lists every invoice the export left out. It says why, and why an export was refused, in the console's
language, chosen by the code the API gave.

## Export a period through the API

### 1. Start the export

```bash
curl -s -X POST "https://<api-host>/v1/datev-exports" \
  -H "Authorization: Bearer cvo_live_sk_..." \
  -H "Content-Type: application/json" \
  -d '{"direction": "out", "format": "datev-extf", "issuedFrom": "2026-08-01", "issuedTo": "2026-08-31"}'
```

| Field | Meaning |
|---|---|
| `direction` | `out` for sent invoices, `in` for received ones. |
| `format` | `datev-extf` or `datev-ledger`. |
| `issuedFrom`, `issuedTo` | The range of invoice dates, as `YYYY-MM-DD`, both included. |
| `includeExported` | Optional. `true` also takes invoices already exported in this format. |
| `reconciled` | Optional. The ids of corrections you confirm after a `reconciliation_needed` answer. |

The answer is **202** with:

- `id`: the export's id;
- `invoices`: how many invoices it takes;
- `resent`: how many of those were exported before.

The work runs in the background.

### 2. Check the export until it is done

```bash
curl -s -H "Authorization: Bearer cvo_live_sk_..." "https://<api-host>/v1/datev-exports/<id>"
```

The export is `running`, `done` or `failed`. Each invoice in it is listed with one of these states:

| State | Meaning |
|---|---|
| `pending` | The export is still running. |
| `written` | The invoice is in the file. |
| `left-out` | The invoice is not in the file. A code and a message say why. |
| `not-written` | The export failed. |

Each invoice also carries the validator's `verdict` as it stood when the export finished. An invoice you
received goes into the file even when that verdict is `rejected`. It is the sender's invoice, and yours to
book. The console's export screen names every such invoice.

### 3. Download each part

```bash
curl -s -OJ -H "Authorization: Bearer cvo_live_sk_..." \
  "https://<api-host>/v1/datev-exports/<id>/download?part=1"
```

A large package is split into several parts. `GET /v1/datev-exports` lists all exports, newest first.

Each invoice the export writes gets a line `api:exported` in its history, naming the export. An invoice left
out gets none. 

## If the export is refused

| Status | Code | Meaning |
|---|---|---|
| 400 | `invalid_datev_export` | A field is missing or wrong. |
| 400 | `range_crosses_fiscal_year` | A CSV must stay inside one fiscal year. Split the range at the fiscal year start. |
| 409 | `no_datev_settings` | A CSV needs DATEV settings. |
| 409 | `nothing_to_export` | No invoices in that range, or all were already exported. |
| 409 | `reconciliation_needed` | Some corrections refer to an invoice whose way to DATEV the records cannot confirm. The list is in `reconcile`. Send the request again with their ids in `reconciled` to book them. |

A correction is booked by what it changes: nothing, the difference, or a reversal of the original plus the new
invoice. 

If some invoices are left out, see [Fix a refused DATEV export](/how-to/datev/fix-a-refused-datev-export).

## Before the adviser imports

No file from Certinvo has been imported into a real DATEV installation yet. For the first imports, ask the
adviser to check a small period first.

## See also

- [Set up DATEV](/how-to/datev/set-up-datev)
- [Fix a refused DATEV export](/how-to/datev/fix-a-refused-datev-export)

Source: https://docs.certinvo.com/how-to/datev/export-a-period-to-datev/index.mdx
