Workflow Items
Workflow items are the live records that move through a workflow definition. This guide covers the main endpoints used to create, retrieve, update, transition, roll back, and query those items.
Base Endpoint
All workflow item endpoints are located at:
/tenant/{tenantId}/v1/Workflows/{workflowDefinitionId}/Items
Creating a Workflow Item
Use POST /tenant/{tenantId}/v1/Workflows/{workflowDefinitionId}/Items to create a new item.
POST /tenant/{tenantId}/v1/Workflows/sample-registration/Items
Authorization: Bearer {token}
Content-Type: application/json
{
"fields": {
"sampleId": "SAMPLE-1001",
"sampleType": "Food",
"receivedDate": null
}
}
Successful creation returns 201 Created with a response containing the new item ID.
Listing Workflow Items
Use GET /tenant/{tenantId}/v1/Workflows/{workflowDefinitionId}/Items to retrieve a paginated list of items.
Pagination and Sorting
pageNumber: Default1pageSize: Default20, maximum100sortField: Supports a single field or a comma-separated listsortOrder:ASCorDESC, also supports comma-separated values
GET /tenant/{tenantId}/v1/Workflows/sample-registration/Items?pageNumber=1&pageSize=20&sortField=updatedAt&sortOrder=DESC
Authorization: Bearer {token}
Filtering
The filter query parameter accepts a URL-encoded JSON object. This lets you filter on stage and field values.
GET /tenant/{tenantId}/v1/Workflows/sample-registration/Items?filter=%7B%22currentStage%22%3A%22pending%22%2C%22sampleType%22%3A%22Food%22%7D
Authorization: Bearer {token}
Decoded, the filter above is:
{
"currentStage": "pending",
"sampleType": "Food"
}
The service also supports richer filter expressions, including:
- Exact matches
- Multiple
currentStagevalues - Boolean combinations with
$andand$or - Comparison operators such as
$gt,$gte,$lt,$lte - Case-insensitive substring matching with
$contains
Retrieving a Single Item
Use GET /tenant/{tenantId}/v1/Workflows/{workflowDefinitionId}/Items/{id} to fetch an item by ID.
GET /tenant/{tenantId}/v1/Workflows/sample-registration/Items/{id}
Authorization: Bearer {token}
Updating Item Fields
Use PUT /tenant/{tenantId}/v1/Workflows/{workflowDefinitionId}/Items/{id}/fields to update fields without changing stage.
PUT /tenant/{tenantId}/v1/Workflows/sample-registration/Items/{id}/fields
Authorization: Bearer {token}
Content-Type: application/json
{
"fields": {
"receivedDate": "2026-04-02T10:30:00Z",
"notes": "Received in good condition"
}
}
Update Modes
For complex fields, you can optionally control how updates are applied:
- Arrays can usually be appended to or replaced
- Objects can usually be merged or replaced
PUT /tenant/{tenantId}/v1/Workflows/sample-registration/Items/{id}/fields
Authorization: Bearer {token}
Content-Type: application/json
{
"fields": {
"measurements": [
{ "name": "temperature", "value": "5C" }
]
},
"updateModes": {
"measurements": "replace"
}
}
Transitioning an Item
Use POST /tenant/{tenantId}/v1/Workflows/{workflowDefinitionId}/Items/{id}/transition to move an item to its next stage.
POST /tenant/{tenantId}/v1/Workflows/sample-registration/Items/{id}/transition
Authorization: Bearer {token}
Content-Type: application/json
{
"transitionId": "pending-to-received",
"fields": {
"receivedDate": "2026-04-02T10:30:00Z"
},
"reason": "Sample received by operations"
}
Rolling Back an Item
Use POST /tenant/{tenantId}/v1/Workflows/{workflowDefinitionId}/Items/{id}/rollback to move an item back to an earlier state when your process allows it.
You can target either a stage or a specific history entry.
POST /tenant/{tenantId}/v1/Workflows/sample-registration/Items/{id}/rollback
Authorization: Bearer {token}
Content-Type: application/json
{
"targetStage": "pending"
}
{
"targetHistoryId": "history-entry-id"
}
Getting Item History
Use GET /tenant/{tenantId}/v1/Workflows/{workflowDefinitionId}/Items/{id}/history to retrieve the item’s transition history.
GET /tenant/{tenantId}/v1/Workflows/sample-registration/Items/{id}/history
Authorization: Bearer {token}
Delta Change Endpoints
Administrative users can also inspect detailed change deltas for a workflow item:
GET /tenant/{tenantId}/v1/Workflows/{workflowDefinitionId}/Items/{id}/deltasGET /tenant/{tenantId}/v1/Workflows/{workflowDefinitionId}/Items/{id}/deltas/{deltaId}
These endpoints are useful for audit-style experiences and advanced diagnostics.
Bulk Operations
Use POST /tenant/{tenantId}/v1/Workflows/{workflowDefinitionId}/Items/bulk to submit multiple inserts, updates, transitions, and deletes in one request.
POST /tenant/{tenantId}/v1/Workflows/sample-registration/Items/bulk
Authorization: Bearer {token}
Content-Type: application/json
{
"operations": [
{
"fields": {
"sampleId": "SAMPLE-2001",
"sampleType": "Water"
}
},
{
"id": "existing-item-id",
"fields": {
"sampleType": "Food"
},
"transitionId": "pending-to-received",
"transitionReason": "Bulk receive"
}
],
"deletes": [
{
"id": "item-to-delete"
}
]
}
The response returns per-operation results along with total, successful, and failed counts.
Grouped Queries
Use GET /tenant/{tenantId}/v1/Workflows/{workflowDefinitionId}/Items/grouped when you want grouped counts instead of individual items.
The filter query parameter must include a groupBy array.
GET /tenant/{tenantId}/v1/Workflows/sample-registration/Items/grouped?filter=%7B%22groupBy%22%3A%5B%22currentStage%22%5D%7D
Authorization: Bearer {token}
Decoded:
{
"groupBy": ["currentStage"]
}
This endpoint is useful for summary widgets, dashboards, and reporting views.
Typical Status Codes
200 OKfor reads, updates, transitions, rollback, and successful bulk requests201 Createdwhen a new workflow item is created400 Bad Requestwhen validation fails or the filter format is invalid401 Unauthorizedwhen authentication is missing or invalid403 Forbiddenwhen the caller does not have permission for the requested operation404 Not Foundwhen the workflow definition, item, or related resource does not exist422 Unprocessable Entitywhen a bulk request is valid but all submitted operations fail business validation
📚 API Documentation: Visit
https://workflow.agglestone.com/swaggerfor full schemas and optional properties.