# EmailAttachmentInput input


One attachment of a send. Pass exactly one of `orderInvoice`, `invoicePdf`, `document` or `file`.

## Input fields

### orderInvoice

[`UUID`](/chameleoon-max/type/uuid)

The MAX id of a sales order whose invoice to attach.

- MAX attaches the order's governing invoice, as `invoicePdf` gives it. The governing invoice
  is the order's newest linked invoice of kind `INVOICE` that is issued, created, not
  cancelled and numbered.
- When your API key may not see that invoice, the call fails with `FORBIDDEN_ROLE` and reason
  `DOCUMENT_READ_REQUIRED`. The order's own file is never sent instead.
- With no governing invoice, MAX attaches the order's current `INVOICE` document, else the call
  fails with `INVOICE_NOT_READY`.
- Advance invoices and credit notes are never picked.
- Requires the `invoice.read` permission, and also `price.read` when MAX renders the PDF
  itself.

### invoicePdf

[`UUID`](/chameleoon-max/type/uuid)

The MAX id of an invoice to attach as a PDF. The invoice can be of any kind, but must be issued,
created and not cancelled (otherwise `INVOICE_NOT_PRINTABLE`). MAX takes the first PDF there is:

1. The accounting system's PDF attached to the invoice ([`attachInvoiceDocument`](/chameleoon-max/mutation/attach-invoice-document)).
2. A linked order's document of the invoice's kind (`INVOICE`, `CREDIT_NOTE` or
   `PROFORMA_INVOICE`) under the invoice's number.
3. MAX's own render from its print template, where the invoice's external source allows it
   (`ExternalSource.invoicePrintAllowed`).

With none of them, the call fails with `INVOICE_PDF_MISSING`. Requires the `invoice.read`
permission, and also `price.read` when MAX renders the PDF itself.

### document

[`UUID`](/chameleoon-max/type/uuid)

The MAX id of a document of an order or an invoice. Its current version is attached.

### file

[`UUID`](/chameleoon-max/type/uuid)

The id of a file you uploaded through `POST /api/v1/files`.

### filename

`String`

A new file name for the attachment.

## Used by

- [`SendEmailInput`](/chameleoon-max/type/send-email-input)
- [`SendTestEmailInput`](/chameleoon-max/type/send-test-email-input)
