1. U4 ERPx
  2. API Reference
  3. Common
  4. Document Archive

Document Archive

The Document Archive API manages all aspects of document archive data, including creation, update, validation, and soft deletion (termination). It enables external systems to store, retrieve, and manage documents with metadata, indexes, and thumbnails across the ERPx platform.

Purpose:
The ERPx API manages document archive, supporting create, read, update, and delete (CRUD) operations.

Base URL:
/v1/documents

Authentication:
All APIs require a Client ID and Client Secret.
Refer to the global authentication documentation for details.

System Parameters:
System parameters for this API are available in Online Help → Document Management → Document Archive → Fixed Registers → System Parameters.    

Supported Methods

HTTP MethodEndpointDescriptionLimits & Notes
POST/v1/documentsCreate a single document recordOnly 1 document per call. FileContent must be in base64.
GET/v1/documentsRetrieve multiple documentsReturns array of documents. Supports pagination and filtering.
GET/v1/documents/{id}Retrieve single document dataReturns complete document information including base64 content. One document per call.
GET/v1/documents/{id}/thumbnailRetrieve document thumbnailReturns thumbnail image. Supports custom width/height parameters.
PATCH/v1/documents/{id}Update document dataOne document per call. Cannot update: FileName, FileContent, MimeType, Status, DocSize, Id, RevisionNo.
DELETE/v1/documents/{id}Terminate (soft-delete) a documentChanges status to ‘T’ (terminated). Does not permanently delete.

   

Swagger / Schema

Version v1

   

Method Details

Sample Request

{
  "companyId": "EN",
  "docType": "INVOICE",
  "title": "Invoice Q1 2025",
  "fileName": "invoice_q1.pdf",
  "fileContent": "JVBERi0xLjQKJeLjz9MKMSAwIG9iago8PC9UeXBl...",
  "mimeType": "application/pdf",
  "indexes": [
    {
      "indexType": "COMPANY",
      "indexValue": "EN"
    },
    {
      "indexType": "PERIOD",
      "indexValue": "202501"
    }
  ]
}
{
  "companyId": "EN",
  "docType": "CONTRACT",
  "title": "Service Agreement 2025",
  "fileName": "contract_2025.pdf",
  "fileContent": "JVBERi0xLjQKJeLjz9MKMSAwIG9iago8PC9UeXBl...",
  "mimeType": "application/pdf",
  "expiryDate": "2026-12-31T00:00:00.000Z",
  "description": "Annual service contract",
  "indexes": [
    {
      "indexType": "CUSTOMER",
      "indexValue": "CUST001"
    }
  ]
}

   

Limits & Notes

  • Mandatory fields: fileName, docType, fileContent, title
  • FileContent must be in base64 format - non-base64 content will be rejected
  • companyId is optional - if not provided, user’s default company is used
  • documentType must be a valid attribute value for the given client
  • indexes must have valid values for each index type configured for the document type
  • Client-supplied values ignored: docSize (calculated by API), revisionNo (set to 1), status (set to ‘N’), id (auto-generated GUID)
  • ExpiryDate validation: Must be today or in the future. If document type has expiry enabled and not provided, calculated by system
  • All indexes required: If document type requires 3 indexes, all 3 must be provided with valid values

   

Validation Rules for POST Method

POST_001 - User is not authorised
ElementDetails
Scenario IDPOST_001
Scenario NameUser is not authorised
HTTP Code403
GIVENA new document needs to be created
WHENCalling the POST method of the API
BUTUser does NOT have permissions
THENAPI is not reached; 403 Forbidden response is returned
Example Error Message“User is not authorised.”
POST_002 - Unknown companyID
ElementDetails
Scenario IDPOST_002
Scenario NameUnknown companyID
HTTP Code403
GIVENA new document needs to be created
WHENCalling the POST method of the API
BUTcompanyID does not exist
THENAPI is not reached; 403 Forbidden response is returned
Example Error Message“User is not authorised.”
POST_003 - Document is created
ElementDetails
Scenario IDPOST_003
Scenario NameDocument is created
HTTP Code201
GIVENA new document needs to be created
WHENCalling the POST method of the API
BUT
THENA new document is created
Example Error MessageRESPONSE: returns the created document
POST_004 - Client-supplied docSize is ignored
ElementDetails
Scenario IDPOST_004
Scenario NameClient-supplied docSize is ignored
HTTP Code201
GIVENA new document needs to be created with posted docSize
WHENCalling the POST method of the API with “docSize”:100
BUTdocSize is ignored and calculated by the API
THENDocument is created with system-calculated docSize
Example Error MessageRESPONSE: returns the created document with calculated docSize
POST_005 - Client-supplied revisionNo is ignored
ElementDetails
Scenario IDPOST_005
Scenario NameClient-supplied revisionNo is ignored
HTTP Code201
GIVENA new document needs to be created with posted revisionNo
WHENCalling the POST method of the API with revisionNo:5
BUTrevisionNo is ignored and set as 1 by the API
THENDocument is created with revisionNo = 1
Example Error MessageRESPONSE: returns the created document with revisionNo = 1
POST_006 - Client-supplied status is ignored
ElementDetails
Scenario IDPOST_006
Scenario NameClient-supplied status is ignored
HTTP Code201
GIVENA new document needs to be created with posted status
WHENCalling the POST method of the API with status:C
BUTstatus is ignored and set as N by the API
THENDocument is created with status = ‘N’
Example Error MessageRESPONSE: returns the created document with status = ‘N’
POST_007 - Client-supplied id (GUID) is ignored
ElementDetails
Scenario IDPOST_007
Scenario NameClient-supplied id (GUID) is ignored
HTTP Code201
GIVENA new document needs to be created with posted id
WHENCalling the POST method of the API with “id”: “81891c64-1cb0-4d40-9f6f-083fc8084fd0”
BUTID is ignored and new ID is created
THENDocument is created with system-generated GUID
Example Error MessageRESPONSE: returns the created document with new GUID
POST_008 - Missing required field – fileName
ElementDetails
Scenario IDPOST_008
Scenario NameMissing required field – fileName
HTTP Code400
GIVENA new document needs to be created
WHENCalling the POST method of the API
BUTfileName is missing or empty
THENDocument is not created; 400 response is returned
Example Error Message{"code": 1010, "message": "The FileName field is required.\n"}
POST_009 - Missing required field – docType
ElementDetails
Scenario IDPOST_009
Scenario NameMissing required field – docType
HTTP Code400
GIVENA new document needs to be created
WHENCalling the POST method of the API
BUTDocType is missing or empty
THENDocument is not created; 400 response is returned
Example Error Message{"code": 1010, "message": "The DocType field is required.\n"}
POST_010 - Missing companyId uses default
ElementDetails
Scenario IDPOST_010
Scenario NameMissing companyId uses default
HTTP Code201
GIVENA new document needs to be created
WHENCalling the POST method of the API
BUTcompanyID is missing
THENDocument is created with user’s default companyID
Example Error MessageRESPONSE: returns the created document with default companyId
POST_011 - Missing required field – fileContent
ElementDetails
Scenario IDPOST_011
Scenario NameMissing required field – fileContent
HTTP Code400
GIVENA new document needs to be created
WHENCalling the POST method of the API
BUTfileContent is missing or empty
THENDocument is not created; 400 response is returned
Example Error Message{"code": 1010, "message": "The FileContent field is required.\n"}
POST_012 - fileContent is not in base64
ElementDetails
Scenario IDPOST_012
Scenario NamefileContent is not in base64
HTTP Code400
GIVENA new document needs to be created
WHENCalling the POST method of the API
BUTfileContent is not in base64 format
THENDocument is not created; 400 response is returned
Example Error Message{"message": "The file content is not base64-encoded.", "messageType": "Information", "code": null, "path": null}
POST_013 - Index is not a valid value
ElementDetails
Scenario IDPOST_013
Scenario NameIndex is not a valid value
HTTP Code400
GIVENA new document needs to be created
WHENCalling the POST method of the API
BUTOne of the indexes has an invalid value
THENDocument is not created; 400 response is returned
Example Error Message"notificationMessages": {"indexes": [{"code": 3010, "message": "Entered company 'TTT' does not exist"}]}
POST_014 - Index is empty or missing
ElementDetails
Scenario IDPOST_014
Scenario NameIndex is empty or missing
HTTP Code400
GIVENA new document needs to be created
WHENCalling the POST method of the API
BUTOne of the indexes is empty or missing
THENDocument is not created; 400 response is returned
Example Error Message{"code": 1010, "message": "The IndexValue field is required.\n"}
POST_015 - One of the required indexes is not passed
ElementDetails
Scenario IDPOST_015
Scenario NameOne of the required indexes is not passed
HTTP Code400
GIVENA new document needs to be created
WHENCalling the POST method of the API
BUTDocument type requires 3 indexes but the last one was not provided
THENDocument is not created; 400 response is returned
Example Error Message"notificationMessages": {"indexes": [{"code": 3010, "message": "You must enter a value for Resource"}]}
POST_016 - Missing required field – title
ElementDetails
Scenario IDPOST_016
Scenario NameMissing required field – title
HTTP Code400
GIVENA new document needs to be created
WHENCalling the POST method of the API
BUTtitle is missing or empty
THENDocument is not created; 400 response is returned
Example Error Message{"code": 1010, "message": "The Title field is required.\n"}
POST_017 - ExpiryDate before today → reject
ElementDetails
Scenario IDPOST_017
Scenario NameExpiryDate before today → reject
HTTP Code400
GIVENA new document needs to be created
WHENCalling the POST method of the API with ExpiryDate in the past
BUTExpiryDate is before today
THENDocument is not created; 400 response is returned
Example Error Message"notificationMessages": {"expiryDate": [{"code": 3010, "message": "The date in this field must be after {today}"}]}
POST_018 - ExpiryDate equals today → accept
ElementDetails
Scenario IDPOST_018
Scenario NameExpiryDate equals today → accept
HTTP Code201
GIVENA new document needs to be created
WHENCalling the POST method of the API with ExpiryDate = today
BUT
THENDocument is created
Example Error MessageRESPONSE: returns the created document
POST_019 - ExpiryDate in the future → accept
ElementDetails
Scenario IDPOST_019
Scenario NameExpiryDate in the future → accept
HTTP Code201
GIVENA new document needs to be created
WHENCalling the POST method of the API with ExpiryDate in the future
BUT
THENDocument is created
Example Error MessageRESPONSE: returns the created document
POST_020 - ExpiryDate not passed with expiry enabled
ElementDetails
Scenario IDPOST_020
Scenario NameExpiryDate not passed but document type has expiry date enabled
HTTP Code201
GIVENA new document needs to be created
WHENCalling the POST method of the API without expiryDate
BUTDocument type has expiry date enabled
THENDocument is created and expiry date is calculated by the system
Example Error MessageRESPONSE: returns the created document with system-calculated expiryDate
POST_021 - ExpiryDate passed with expiry enabled
ElementDetails
Scenario IDPOST_021
Scenario NameExpiryDate passed and document type has expiry date enabled
HTTP Code201
GIVENA new document needs to be created
WHENCalling the POST method of the API with expiryDate
BUTDocument type has expiry date enabled
THENDocument is created and expiry date from payload is used
Example Error MessageRESPONSE: returns the created document with provided expiryDate

   

Sample Request

GET /v1/documents/6cf38e81-07d3-4a72-ae16-032eb29a3a09?companyId=EN

   

Sample Response

{
  "id": "6cf38e81-07d3-4a72-ae16-032eb29a3a09",
  "companyId": "EN",
  "docType": "INVOICE",
  "title": "Invoice Q1 2025",
  "description": "Quarterly invoice for services",
  "fileName": "invoice_q1.pdf",
  "fileContent": "JVBERi0xLjQKJeLjz9MKMSAwIG9iago8PC9UeXBl...",
  "mimeType": "application/pdf",
  "docSize": 245678,
  "status": "N",
  "revisionNo": 1,
  "createdDate": "2025-11-25T10:30:00.000Z",
  "createdBy": "USER001",
  "indexes": [
    {
      "indexType": "COMPANY",
      "indexValue": "EN"
    },
    {
      "indexType": "PERIOD",
      "indexValue": "202501"
    }
  ]
}

   

Additional Parameters

ParameterValueDescriptionData TypeDefault Value
companyIdoptionalSpecify if you wish to retrieve a document that exists in a specific company or client.stringuser’s default company

   

Limits & Notes

  • One document per call
  • documentId must be a valid GUID format (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)
  • Returns complete document including base64-encoded fileContent
  • Document must belong to specified company or 404 error is returned

   

Validation Rules for GET Method (Single)

GET_001 - User is not authorised
ElementDetails
Scenario IDGET_001
Scenario NameUser is not authorised
HTTP Code403
GIVENData from an existing document needs to be retrieved
WHENCalling the GET method of the API
BUTUser does NOT have permissions
THENAPI is not reached; 403 Forbidden response is returned
Example Error Message“User is not authorised.”
GET_002 - Unknown companyID
ElementDetails
Scenario IDGET_002
Scenario NameUnknown companyID
HTTP Code403
GIVENData from an existing document needs to be retrieved
WHENCalling the GET method of the API
BUTcompanyID does not exist
THENAPI is not reached; 403 Forbidden response is returned
Example Error Message“User is not authorised.”
GET_003 - Document is found
ElementDetails
Scenario IDGET_003
Scenario NameDocument is found
HTTP Code200
GIVENData from an existing document needs to be retrieved
WHENCalling the GET method of the API
BUT
THEN200 response is returned together with the document information
Example Error MessageRESPONSE: Document information is retrieved
GET_004 - Document is not found
ElementDetails
Scenario IDGET_004
Scenario NameDocument is not found
HTTP Code404
GIVENData from an existing document needs to be retrieved
WHENCalling the GET method of the API
BUTDocument ID does not exist for the companyId
THENDocument is not retrieved; 404 response is returned
Example Error Message{"code": 1040, "message": "Object of a following parameters [id: 6cf38e81-07d3-4a72-ae16-032eb29a3a05, companyId: EN] was not found"}
GET_005 - Document belongs to a different company
ElementDetails
Scenario IDGET_005
Scenario NameDocument belongs to a different company
HTTP Code404
GIVENData from an existing document needs to be retrieved
WHENCalling the GET method of the API
BUTDocument exists but belongs to a different company
THENDocument is not retrieved; 404 response is returned
Example Error Message{"code": 1040, "message": "Object of a following parameters [id: 6cf38e81-07d3-4a72-ae16-032eb29a3a09, companyId: NO] was not found"}
GET_006 - Invalid id (GUID) format
ElementDetails
Scenario IDGET_006
Scenario NameInvalid id (GUID) format
HTTP Code400
GIVENData from an existing document needs to be retrieved
WHENCalling the GET method of the API with malformed ID
BUTID is not a valid GUID format
THENDocument is not retrieved; 400 response is returned
Example Error Message{"message": "Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).", "messageType": "Information", "code": null, "path": null}
GET_007 - Invalid id is not in a GUID
ElementDetails
Scenario IDGET_007
Scenario NameInvalid id is not in a GUID
HTTP Code400
GIVENData from an existing document needs to be retrieved
WHENCalling the GET method of the API with /v1/documents/11
BUTID is not a GUID (e.g., simple integer)
THENDocument is not retrieved; 400 response is returned
Example Error Message{"message": "Unrecognised Guid format.", "messageType": "Information", "code": null, "path": null}

   

Sample Request

GET /v1/documents?companyId=EN
GET /v1/documents?companyId=EN&doctype=INVOICE&limit=50
GET /v1/documents?companyId=EN&title=report&start=0&limit=20
GET /v1/documents?companyId=EN&doctype=CONTRACT&indexes=EN
GET /v1/documents?companyId=EN&withFileContent=true&limit=5

Sample Response

{
  "start": 0,
  "limit": 10,
  "count": 10,
  "total": 42,
  "items": [
{
  "companyId": "EN",
  "docType": "PERSONNEL",
  "mimeType": "image/tiff",
  "id": "6cf38e81-07d3-4a72-ae16-032eb29a3a09",
  "status": "N",
  "revisionNo": 1,
  "fileName": "Copy of 00100205.tif",
  "checkoutUserId": "",
  "lastUpdate": {
    "updatedAt": "2005-10-10T12:12:00.000",
    "updatedBy": "SYSEN"
  },
  "docSize": 0,
  "indexes": [
    { "sequenceNo": 1, "indexValue": "EN" },
    { "sequenceNo": 2, "indexValue": "87010101" }
  ],
  "title": "Copy of 00100205.tif",
  "description": ""
}
  ]
}

   

Query Parameters

Retrieves documents array based on parameters.

ParameterValueDescriptionData TypeDefault Value
companyIdoptionalCompany filter. If not provided, user’s default company is used.stringuser’s default
doctypeoptionalDocument type filter. Must be a valid attribute value.stringnone
titleoptionalTitle prefix filter (case-insensitive). Max 3998 characters. Matches documents whose titles start with this value.stringnone
indexesoptionalIndexes filter. Values concatenated and split by semicolon (;). Must match in exact order. Case-insensitive.stringnone
startoptionalZero-based offset for pagination.integer0
limitoptionalPage size. Must be between 0 and 50000.integer10
withFileContentoptionalInclude base64 file content for each document.booleanfalse

   

Limits & Notes

  • Returns array of document objects
  • Pagination envelope always includes: start, limit, count (items on this page), total (matching query)
  • doctype must be a valid attribute value configured in the system
  • Title matching: Prefix only (starts with), case-insensitive, no wildcards, spaces NOT trimmed
  • Indexes matching: Semicolon-separated (;), must be in exact order, case-insensitive, spaces NOT trimmed, empty segments treated as required empty values
  • Maximum limit: 50000 records per request
  • withFileContent impacts performance - use only when file content is needed

   

Validation Rules for GET Method (Multiple)

GET_001 - User is not authorised
ElementDetails
Scenario IDGET_001
Scenario NameUser is not authorised
HTTP Code403
GIVENMultiple documents need to be retrieved
WHENCalling the GET method of the API
BUTUser does NOT have permissions
THENAPI is not reached; 403 Forbidden response is returned
Example Error Message“User is not authorised”
GET_002 - Unknown companyID
ElementDetails
Scenario IDGET_002
Scenario NameUnknown companyID
HTTP Code403
GIVENMultiple documents need to be retrieved
WHENCalling the GET method of the API
BUTcompanyID does not exist
THENAPI is not reached; 403 Forbidden response is returned
Example Error Message“User is not authorised”