DM Web Services Documentation

UploadDocument

Uploads a new document and links it to any supported parent entity (shipment, carrier, client, claim, etc.). Accepts multipart/form-data — not JSON.


Function Overview

  • Purpose: Upload a file and create a new document record linked to a parent entity.
  • REST Endpoint: POST /api/public/v1/documents/upload
  • Content-Type: multipart/form-data
  • Authentication: Required — Bearer token in Authorization header
  • SOAP: Not available for this endpoint

REST Interface

Headers

Content-Type: multipart/form-data
Authorization: Bearer <token>

Parent Entity Linking — supply ONE of:

Field Type Required Notes
parentGuidstring (GUID)One of these twoGUID of the parent entity — works for any entity type (shipment, carrier, client, claim, etc.). Takes priority over dmLoadNumber if both are supplied.
dmLoadNumberstringOne 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

Field Type Required Notes
fileFileYesThe file to upload. Extension is read from the filename and stored with the document record.
namestringYesDisplay name for the document as stored in the system.
categoryTypestringYesMust exactly match a value in System_DocumentCategoryTypes. Use the /categories?usage={n} endpoint to get valid values for the current entity type.
subjectstringNoOptional subject line. Auto-generated from category + current date if omitted.
descriptionstringNoOptional description. Auto-generated from category + parent entity if omitted.

Example — cURL (by DM Load Number)

curl -X POST https://<host>/api/public/v1/documents/upload \
  -H "Authorization: Bearer <token>" \
  -F "file=@/path/to/bol.pdf" \
  -F "dmLoadNumber=4363968" \
  -F "name=Bill of Lading - Shipment 4363968" \
  -F "categoryType=Bill Of Lading" \
  -F "subject=BOL 2026-04-13" \
  -F "description=BOL for DM Load 4363968"

Example — cURL (by Parent GUID)

curl -X POST https://<host>/api/public/v1/documents/upload \
  -H "Authorization: Bearer <token>" \
  -F "file=@/path/to/contract.pdf" \
  -F "parentGuid=a1b2c3d4-e5f6-7890-abcd-ef1234567890" \
  -F "name=Carrier Contract 2026" \
  -F "categoryType=Other"

Success Response (200)

{
  "Status": "OK",
  "DocumentGuid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}

The DocumentGuid field contains the GUID of the newly created document record. Store this if you need to update or reference the document later via update-metadata.

Error Responses

Status Cause
400Missing or empty file
400Neither parentGuid nor dmLoadNumber supplied
400Missing name or categoryType
400parentGuid is not a valid GUID format
400categoryType does not match any value in System_DocumentCategoryTypes
404No shipment found for the provided dmLoadNumber
500Unexpected error during file save

How It Works

  1. Validation — The service checks that all required fields are present, that at least one parent identifier is supplied, and that categoryType exists in the lookup table.
  2. Parent resolution — If parentGuid is supplied it is used directly. If only dmLoadNumber is supplied, the service looks up the matching shipment and uses its GUID. If no shipment is found, a 404 is returned.
  3. Document creation — A new document record is created in mode UploadNew. Version 1 is created alongside the main record.
  4. File save — The file bytes are written to storage via the document file management layer. The file extension is stored in uppercase without a leading period (e.g. PDF, DOCX).
  5. Response — On success, the new document GUID is returned in DocumentGuid. Keep this if you need to call update-metadata later.

Note on subject/description: If omitted, these are auto-generated from the category type and parent entity context. Providing your own values makes documents easier to identify in the admin UI.


Getting Valid Category Values

Rather than hardcoding category names, use the /categories endpoint to retrieve the valid values for the entity type you are uploading against:

GET /api/public/v1/documents/categories?usage=1   # Shipment categories
GET /api/public/v1/documents/categories?usage=2   # Claim categories
GET /api/public/v1/documents/categories?usage=3   # Client categories
GET /api/public/v1/documents/categories?usage=4   # Carrier categories

Usage 0 categories (Confidential, Other) are always included in every response regardless of the usage value supplied.


Related Resources