# How to get ProcessInstanceId by businessKey

**URL:** <https://forum.flowable.org/t/how-to-get-processinstanceid-by-businesskey/3551>\
**Category:** Flowable Engine\
**Created:** [March 12, 2019, 8:01pm UTC](https://forum.flowable.org/t/how-to-get-processinstanceid-by-businesskey/3551 "2019-03-12T20:01:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![satya](https://avatars.discourse-cdn.com/v4/letter/s/8c91f0/32.png) [@satya](https://forum.flowable.org/u/satya)\
**Post date:** [March 12, 2019, 8:01pm UTC](https://forum.flowable.org/t/how-to-get-processinstanceid-by-businesskey/3551/1 "2019-03-12T20:01:43Z")

</div>

How to get the ProcessInstanceId by businessKey . This businessKey is our unique key for each execution.

---

<div class="post-metadata">

**Author:** ![filiphr](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/filiphr/32/315_2.png) [@filiphr](https://forum.flowable.org/u/filiphr)\
**Post date:** [March 12, 2019, 8:09pm UTC](https://forum.flowable.org/t/how-to-get-processinstanceid-by-businesskey/3551/2 "2019-03-12T20:09:14Z")

</div>

Hey @satya,

You can use the [`ProcessInstanceQuery`](https://github.com/flowable/flowable-engine/blob/master/modules/flowable-engine/src/main/java/org/flowable/engine/runtime/ProcessInstanceQuery.java) (get it via `RuntimeService#createProcessInstanceQuery()` or [`HistoricProcessInstanceQuery`](https://github.com/flowable/flowable-engine/blob/master/modules/flowable-engine/src/main/java/org/flowable/engine/history/HistoricProcessInstanceQuery.java) (get it via `HistoryService#createHistoricProcessInstanceQuery()`. The queries have `processInstanceBusinessKey` to which you can pass your key and then you can either use `singleResult()` or `list()` to get all matching process instances.

Cheers,  
Filip
