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

# Query for variable instances

`POST /cmmn-query/variable-instances`

## Request

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

## Query parameters

- `sort` 'caseInstanceId' | 'variableName'

## Request body

- VariableInstanceQueryRequest
  - `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
  - `variableScope` string

## Response `200`

Indicates request was successful and the tasks are returned

- DataResponseVariableInstanceResponse
  - `data` VariableInstanceResponse[]
    - `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)
