Controlled Document Management

The Controlled Document Management API allows you to import documents and training assignments into the Egnyte Controlled Document Management app. Use this API to migrate existing document control systems or integrate external workflows.

Note: All endpoints require the Egnyte.controlleddocs OAuth scope.

Base URL

https://{domain}.egnyte.com/pubapi/v1/controlled-docs

Authentication

All requests require an OAuth 2.0 Bearer token in the Authorization header:

Authorization: Bearer {access_token}

See Authentication for details on obtaining a token.


Import a Document

Import a new document or a new version of an existing document into the Controlled Document Management app.

Request

POST /pubapi/v1/controlled-docs/documents/import

Permissions

  • Admin: Can import documents to all categories
  • Category Manager: Can import documents only to categories they manage

Request Body

FieldTypeRequiredDescription
docIdstringYesDocument identifier used within Controlled Document Management (e.g., SOP-1)
namestringYesName of the document (e.g., Change Management SOP)
isDraftbooleanNoWhether the document is a draft. Default: false
versionstringYesDocument version (e.g., 1.0, 1.1). Must be less than 1.0 if isDraft is true
entryIdstringYesUnique ID of the file version to import (UUID format)
responsibleDepartmentstringNoDepartment or personnel responsible for maintaining the document
effectiveFromDatestringConditionalDate the document becomes effective (YYYY-MM-DD format). Required when isDraft is false. Must not be provided when isDraft is true
effectiveToDatestringNoDate the document's effective period ends (YYYY-MM-DD format). Must not be provided when isDraft is true
approvedOnstringConditionalDate the document was approved (YYYY-MM-DD format). Required when isDraft is false. Must not be provided when isDraft is true

Example Request

curl -i -X POST "https://{domain}.egnyte.com/pubapi/v1/controlled-docs/documents/import" \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
     -d '{
  "docId": "SOP-1",
  "name": "Change Management SOP",
  "isDraft": false,
  "version": "1.0",
  "entryId": "f450227d-044c-45b5-9dbb-c1120a856b81",
  "responsibleDepartment": "Clinical",
  "effectiveFromDate": "2023-01-22",
  "effectiveToDate": "2024-01-21",
  "approvedOn": "2022-12-17"
}'

Response

201 Created

FieldTypeDescription
idstringControlled Document Management internal identifier for the imported document

Example Response

{
  "id": "f450227d-044c-45b5-9dbb-c1120a856b81"
}

Error Response

{
  "msg": "Detailed error message"
}

Import Training Assignments

Import training assignment records into the Controlled Document Management app. The system automatically calculates the training assignment status based on dueDate, completedDate, and canceledDate.

Request

POST /pubapi/v1/controlled-docs/assignments/import

Permissions

  • Admin: Can import training records for users in all categories
  • Category Manager: Can import training records for users only in categories they manage

Request Body

FieldTypeRequiredDescription
assigneeIdintegerYesID of the user assigned the training
docIdstringYesDocument ID for which training is assigned (e.g., SOP-1)
versionstringYesDocument version for which training is assigned (e.g., 1.0, 1.1)
assignedDatestringNoDate the training assignment was created (ISO-8601 format). Defaults to current date if not provided
dueDatestringYesDue date of the training assignment (YYYY-MM-DD format)
completedDatestringNoTraining assignment completion date (ISO-8601 format). Set only for completed assignments
canceledDatestringNoDate the training assignment was canceled (ISO-8601 format). Set only for canceled assignments
assignedByIdintegerNoID of the user who assigned the training. Defaults to the requesting user if not provided

Example Request

curl -i -X POST "https://{domain}.egnyte.com/pubapi/v1/controlled-docs/assignments/import" \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
     -d '{
  "assigneeId": 11,
  "docId": "SOP-1",
  "version": "1.0",
  "assignedDate": "2023-01-22T14:00:00Z",
  "dueDate": "2023-02-22",
  "completedDate": "2023-01-27T16:22:07Z",
  "assignedById": 22
}'

Response

201 Created

FieldTypeDescription
idstringControlled Document Management training assignment identifier

Example Response

{
  "id": "e250227d-044c-45b5-9dbb-c1120a856b84"
}

Error Response

{
  "msg": "Detailed error message"
}

Error Codes

StatusErrorDescriptionResolution
400Bad RequestDocument migration not enabled for this categoryEnable document migration in category settings
400Bad RequestDocument version is not the next major or minor versionEnsure version follows sequential versioning (e.g., 1.0 → 1.1 or 2.0)
400Bad RequestApproval date cannot be in the futureSet approvedOn to a past or current date
400Bad RequestApproval date cannot be after the effective on dateEnsure approvedOn is before or equal to effectiveFromDate
400Bad RequestDocument version number does not match the effective time periodAlign version number with the effective date range
400Bad RequestAssignee does not have permission to view the categoryGrant the assignee access to the category
403ForbiddenUser cannot add new documents to the categoryEnsure the user is an admin or category manager for this category
403ForbiddenCaller doesn't have permission to manage assignments for the categoryEnsure the user is an admin or category manager for this category
403ForbiddenAssignee doesn't have permissions to the documentGrant the assignee read access to the document
404Not FoundEntry ID does not existVerify the entryId corresponds to a valid file version
404Not FoundReferenced document not foundVerify the docId and version exist in the system
409ConflictDocument version already exists for this documentUse a different version number or update the existing version
409ConflictDocument identifier conflicts with an existing documentUse a unique docId or update the existing document
409ConflictOperation not allowed for an obsolete documentTraining cannot be assigned to obsolete documents

Code Examples

POST /pubapi/v1/controlled-docs/documents/import

curl -i -X POST "https://{domain}.egnyte.com/pubapi/v1/controlled-docs/documents/import" \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
     -d '{
  "docId": "SOP-1",
  "name": "Change Management SOP",
  "isDraft": false,
  "version": "1.0",
  "entryId": "f450227d-044c-45b5-9dbb-c1120a856b81",
  "responsibleDepartment": "Clinical",
  "effectiveFromDate": "2023-01-22",
  "effectiveToDate": "2024-01-21",
  "approvedOn": "2022-12-17"
}'

POST /pubapi/v1/controlled-docs/assignments/import

curl -i -X POST "https://{domain}.egnyte.com/pubapi/v1/controlled-docs/assignments/import" \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
     -d '{
  "assigneeId": 11,
  "docId": "SOP-1",
  "version": "1.0",
  "assignedDate": "2023-01-22T14:00:00Z",
  "dueDate": "2023-02-22",
  "completedDate": "2023-01-27T16:22:07Z",
  "assignedById": 22
}'
Reference →Browse all endpoints