Documents
The Document entity is the fundamental entity in INFast. It represents all the documents generated in INFast (invoices, quotations, etc.). The concept of a document is closely tied to legal and accounting rules regarding invoicing. Therefore, documents have a specific workflow impacting its status and version. A document can have various type and subtype.
Data Format
Common fields
The Document object includes all common-fields.
Specific fields
You can find the detailed format for input and output in the reference.
status
This is the current state of the document:
DRAFT
: The document is still modifiable. This is the initial status. PDF exports include a "DRAFT" watermark.VALIDATED
: The document has been finalized. It can no longer be modified.CANCELED
: The document has been replaced by a new version or marked as canceled.CONVERTED
: The document (a quotation) has been converted into an invoice.ACCEPTED
: The document (a quotation) has been marked as accepted.REFUSED
: The document (a quotation) has been marked as refused.PAID
: The document (an invoice) has been entirely paid.
version
This is the version number of the document. It is a float number automatically incremented each time the document is modified. This versioning scheme is similar to software versioning. The first version will be 1.0
, the second 1.1
, and so on until the tenth, which will be 2.0
.
Each version also contains a reference to the previous and next versions:
prevDoc
the previous version of the document (if the current document is not the first version),nextDoc
the next version of the Document (if the current document is not the last version).
type
This represents the "family" of the document: INVOICE
, QUOTATION
or OTHER
. This field is a completed by a subtype
field specifying the kind of the document.
Document of type OTHER
are not available for creation from INFast API.
subtype
This represents the kind of the document. The subtype depends on the type
of the document.
QUOTATION
subtypes:
QUOTATION
INVOICE
subtypes:
INVOICE
DEPOSIT
CREDIT_NOTE
PROFORMA
SITUATION
(progress invoice)
OTHER
subtypes:
ORDER_FORM
DELIVERY_NOTE
CUSTOM
: (customized document kind)
In fact, there is no different type of quotation, but we kept subtype
for consistency.
reference
This is the unique reference of the document, automatically assigned by the INFast server. This reference cannot be modified or defined at creation.
A temporary reference (referenceTemporary
) is assigned to the document while waiting for synchronization with the server. This reference cannot be modified or defined at creation.
referenceInternal
This is an optional internal reference for the user company to identify the document. This reference can be defined by the user (and via the API).
Document workflow
Through the API, it is not permitted to modify documents (aside from some status changes). However, it is important to understand the impact of INFast users' actions on the status changes of documents.
Let's take a typical example of a user creating a quotation. The client accepts it, and the user generates the final invoice. Then, the user marks the invoice as paid.
- The user create a quotation. The document has a
DRAFT
status and version1.0
. - The user finalizes the quotation. The status changes to
VALIDATED
. - The user create a new version of the quotation. The new version has a
DRAFT
status and version1.1
. It also has aprevDoc
field pointing to version 1.0 while the version 1.0 has anextDoc
field pointing to the current version. Note that version 1.0 status changed toCANCELED
. - The user finalizes the quotation 1.1. The status changes to
VALIDATED
. - The user marks the quotation as accepted. The status changes to
ACCEPTED
(version 1.1 only). - The user converts the quotation into an invoice. A new document of type and subtype
INVOICE
is created inDRAFT
status. The quotation status changes toCONVERTED
. - The user can create multiple versions of the invoice following the same pattern.
- The user adds payments to the invoice. Once the invoice is fully paid, the status changes to
PAID
.
Credit note invoice
Credit note (type = INVOICE
and subtype = CREDIT_NOTE
) can be used as a payment to fully or partially cancel an invoice.
Credit notes are not available for creation from INFast API.
Deposit invoice
Deposit invoices (type = INVOICE
and subtype = DEPOSIT
) are automatically generated as soon as a quotation with a deposit is accepted. The final invoice will also mention the deposit invoice.
It's not possible to manually create a deposit invoice.
To generate a deposit, you have to specify a deposit when creating the quotation:
"deposit": {
"type": "PERCENT",
"percent": 10,
"dueDate": "2024-06-10T12:59:07.444Z"
}
Cancel a deposit invoice
If you cancel a deposit invoice, you may also need to check the quotation it was created from:
- If the quotation has been convert into a final invoice, you can cancel the final invoice with a credit note,
- If the quotation has not been convert to a final invoice, you can cancel the quotation.
Deletion
For legal and tax reasons, it is not possible to delete any document. Specifically, once an invoice or a quotation has been finalized, it becomes non-modifiable and non-deletable.
Only documents with the status DRAFT
and version 1.0
can be deleted.