---
title: "Give a customer its files and delivery"
description: "Learn how to save which files a customer needs and how they reach it, so every invoice for it is made and sent the same way."
---

> 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.

# Give a customer its files and delivery

Some customers need one file and one way to get it. A city wants the XRechnung CII on its portal. A company wants
the ZUGFeRD PDF by email. You can save this on the customer once. Every invoice for it then gets those files, and
says where it goes.

An email can be sent by itself once you turn on automatic sending. Until then, a person sends the email. A portal
upload is always done by a person. See [Send an invoice by email](/how-to/invoices/send-an-invoice-by-email#send-by-itself).

## Before you begin

- The customer is saved under **Kunden** in the console, or through `PUT /v1/customers`.
- You know the file the customer needs. The ids are the ones the download uses, such as `zugferd-pdf`, `cii`,
  `ubl`, `peppol`, `en16931-ubl`, `en16931-cii` or `factur-x`.

## Save the files and the delivery

**In the console:** open the customer's page. Under **Dateien und Zustellung**, tick the files it needs. Then pick
**Per E-Mail** with an address, or **Über das Portal des Kunden** with an optional link and instructions. Pick the
file that goes with it, and save.

**Through the API:** give the customer two more fields in `PUT /v1/customers`:

```json
{
  "id": "acme",
  "name": "Acme GmbH",
  "files": ["zugferd-pdf"],
  "delivery": { "channel": "email", "to": "invoices@acme.de", "file": "zugferd-pdf" }
}
```

An email delivery may add `"sending": "automatic"` or `"sending": "by-hand"`. It overrides the company's sending
setting for this customer. Leave it out to follow the setting. A portal delivery cannot have it.

A portal delivery looks like this:

```json
{ "channel": "portal", "file": "cii", "url": "https://xrechnung.bund.de", "instructions": "Upload the CII file." }
```

Both fields are optional. A customer saved without them works as before.

A Peppol delivery sends the Peppol BIS file to the customer's participant ID, its electronic address:

```json
{ "channel": "peppol", "file": "peppol" }
```

It needs two participant IDs: the customer's, and the company's own, the head office's electronic address under
Locations. Without either, the list is refused with 422 `peppol_participant_missing`, naming which one, and nothing is
saved. No Peppol access point is connected yet, so the invoice page shows the plan and the file to send, and nothing is
sent by itself.

A customer saved with no electronic address is looked up in the Peppol registry: by its VAT ID, in the scheme the
official EAS list names for its country (9930 for a German VAT ID), and by a Leitweg-ID in its buyer reference (0204).
When exactly one registered participant answers, it becomes the electronic address, and the customer's card says
"Peppol ID found and used" with the date. When several answer, none is used, and the card lists them for you to pick.
A French VAT ID is not looked up this way: the EAS list names its scheme "French VAT number", not by the country.

The list is refused with 400 `invalid_customers`, and nothing is saved, when:

- a file is not one Certinvo makes, or is listed twice;
- the delivery's `file` is not one of the customer's `files`;
- an email delivery has no address, or more than one;
- a portal link does not start with `https://`.

## What a conversion does with them

A conversion that names the customer (`"customer": "acme"`) makes the customer's files for every invoice, whatever
your Settings say. Your Settings still decide the other files.

`false` in `outputs` for a file the customer needs, such as `outputs.pdf: false`, is refused with 422
`customer_needs_file`. Nothing is accepted. The message names the customer and the file. Leave the key out, or set it
to `true`.

A file is still kept only when its own rules accept it. A Peppol file that breaks a Peppol rule is held back, as on
any invoice, and the invoice's report says so.

Some invoices need a higher level of their format. An invoice with sub-lines, an invoicee or a payer other than the
buyer, or another field only ZUGFeRD EXTENDED carries, moves the Factur-X PDF up to the ZUGFeRD EXTENDED PDF. It is one
file, and a delivery that sends the Factur-X PDF sends the ZUGFeRD EXTENDED PDF instead. A customer whose files are
XRechnung files (`ubl`, `cii` or `zugferd-pdf`) keeps them: no XRechnung level carries those parties, so each file
names the party or field it leaves out. When the CII cannot carry the invoice, as with sub-lines, the XRechnung UBL file
is made in its place. The invoice page says why each file was made, and lists what each file leaves out.

On the create form, picking the customer ticks its files and locks them. The form also says where the invoice will
go.

## Choose another delivery for one invoice

The customer's delivery is the default. One invoice can go another way without changing the customer.

**In the console:** on the create form, under **Files and delivery**, the **Delivery** list starts at **As saved for
the buyer**, with that way said under it. Pick **No fixed delivery method**, **Email** or **Portal** instead. An email
asks for the address, filled in from the buyer's contact email. A portal asks for the link. Pick the file from the
files ticked. The form then asks for that file too.

**Through the API:** send `delivery` with the conversion, in the customer's shape, or `null` for no fixed way:

```json
{
  "customer": "acme",
  "delivery": { "channel": "email", "to": "buchhaltung@acme.de", "file": "zugferd-pdf" },
  "input": { "type": "canonical-invoices", "items": [ ... ] }
}
```

It works without a named customer too. Leave it out, and the customer's delivery is kept, as before.

Its `file` must be one the conversion makes: set to `true` in `outputs`, or one of the named customer's files.
Otherwise the request is refused with 422 `delivery_file_not_made`, and the message names the file. Another shape,
such as an email with no address or a portal link that is not `https://`, is refused with 400 `invalid_operation`.
Nothing is accepted in either case.

## The plan is kept with the invoice

When the invoice is filed, its plan is kept with it: the customer's id and name, its files and its delivery, as they
were then. A delivery chosen for the invoice is kept in place of the customer's. `GET /v1/invoices/{id}` answers it
as `deliveryPlan`. An invoice with a chosen delivery and no customer has a plan with no `customer` and empty
`files`. It is `null` for an invoice made with neither.

A later change to the customer does not change an invoice already filed. Nobody can change the plan afterwards: the
database refuses it.

## Send it

On the invoice's **Zustellung** tab, the plan is shown first.

- **By email:** the email form starts with the planned address and file. Press **Per E-Mail senden**. Through the API,
  `POST /v1/invoices/{id}/emails` may leave out `to` and `format`; the plan fills them in. See
  [Send an invoice by email](/how-to/invoices/send-an-invoice-by-email).
- **Through a portal:** the tab shows the link and the instructions. Download the file and upload it there.
  Downloading is never recorded as delivered.
- **By Peppol:** the tab names the Peppol file to send to the customer's participant ID, and whether it is ready:
  "Ready for Peppol: no access point connected", the reasons it is not, or that the registry is being asked.

## See also

- [Create an invoice and its PDF](/how-to/invoices/create-an-invoice-and-its-pdf)
- [Send an invoice by email](/how-to/invoices/send-an-invoice-by-email)

Source: https://docs.certinvo.com/how-to/invoices/give-a-customer-its-files-and-delivery/index.mdx
