Document Service

Back

Note: The sales order model has been replaced by the generic Document model. All endpoints are now under /api/v1/Documents. The document approach supports multiple document types (sales orders, credit notes, quotes, etc.) through the DocumentTypeId field.

Overview

Documents represent transactional records — sales orders, credit notes, quotes, and any other document type defined in ref.DocumentType.

Documents provide a consistent reference for:

Soft delete is supported — deleted documents have IsDeleted = true and a DeletedAt timestamp rather than being physically removed.

All document operations are tenant-aware.


Database tables


Endpoints

Back to Sales

GET

/api/v1/Documents

Returns a paginated, filterable list of documents.

Query parameters (pagination):

Query parameters (filters):

Query parameters (date window):

Example — all documents for entity 5 in April 2026:

GET /api/v1/Documents?entityId=5&dateFrom=2026-04-01&dateTo=2026-04-30&dateProperty=orderdate&pageSize=0

Response:

Authorization:


GET

/api/v1/Documents/{id}

Returns a single document by its numeric identifier, including all lines.

Route parameters:

Behavior:

Response:

Authorization:


GET

/api/v1/Documents/ref/{orderNumber}/entity/{entityId}

Returns a document matching both order reference and entity ID.

Route parameters:

Behavior:

Response:

Authorization:


GET

/api/v1/Documents/{id}/files

Returns a paginated list of file attachments linked to a document.

Route parameters:

Query parameters: see FileFilterRequest (standard pagination + search)

Response:

Authorization:


POST

/api/v1/Documents

Creates a new document.

Request body (DocumentModel):

Behavior:

Response:

Authorization:


POST

/api/v1/Documents/{documentId}/files/assign

Assigns one or more existing files to a document.

Route parameters:

Request body (FileIdsRequest):

Response:

Authorization:


PUT

/api/v1/Documents/{id}

Updates an existing document.

Route parameters:

Request body (DocumentModel):

Behavior:

Response:

Authorization:


DELETE

/api/v1/Documents/{id}

Soft-deletes a document.

Route parameters:

Behavior:

Response:

Authorization:


DELETE

/api/v1/Documents/{documentId}/files/remove

Removes one or more file associations from a document (does not delete the file itself).

Route parameters:

Request body (FileIdsRequest):

Response:

Authorization:


Models

DocumentModel

Represents a document (sales order, credit note, quote, etc.).

Fields:

Validation:


DocumentLineModel

Represents a single line item within a document.

Fields:

Validation:


DocumentAddressSnapshotModel

An immutable copy of an address stamped at the time the document was created (via cart convert or manual creation).

Fields:


Notes