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

# Query for historic case instances

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

## Request

- Base URL: `https://developer-docs.flowable.com/cmmn-api`
- URL: `https://developer-docs.flowable.com/cmmn-api/cmmn-query/historic-case-instances`
- Auth: HTTP basic
- TypeScript: <https://skmtc.dev/flowable/apis/flowable-cmmn-rest-api/docs/cmmn-query/historic-case-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 case 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 variables property is a JSON-array containing objects with the format as described here.

## Request body

- HistoricCaseInstanceQueryRequest
  - `start` integer
  - `size` integer
  - `sort` string
  - `order` string
  - `caseInstanceId` string
  - `caseInstanceIds` string[]
  - `caseDefinitionId` string
  - `caseDefinitionKey` string
  - `caseDefinitionKeyLike` string
  - `caseDefinitionKeyLikeIgnoreCase` string
  - `caseDefinitionKeys` string[]
  - `excludeCaseDefinitionKeys` string[]
  - `caseDefinitionCategory` string
  - `caseDefinitionCategoryLike` string
  - `caseDefinitionCategoryLikeIgnoreCase` string
  - `caseDefinitionName` string
  - `caseDefinitionNameLike` string
  - `caseDefinitionNameLikeIgnoreCase` string
  - `caseBusinessKey` string
  - `caseInstanceName` string
  - `caseInstanceNameLike` string
  - `caseInstanceNameLikeIgnoreCase` string
  - `caseInstanceRootScopeId` string
  - `caseInstanceRootScopeIds` string[]
  - `caseInstanceParentScopeId` string
  - `caseInstanceParentScopeIds` string[]
  - `caseInstanceBusinessKey` string
  - `caseInstanceBusinessKeyLike` string
  - `caseInstanceBusinessKeyLikeIgnoreCase` string
  - `caseInstanceBusinessStatus` string
  - `caseInstanceBusinessStatusLike` string
  - `caseInstanceBusinessStatusLikeIgnoreCase` string
  - `caseInstanceParentId` string
  - `caseInstanceState` string
  - `caseInstanceCallbackId` string
  - `caseInstanceCallbackIds` string[]
  - `caseInstanceCallbackType` string
  - `parentCaseInstanceId` string
  - `parentProcessInstanceId` string
  - `caseInstanceReferenceId` string
  - `caseInstanceReferenceType` string
  - `finished` boolean
  - `involvedUser` string
  - `finishedAfter` string, date-time
  - `finishedBefore` string, date-time
  - `startedAfter` string, date-time
  - `startedBefore` string, date-time
  - `startedBy` string
  - `finishedBy` string
  - `lastReactivatedBy` string
  - `lastReactivatedBefore` string, date-time
  - `lastReactivatedAfter` string, date-time
  - `activePlanItemDefinitionId` string
  - `activePlanItemDefinitionIds` string[]
  - `includeCaseVariables` boolean
  - `includeCaseVariablesNames` string[]
  - `variables` QueryVariable[]
    - `name` string
    - `operation` 'equals' | 'notEquals' | 'equalsIgnoreCase' | 'notEqualsIgnoreCase' | 'like' | 'likeIgnoreCase' | 'greaterThan' | 'greaterThanOrEquals' | 'lessThan' | 'lessThanOrEquals' | 'exists' | 'notExists'
    - `value` object
    - `type` string
  - `tenantId` string
  - `tenantIdLike` string
  - `tenantIdLikeIgnoreCase` string
  - `withoutTenantId` boolean
  - `withoutCaseInstanceParentId` boolean
  - `withoutCaseInstanceCallbackId` boolean

## Response `200`

Indicates request was successful and the case instances are returned

- DataResponseHistoricCaseInstanceResponse
  - `data` HistoricCaseInstanceResponse[]
    - `id` string
    - `url` string
    - `name` string
    - `businessKey` string
    - `businessStatus` string
    - `dueDate` string, date-time
    - `claimTime` string, date-time
    - `claimedBy` string
    - `caseDefinitionId` string
    - `caseDefinitionUrl` string
    - `caseDefinitionName` string
    - `caseDefinitionDescription` string
    - `startTime` string, date-time
    - `endTime` string, date-time
    - `startUserId` string
    - `endUserId` string
    - `superProcessInstanceId` 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
    - `state` string
    - `callbackId` string
    - `callbackType` string
    - `referenceId` string
    - `referenceType` string
  - `total` integer
  - `start` integer
  - `sort` string
  - `order` string
  - `size` integer

## Other responses

- `400`: 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)
