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
Authorizationheader - 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 |
|---|---|---|---|
parentGuid | string (GUID) | One of these two | GUID of the parent entity — works for any entity type (shipment, carrier, client, claim, etc.). Takes priority over dmLoadNumber if both are supplied. |
dmLoadNumber | string | One of these two | DM 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 |
|---|---|---|---|
file | File | Yes | The file to upload. Extension is read from the filename and stored with the document record. |
name | string | Yes | Display name for the document as stored in the system. |
categoryType | string | Yes | Must exactly match a value in System_DocumentCategoryTypes. Use the /categories?usage={n} endpoint to get valid values for the current entity type. |
subject | string | No | Optional subject line. Auto-generated from category + current date if omitted. |
description | string | No | Optional 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 |
|---|---|
| 400 | Missing or empty file |
| 400 | Neither parentGuid nor dmLoadNumber supplied |
| 400 | Missing name or categoryType |
| 400 | parentGuid is not a valid GUID format |
| 400 | categoryType does not match any value in System_DocumentCategoryTypes |
| 404 | No shipment found for the provided dmLoadNumber |
| 500 | Unexpected error during file save |
How It Works
-
Validation — The service checks that all required fields are present,
that at least one parent identifier is supplied, and that
categoryTypeexists in the lookup table. -
Parent resolution — If
parentGuidis supplied it is used directly. If onlydmLoadNumberis supplied, the service looks up the matching shipment and uses its GUID. If no shipment is found, a 404 is returned. -
Document creation — A new document record is created in mode
UploadNew. Version 1 is created alongside the main record. -
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). -
Response — On success, the new document GUID is returned in
DocumentGuid. Keep this if you need to callupdate-metadatalater.
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.