Skip to content

Upload email attachments to a draft invoice

POST
/v1/invoices/{id}/attachments
curl --request POST \
--url https://api.emite.cr/v1/invoices/example/attachments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form files=@file

Multipart upload (files field, one request for all files). Attaches extra files that travel with the invoice email once Hacienda accepts it. Allowed only while the invoice has not been submitted (status draft/error). Validates each file's MIME (against a whitelist, by signature — not the declared content-type) and size, and the combined cap of 5 attachments (tenant-fixed + per-invoice). Returns the created attachments.

id
required
string

Invoice UUID

Media typemultipart/form-data
object
files
Array<string>
Media typeapplication/json
Array<object>
object
id
required

Attachment id.

string
filename
required

Original (sanitized) filename, shown in the list and used in the email.

string
contentType
required

MIME type.

string
sizeBytes
required

Size in bytes.

number
createdAt
required

When the file was uploaded (ISO 8601).

string
isMandatory

Tenant-fixed only: when true the attachment cannot be omitted from an individual invoice.

boolean
Examplegenerated
[
{
"id": "example",
"filename": "example",
"contentType": "example",
"sizeBytes": 1,
"createdAt": "example",
"isMandatory": true
}
]

No file, disallowed MIME (ATTACHMENT_MIME_NOT_ALLOWED), too large (ATTACHMENT_TOO_LARGE), corrupt content (ATTACHMENT_CONTENT_INVALID), or over the combined limit (ATTACHMENT_LIMIT_REACHED).

Invoice not found.

Invoice already submitted/accepted (INVOICE_NOT_ATTACHABLE).