---
title: "Create variables or new binary variable on a case instance"
method: POST
path: "/cmmn-runtime/case-instances/{caseInstanceId}/variables"
tags: ["Case Instance Variables"]
---

# Create variables or new binary variable on a case instance

`POST /cmmn-runtime/case-instances/{caseInstanceId}/variables`

## Request

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

This endpoint can be used in 2 ways: By passing a JSON Body (RestVariable or an array of RestVariable) or by passing a multipart/form-data Object.
Nonexistent variables are created on the case-instance and existing ones are overridden without any error.
Any number of variables can be passed into the request body array.
Note that scope is ignored, only global variables can be set in a case instance.
NB: Swagger V2 specification doesn't support this use case that is why this endpoint might be buggy/incomplete if used with other tools.

## Path parameters

- `caseInstanceId` string, required

## Request body

- CaseInstanceVariableCollectionResource

## Response `200`

successful operation

- object

## Other responses

- `201`: Indicates the case instance was found and variable is created.
- `400`: Indicates the request body is incomplete or contains illegal values. The status description contains additional information about the error.
- `404`: Indicates the requested case instance was not found.
- `409`: Indicates the case instance was found but already contains a variable with the given name (only thrown when POST method is used). Use the update-method instead.

---

[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)
