Skip to main content

projects/{pid}/workflows/actions/cleanup (post)

Delete old completed workflows by removing source files, deliverables, and associated jobs for workflows completed before a specified cutoff date.

URL

(POST) /api/projects/{pid}/workflows/actions/cleanup

PARAMETERS

The URL parameters are:

pid

The project's ID.

int, Mandatory

The request BODY contains a JSON object with these properties:

cutoffDate

Workflows completed before this date will be cleaned up. Must be a date in the past. The date is interpreted as the start of day (00:00:00) in UTC.

datetime, Mandatory

maxWorkflows

Maximum number of workflows to cleanup in this request. Default is 100. Maximum allowed is 100. Set to 0 to use the default.

int?, Optional

callbackurl

Specify a URL which will be called upon success or failure. See Callbacks (with asynchronous operations)

string?, Optional

RESULTS

This method is an ​: Your request is queued and will execute as soon as possible.

Asynchronous operations - How to:

The API method immediately returns a JSON object that includes the ID of the operation (look for the requestId property).

However, the operation has not yet been executed. You will need to await the operation’s termination to obtain results.

Waiting can be done in two ways: Polling: Regularly check the operation’s status. Webhook Call: Wait for a callback using the callbackurl parameter in your request. We strongly recommend the latter approach. For more details, please refer to the documentation: ​

The JSON results, obtained with polling or with a callback, include the operation status as well as any results specific to the API method. Below is an example of successful termination:

JSON
{
  "trm": {
    "requestid": 13432,
    "isbatch": false,
    "status": "Finished",
    "statusText": "Finished!"
  },
  "custom": {
    "success": true,
    "workflowsDeleted": 42,
    "workflowsRemaining": 0,
    "errors": []
  }
}

The custom node contains cleanup statistics:

Property

Description

Type

success

Whether the cleanup operation completed successfully.

bool

workflowsDeleted

Number of workflows that were deleted.

int

workflowsRemaining

Number of workflows remaining that match the cleanup criteria.

int

errors

List of errors that occurred during cleanup.

string[]

EXAMPLES

Basic Request (Cleanup workflows older than 1 year)

JSON
{
  "cutoffDate": "2025-01-06T00:00:00.000Z"
}

Advanced Request (With custom limit)

JSON
{
  "cutoffDate": "2024-07-01T00:00:00.000Z",
  "maxWorkflows": 50
}

CLEANUP CRITERIA

For Standard Projects:

A workflow (document) is eligible for cleanup when ALL associated jobs meet these criteria:

  • Job status is Completed or Delivered

  • Job has an End Date set

  • Job End Date is before the cutoff date

For Codyt Projects:

A workflow (revision set) is eligible for cleanup when ALL locales meet these criteria:

  • Locale status is Finished or Delivered

  • Locale Status Update Date is before the cutoff date

WHAT IS DELETED

For each eligible workflow, the following are permanently removed:

  • Source files

  • Deliverable files

  • All associated jobs

  • Document records and segments from the project

  • Data from Elasticsearch indices

The following are preserved:

  • Supplier invoices (not deleted)

  • Business Analytics data (if already aggregated)

  • Translation memory resources (consolidated memories are unaffected)

Important: Once deleted, workflow data will no longer appear in reports or exports generated after the cleanup operation.

ERROR HANDLING

Authorization (Immediate)

User must have project manager level access rights to execute cleanup. Specifically requires the ability to edit source documents in the project. Resolution: Contact a project manager or administrator.

Invalid cutoffDate (Immediate)

The cutoff date must be a valid date in the past. Resolution: Ensure cutoffDate is before the current date and time.

Invalid maxWorkflows (Immediate)

The maxWorkflows parameter must be between 0 and 100. Resolution: Adjust maxWorkflows to fall within the allowed range.

Project not found (Immediate)

The specified project ID does not exist. Resolution: Verify the project ID is correct.

Operation failed (Delayed)

If the operation fails fatally, you get an async error payload. Resolution: Check the error message and contact Wordbee support if unclear.

Partial failures (Delayed)

Individual workflows may fail to cleanup while others succeed. Check the errors array in results. Resolution: Review specific error messages and retry if needed.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.