This feature is currently under development and, although not available in the current version, its preliminary documentation is provided to give you a preview of the enhancements that will be included in an upcoming update.

HTTP Operation Type Object DTO Why-DTOs?
Query relatedSalesDocuments filtered by id Why?  
Query relatedSalesDocuments  

Description

Related sales documents, known as RelatedSalesDocument in the API context and Related documents in the product interface.
This resource is used to represent relationships between sales documents (for example, when a quote is converted into an order or an invoice).
It stores both the link (originId) and the type of the origin document (originDocumentType), enabling you to navigate between related sales flows.

Unlike the main SalesDocument resources (quotes, orders, invoices), this entity focuses on the relationship itself rather than the transactional content.

img

Allowed transformations between sales documents

The table below shows which transformations are supported.

Transform from → to Quote Order DeliveryNote Invoice Advance Invoice
Quote
Order
DeliveryNote
Invoice
graphQL Query
query ($quoteId: UUID!) {
  relatedSalesDocuments(
    where: {
    or: [
        { documentId: { eq: $quoteId } }
        { originId: { eq: $quoteId } }
    ]
    }
    order: { creationDate: ASC }
  ) {
    edges {
      node {
        documentId
        documentType
        operationalNumber
        documentDate
        originId
        originDocumentType
        status
        totalLiquid
      }
    }
  }
}
Variables
{
  "quoteId": "11111111-aaaa-bbbb-cccc-222222222222"
}
Example of Response
{
  "data": {
    "relatedSalesDocuments": {
      "edges": [
        {
          "node": {
            "documentId": "11111111-aaaa-bbbb-cccc-222222222222",
            "documentType": "QUOTE",
            "operationalNumber": "0011",
            "documentDate": "2025-10-05",
            "originId": null,
            "originDocumentType": null,
            "status": "Draft",
            "totalLiquid": 4620
          }
        },
        {
          "node": {
            "documentId": "33333333-aaaa-bbbb-cccc-444444444444",
            "documentType": "ORDER",
            "operationalNumber": "0020",
            "documentDate": "2025-10-15",
            "originId": "11111111-aaaa-bbbb-cccc-222222222222",
            "originDocumentType": "QUOTE",
            "status": "Draft",
            "totalLiquid": 300
          }
        },
        {
          "node": {
            "documentId": "55555555-aaaa-bbbb-cccc-666666666666",
            "documentType": "ORDER",
            "operationalNumber": "0023",
            "documentDate": "2025-10-16",
            "originId": "11111111-aaaa-bbbb-cccc-222222222222",
            "originDocumentType": "QUOTE",
            "status": "Closed",
            "totalLiquid": 600
          }
        }
      ]
    }
  }
}
graphQL Query
query ($startDate: DateTime!, $endDate: DateTime!) {
  relatedSalesDocuments(
    where: {
      documentDate: { gte: $startDate, lte: $endDate }
      originDocumentType: { eq: QUOTE }
    }
  ) {
    edges {
      node {
        originId
      }
    }
    aggregate(
      aggregateFields: ["originId|DISTINCTCOUNT"]
    ) {
      aggregates {
        value
      }
    }
  }
}
Variables
{
  "startDate": "2025-01-01",
  "endDate": "2025-12-31"
}
Example of Response
{
  "data": {
    "relatedSalesDocuments": {
      "edges": [],
      "aggregate": {
        "aggregates": [
          { "value": 12 }
        ]
      }
    }
  }
}
Key Value
Authorization Bearer Current access Token How to find?
X-TenantId Current tenant id How to find?
X-OrganizationId Current organization Id How to find?
x-api-key Primary or secondary subscription key of your app How to find?

relatedSalesDocuments

Fields Type Description
id UUID Id
creationDate DateTime Creation Date
modificationDate DateTime Modification Date
     
documentDate DateTime Document Date
documentId UUID Id of the sales document
operationalNumber String Operational number
documentType
  • QUOTE
  • NONE
  • ORDER
  • DELIVERY_NOTE
  • INVOICE
  • CREDIT_NOTE
  • ADVANCE_INVOICE
  • SALES_INVOICE_TEMPLATE
Type of sales document
status String
  • Pending
  • Closed
  • Declined
  • Posted
  • PartiallyCollected
  • Collected
totalLiquid Decimal Total liquid amount
originId UUID Id of the origin sales document
originDocumentType
  • QUOTE
  • NONE
  • ORDER
  • DELIVERY_NOTE
  • INVOICE
  • CREDIT_NOTE
  • ADVANCE_INVOICE
  • SALES_INVOICE_TEMPLATE
Type of the origin sales document
Info
  • documentType: The value is an enum. Typical examples include: QUOTE, ORDER, INVOICE, etc.

  • status: Current state of the related document

    • Pending: The document is in progress and can be modified.
    • Closed: The document can no longer be modified.
    • Declined: The quote is declined and can no longer be modified.
    • Posted: (Awaiting collection) The invoice can no longer be modified; it has been transferred to accounting.
    • PartiallyCollected: (Partially collected) The invoice is partially settled. Payments are pending.
    • Collected: (Collected) The invoice is fully settled.
  • originId: stores the identifier of the related sales document.
  • originDocumentType: is an enum indicating the type of the origin sales document (for example, QUOTE if the document originated from a quote).