Skip to main content

Get order documents

note

The id in these examples is a placeholder — use a real one from the orders query.

Use order query to retrieve the documents of an order: the accounting documents (accountingDocuments, with the latest one also in fiscalDocument) and, on each shipping, the proforma and the shipping labels. The fields are documented on the Order and Shipping object references.

The url values are temporary signed download links: fetch the file when you need it instead of storing the URL. An order that has just been imported has no documents yet: until it is invoiced and its shippings are booked, fiscalDocument and proforma are null and accountingDocuments and labels are empty lists.

OMS can also notify your integration when a fiscal document or a shipping label is issued: see the AccountingSaleDocument / issued and ShippingLabel / issued webhook events.

Get all the order documents

Response
{
  "data": {
    "order": {
      "id": "12345",
      "number": "36351",
      "fiscalDocument": {
        "id": "902",
        "number": "INV-2026-001",
        "url": "https://documents.example.test/invoice.pdf",
        "createdAt": "2026-02-10T10:05:00.000Z",
        "fileName": "INV-2026-001.pdf",
        "description": "Invoice"
      },
      "accountingDocuments": [
        {
          "id": "901",
          "number": "RCP-2026-001",
          "url": "https://documents.example.test/receipt.pdf",
          "createdAt": "2026-02-10T10:00:00.000Z",
          "fileName": "RCP-2026-001.pdf",
          "description": "Receipt"
        },
        {
          "id": "902",
          "number": "INV-2026-001",
          "url": "https://documents.example.test/invoice.pdf",
          "createdAt": "2026-02-10T10:05:00.000Z",
          "fileName": "INV-2026-001.pdf",
          "description": "Invoice"
        }
      ],
      "shippings": [
        {
          "id": "789",
          "proforma": {
            "id": "903",
            "number": "PRO-2026-001",
            "url": "https://documents.example.test/proforma.pdf",
            "createdAt": "2026-02-10T10:10:00.000Z",
            "fileName": "PRO-2026-001.pdf"
          },
          "labels": [
            {
              "id": "904",
              "number": "LBL-2026-001",
              "url": "https://documents.example.test/label.pdf",
              "createdAt": "2026-02-10T10:15:00.000Z",
              "fileName": "LBL-2026-001.pdf"
            }
          ]
        }
      ]
    }
  },
  "extensions": {
    "queryComplexity": 31,
    "bucketBalance": 9969,
    "bucketRestoreRate": 100
  }
}

Get the latest invoice and the shipping labels

Use the same order query when the integration only needs the current invoice and the labels to print, for example a warehouse fulfilling the order. labels carries one label (waybill) per parcel: a multi-parcel shipping has multiple labels.

Request
query orderInvoiceAndLabels {
  order(id: "12345") {
    id
    number
    fiscalDocument {
      id
      number
      url
      fileName
    }
    shippings {
      id
      labels {
        id
        number
        url
        fileName
      }
    }
  }
}
Response
{
  "data": {
    "order": {
      "id": "12345",
      "number": "36351",
      "fiscalDocument": {
        "id": "902",
        "number": "INV-2026-001",
        "url": "https://documents.example.test/invoice.pdf",
        "fileName": "INV-2026-001.pdf"
      },
      "shippings": [
        {
          "id": "789",
          "labels": [
            {
              "id": "904",
              "number": "LBL-2026-001",
              "url": "https://documents.example.test/label.pdf",
              "fileName": "LBL-2026-001.pdf"
            }
          ]
        }
      ]
    }
  },
  "extensions": {
    "queryComplexity": 15,
    "bucketBalance": 9985,
    "bucketRestoreRate": 100
  }
}

Relevant permissions

The operations in this page require the following permissions on the API credentials — they are configured for you by Calicantus.

  • order:query:order
  • order:read
  • shipping:read
  • accounting_document:read
  • accounting_proforma:read
  • shipping_label:read