An invoice is your invoice to the pharmacy, typically submitted once a month. Settlements and invoices are independent documents: submit each on its own cadence, without referencing the other.
Step 3 of submitting a invoice (see POST /documents/upload-url for steps 1 and 2). Creates a invoice for the period from dateFrom to dateTo (both inclusive) and attaches the uploaded files. The pharmacy must be affiliated with you. A deactivated affiliation also counts, so you can still submit e.g. the last settlement or the final invoice after the pharmacy deactivates you. cannaflow emails the pharmacy's billing address about each new invoice, so you do not need to notify the pharmacy yourself.
Each file is verified on its first submission: PDFs must be well-formed and unencrypted, and CSV files must be UTF-8 text. A file that fails verification is rejected with 400 on every attempt; upload a corrected file as a new file. Files must be submitted within 24 hours of requesting their upload. Either the invoice and all of its files are stored, or nothing is.
Retries are idempotent: submitting an externalId again with the same dates and the same set of fileIds, in any order, returns the existing invoice with 200. Submitting an existing externalId with different dates or files returns 409 and leaves the invoice unchanged. An externalId is unique per kind, so a settlement and an invoice may use the same one. A file can belong to only one settlement or invoice; using it again returns 409.