Submit a settlement

A settlement is a payout statement for the pharmacy, typically submitted daily or weekly. Settlements and invoices are independent documents: submit each on its own cadence, without referencing the other.

Step 3 of submitting a settlement (see POST /documents/upload-url for steps 1 and 2). Creates a settlement 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 settlement, 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 settlement 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 settlement with 200. Submitting an existing externalId with different dates or files returns 409 and leaves the settlement 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.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
Path Params
string
required
length ≥ 1

Recipient pharmacy ID

Body Params
string
required
length between 1 and 255

Your stable reference for this document, unique per document kind. Resubmitting the same reference is idempotent.

date
required
^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$

First day of the period the document covers (YYYY-MM-DD, inclusive)

date
required
^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$

Last day of the period the document covers (YYYY-MM-DD, inclusive). Must not be before dateFrom.

fileIds
array of uuids
required
length between 1 and 20

Distinct file IDs returned by the upload endpoint

fileIds*
Responses

Retry-After seconds.

Language
Credentials
Header
URL
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json