Configurable Settings for Sync and Async Modes in the API

The SaveAndClose and Complete endpoints in HotDocs API v2.0  support both synchronous and asynchronous saving modes. This behavior is governed by configurable settings.

Synchronous vs Asynchronous Saving

When a client calls the SaveAndClose endpoint:

  • Synchronous saving is attempted first. If the operation completes within a configurable timeout period (SaveAndClossSessionSynchronousTimeoutMs), the API returns a 200 OK response with the current status of the work item version.
  • If the operation exceeds the timeout or a CallbackUrl is provided in the request, the operation switches to asynchronous saving.

The same logic applies to the Complete endpoint, using its respective timeout and polling settings.

If a CallbackUrl is provided in the request payload, the API always performs the save asynchronously, regardless of the timeout setting. Once the action is complete, the API sends a POST request to the provided callback URL with the final status.

Configurable Settings

The following settings control the behavior of the SaveAndClose and Complete endpoints:

Setting Name Description Default Value (in milliseconds)
SaveAndCloseSessionSynchronousTimeoutMs Maximum duration to wait for a synchronous save to complete. 20000
SaveAndCloseSessionSynchronousPollingIntervalMs Interval between polling attempts during synchronous save. 5000
CompleteSessionSynchronousTimeoutMs Maximum duration to wait for a synchronous complete. 20000
CompleteSessionSynchronousPollingIntervalMs Interval between polling attempts during synchronous complete. 5000

These settings can be configured to suit your deployment's performance and responsiveness requirements.

Response Format

The SaveAndClose endpoint returns a 200 OK response with a JSON object containing:

  • status: One of the following values:
    • "Saving" - The operation is still in progress (due to timeout or if you provide a callback URL).
    • "Saved" - The operation completed successfully.
  • statusUrl: A URL to poll for the current status of the work item version.

The Complete endpoint returns a 200 OK response with a JSON object containing:

  • status: One of the following values:
    • "Post Processing" - The operation is performing a post-assembly process.
    • "Completing" - The operation is still in progress (due to timeout or if you provide a callback URL).
    • "Completed" - The operation completed successfully.
  • statusUrl: A URL to poll for the current status of the work item version.
Example Response

{

"status": "Saving",

"statusUrl": "https://yourcallbackurl.com/workitem/status

}