DM Web Services Documentation

Documents Service

The Documents Service handles document retrieval, upload, update, and deletion via the REST interface. All authenticated endpoints require a Bearer token in the Authorization header.


Endpoint Reference — REST V1

Method Path Auth Body Description
GET/api/public/v1/documents/pingNo—Connectivity check
GET/api/public/v1/documents/healthNo—Service health status
GET/api/public/v1/documents/versionNo—Service version string
GET/api/public/v1/documents/categories?usage={n}Yes—Returns document categories valid for the given entity type (see below)
POST/api/public/v1/documents/get-documentsYesJSONReturns document version metadata for matching documents (no file bytes)
GET/api/public/v1/documents/get-original-document/{versionGuid}Yes—Returns a DownloadUrl for the raw file of a specific document version
GET/api/public/v1/documents/stream/{versionGuid}Yes—Streams the raw file bytes directly to the caller — no disk write, no URL redirect. Preferred for browser viewing or downloading.
POST/api/public/v1/documents/get-original-documentYesJSONReturns a DownloadUrl for the most recently changed file matching the request
POST/api/public/v1/documents/get-all-documentsYesJSONMerges all matching documents into a single PDF and returns a DownloadUrl
POST/api/public/v1/documents/uploadYesmultipart/form-dataUploads a new document and links it to a parent entity
POST/api/public/v1/documents/update-metadataYesmultipart/form-dataSaves a new version of an existing document and updates its metadata

Document Categories

Categories are loaded from System_DocumentCategoryTypes and are filtered by entity type using the usage query parameter. Always pass the usage value that matches the context in which the upload button appears — the correct value is always known from screen context.

usage value Entity type
1Shipment
2Claim
3Client
4Carrier

Example: GET /api/public/v1/documents/categories?usage=1 returns the categories valid for a Shipment.


Search Fields — get-documents, get-original-document (POST), get-all-documents

These three POST endpoints share the same search field set. Each uses a typed request object (GetDocumentsRequest, GetOriginalDocumentRequest, GetAllDocumentsRequest) but the available search fields are the same. Supply exactly one search strategy per request.

Field Type Priority Notes
DMLoadNumberstring1 — highestMost direct identifier. Wins over all other fields if present.
InvoiceNumberstring2Used if DMLoadNumber is absent.
InvoiceFromDate + InvoiceToDate + ClientReferenceDateOnly? / string3All three are required together for a date range search.
DocumentIDstring (GUID)4 — lowestReturns results for a single specific document.

If no usable search criteria are supplied, the service returns HTTP 400 InvalidRequest.


File Retrieval — DownloadUrl Response Pattern

The three file-returning endpoints (get-all-documents, get-original-document POST, and get-original-document/{versionGuid} GET) do not stream file bytes directly. Instead they:

  1. Retrieve or generate the file
  2. Write it to the server's configured document storage folder (RootPathDocuments in System_Properties)
  3. Return a JSON response whose DownloadUrl is a publicly accessible HTTPS URL

Example Response

{
  "Status": "OK",
  "Message": "Document ready for download.",
  "DownloadUrl": "https://easyfreight.nebulasuite.net/documents/DMLOAD_4363968_042226101901828.pdf"
}

File Naming Pattern

Search typeFile name prefix
DM Load NumberDMLOAD_{number}_{timestamp}
Invoice NumberINVOICE_{number}_{timestamp}
Version GUID (GET endpoint){documentName}_{versionGuid}_{timestamp}

The timestamp suffix ensures uniqueness when the same request is made multiple times in rapid succession. Filenames are sanitized — any character that is not alphanumeric, a hyphen, or an underscore is replaced with an underscore.

Infrastructure note: The file write requires that the IIS application pool identity has write access to the RootPathDocuments UNC path in System_Properties. If write access is missing, the endpoint returns an Error status with the attempted path in the message. The DownloadUrl always uses the public-facing URL from RootPathOnlineDocuments — the UNC path is only used internally for the write.

get-all-documents — Merge Behaviour

Retrieves all documents matching the request, converts non-PDF files to PDF, merges them in category order, and returns a single PDF via DownloadUrl.

Merge sort order

PriorityCategory
1Bill of Lading / BOL
2Shipping Label
3Manifest
4Weight and Measure
5Proof of Delivery / POD
6Invoice
999All other documents

Each page is stamped with the DM Load Number it belongs to — useful when a merged PDF spans multiple loads (e.g. when searching by invoice number that covers several shipments).

If a file cannot be converted to PDF (unsupported format, corrupt file, etc.), a placeholder page is inserted in its place in the merged output noting the unconvertible file. The original file is always preserved and remains downloadable via get-original-document.


Upload a Document

Accepts multipart/form-data. Uploads a new document and links it to any supported parent entity.

Parent entity linking — supply ONE of:

FieldRequiredNotes
parentGuidOne of these twoGUID of any parent entity — shipment, carrier, client, claim, etc. Takes priority over dmLoadNumber if both are supplied.
dmLoadNumberOne of these twoDM load number of a shipment. Resolved to the shipment's GUID internally. Use this as a convenience when you have the load number but not the GUID.

Document fields

FieldRequiredNotes
fileYesThe file to upload. Extension is read from the filename.
nameYesDocument name stored in the system.
categoryTypeYesMust match a value in System_DocumentCategoryTypes. Use the /categories endpoint to get valid values for the current entity type.
subjectNoAuto-generated if omitted.
descriptionNoAuto-generated if omitted.

Success Response (200)

{ "Status": "OK", "DocumentGuid": "{new-document-guid}", "VersionGuid": "{new-version-guid}" }

Use VersionGuid to immediately stream or view the uploaded file via /api/public/v1/documents/stream/{versionGuid} without a separate lookup.

Error Responses

  • 400 — Missing file, missing required fields, invalid GUID format, or unrecognised category
  • 404 — No shipment found for the provided dmLoadNumber
  • 500 — Unexpected error during save

→ Full detail: UploadDocument


Update a Document

Accepts multipart/form-data. A new file is required — updating always creates a new version. The document's parent entity link is not changed.

FieldRequiredNotes
fileYesNew version of the file.
documentIdYesGUID of the document to update. Must be a valid non-empty GUID.
categoryTypeYesMust match a value in System_DocumentCategoryTypes.
nameNoUpdated document name.
subjectNoAuto-generated if omitted.
descriptionNoAuto-generated if omitted.

Success Response (200)

{ "Status": "OK", "Message": "Document updated successfully." }

Error Responses

  • 400 — Missing file, missing or invalid documentId, or unrecognised category
  • 404 — No document found for the provided documentId
  • 500 — Unexpected error during save

Stream a Document — stream/{versionGuid}

Streams the raw file bytes for a specific document version directly to the caller. No file is written to disk — bytes are fetched from the database and returned in a single response. The browser will display the file inline (e.g. PDF in a new tab) or prompt a download for unsupported formats.

When to use this vs. get-original-document

EndpointReturnsBest for
stream/{versionGuid}File bytes directlyOpening in a browser tab, embedding in an iframe, or downloading. Faster — no disk write involved.
get-original-document/{versionGuid}JSON with DownloadUrlWhen you need a shareable public URL rather than the file bytes directly.

Tip: Use VersionGuid from upload

The upload endpoint now returns both DocumentGuid and VersionGuid on success. You can pass the VersionGuid directly to this endpoint immediately after upload without needing a separate get-documents lookup.

Error Responses

  • 404 — No active version found for the provided GUID
  • 503 — Stream endpoint not configured in System_JobEndpoints

Authentication

All authenticated endpoints require a Bearer token in the HTTP Authorization header:

Authorization: Bearer <your-token>

See the Authentication Guide for details on obtaining and using tokens.


Related Resources