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

# Query for historic variable instances

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

## Request

- Base URL: `https://developer-docs.flowable.com/cmmn-api`
- URL: `https://developer-docs.flowable.com/cmmn-api/cmmn-query/historic-variable-instances`
- Auth: HTTP basic
- TypeScript: <https://skmtc.dev/flowable/apis/flowable-cmmn-rest-api/docs/cmmn-query/historic-variable-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 process 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.

## Query parameters

- `sort` 'caseInstanceId' | 'variableName'

## Request body

- HistoricVariableInstanceQueryRequest
  - `start` integer
  - `size` integer
  - `sort` string
  - `order` string
  - `excludeTaskVariables` boolean
  - `taskId` string
  - `planItemInstanceId` string
  - `caseInstanceId` string
  - `variableName` string
  - `variableNameLike` string
  - `variables` QueryVariable[]
    - `name` string
    - `operation` 'equals' | 'notEquals' | 'equalsIgnoreCase' | 'notEqualsIgnoreCase' | 'like' | 'likeIgnoreCase' | 'greaterThan' | 'greaterThanOrEquals' | 'lessThan' | 'lessThanOrEquals' | 'exists' | 'notExists'
    - `value` object
    - `type` string
  - `excludeLocalVariables` boolean

## Response `200`

Indicates request was successful and the tasks are returned

- DataResponseHistoricVariableInstanceResponse
  - `data` HistoricVariableInstanceResponse[]
    - `id` string
    - `caseInstanceId` string
    - `caseInstanceUrl` string
    - `taskId` string
    - `planItemInstanceId` string
    - `variable` RestVariable
      - `name` string: Name of the variable
      - `type` string: Type of the variable.
      - `value` object: Value of the variable.
      - `valueUrl` string
      - `scope` 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)
