---
title: "Query for historic task instances"
method: POST
path: "/cmmn-query/historic-task-instances"
tags: ["History Task", "Query"]
---

# Query for historic task instances

`POST /cmmn-query/historic-task-instances`

## Request

- Base URL: `https://developer-docs.flowable.com/cmmn-api`
- URL: `https://developer-docs.flowable.com/cmmn-api/cmmn-query/historic-task-instances`
- Auth: HTTP basic
- TypeScript: <https://skmtc.dev/flowable/apis/flowable-cmmn-rest-api/docs/cmmn-query/historic-task-instances/post.ts> (a function with typed inputs; its response is checked against the schema)

All supported JSON parameter fields allowed are exactly the same as the parameters found for getting a collection of historic task instances, but passed in as JSON-body arguments rather than URL-parameters to allow for more advanced querying and preventing errors with request-uri’s that are too long. On top of that, the query allows for filtering based on process variables. The taskVariables and processVariables properties are JSON-arrays containing objects with the format as described here.

## Request body

- HistoricTaskInstanceQueryRequest
  - `start` integer
  - `size` integer
  - `sort` string
  - `order` string
  - `taskId` string
  - `caseInstanceId` string
  - `caseInstanceIdWithChildren` string
  - `caseDefinitionId` string
  - `caseDefinitionKey` string
  - `caseDefinitionKeyLike` string
  - `caseDefinitionKeyLikeIgnoreCase` string
  - `caseDefinitionKeys` string[]
  - `planItemInstanceId` string
  - `propagatedStageInstanceId` string
  - `scopeId` string
  - `scopeIds` string[]
  - `withoutScopeId` boolean
  - `taskName` string
  - `taskNameLike` string
  - `taskNameLikeIgnoreCase` string
  - `taskDescription` string
  - `taskDescriptionLike` string
  - `taskDefinitionKey` string
  - `taskDefinitionKeyLike` string
  - `taskCategory` string
  - `taskCategoryIn` string[]
  - `taskCategoryNotIn` string[]
  - `taskWithoutCategory` boolean
  - `taskDeleteReason` string
  - `taskDeleteReasonLike` string
  - `taskAssignee` string
  - `taskAssigneeLike` string
  - `taskOwner` string
  - `taskOwnerLike` string
  - `taskInvolvedUser` string
  - `taskPriority` integer
  - `taskMinPriority` integer
  - `taskMaxPriority` integer
  - `finished` boolean
  - `processFinished` boolean
  - `parentTaskId` string
  - `dueDate` string, date-time
  - `dueDateAfter` string, date-time
  - `dueDateBefore` string, date-time
  - `withoutDueDate` boolean
  - `taskCreatedOn` string, date-time
  - `taskCreatedBefore` string, date-time
  - `taskCreatedAfter` string, date-time
  - `taskCompletedOn` string, date-time
  - `taskCompletedBefore` string, date-time
  - `taskCompletedAfter` string, date-time
  - `includeTaskLocalVariables` boolean
  - `includeProcessVariables` boolean
  - `taskVariables` QueryVariable[]
    - `name` string
    - `operation` 'equals' | 'notEquals' | 'equalsIgnoreCase' | 'notEqualsIgnoreCase' | 'like' | 'likeIgnoreCase' | 'greaterThan' | 'greaterThanOrEquals' | 'lessThan' | 'lessThanOrEquals' | 'exists' | 'notExists'
    - `value` object
    - `type` string
  - `tenantId` string
  - `tenantIdLike` string
  - `withoutTenantId` boolean
  - `withoutProcessInstanceId` boolean
  - `taskCandidateGroup` string
  - `ignoreTaskAssignee` boolean
  - `rootScopeId` string
  - `parentScopeId` string

## Response `200`

Indicates request was successful and the tasks are returned

- DataResponseHistoricTaskInstanceResponse
  - `data` HistoricTaskInstanceResponse[]
    - `id` string
    - `name` string
    - `description` string
    - `deleteReason` string
    - `owner` string
    - `assignee` string
    - `startTime` string, date-time
    - `endTime` string, date-time
    - `durationInMillis` integer
    - `workTimeInMillis` integer
    - `claimTime` string, date-time
    - `taskDefinitionKey` string
    - `formKey` string
    - `priority` integer
    - `dueDate` string, date-time
    - `parentTaskId` string
    - `url` string
    - `variables` RestVariable[]
      - `name` string: Name of the variable
      - `type` string: Type of the variable.
      - `value` object: Value of the variable.
      - `valueUrl` string
      - `scope` string
    - `tenantId` string
    - `category` string
    - `caseInstanceId` string
    - `caseInstanceUrl` string
    - `caseDefinitionId` string
    - `caseDefinitionUrl` string
    - `scopeDefinitionId` string
    - `scopeId` string
    - `subScopeId` string
    - `scopeType` string
    - `propagatedStageInstanceId` string
    - `executionId` string
    - `processInstanceId` string
    - `processDefinitionId` string
  - `total` integer
  - `start` integer
  - `sort` string
  - `order` string
  - `size` integer

## Other responses

- `404`: Indicates an parameter was passed in the wrong format. The status-message contains additional information.

---

[API](https://skmtc.dev/flowable/apis/flowable-cmmn-rest-api.md) - [All operations](https://skmtc.dev/flowable/apis/flowable-cmmn-rest-api/llms.txt) - [OpenAPI document](https://skmtc.dev/flowable/apis/flowable-cmmn-rest-api/revisions/afdfa1fcacd0?raw)
