# How to fetch contract with contract id or key using GRPC java

**URL:** <https://forum.canton.network/t/how-to-fetch-contract-with-contract-id-or-key-using-grpc-java/6516>\
**Category:** App Development\
**Tags:** daml\
**Created:** [May 9, 2023, 7:00am UTC](https://forum.canton.network/t/how-to-fetch-contract-with-contract-id-or-key-using-grpc-java/6516 "2023-05-09T07:00:40Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![bernhard](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/bernhard/32/356_2.png) [@bernhard](https://forum.canton.network/u/bernhard)\
**Post date:** [May 9, 2023, 1:46pm UTC](https://forum.canton.network/t/how-to-fetch-contract-with-contract-id-or-key-using-grpc-java/6516/3 "2023-05-09T13:46:46Z")

</div>

Correction to @stefanobaghino-da 's reply: In Daml 2.5 we introduced two new API methods `GetEventsByContractId` and `GetEventsByContractKey` which allow you to query a contract by Id or Key. These are currently only exposed by the lower level gPRC bindings for Java, not the rx-java layer. See [getEventsByContractKey - #2 by bernhard](https://discuss.daml.com/t/geteventsbycontractkey/6518/2).

See API reference docs [here](https://docs.daml.com/app-dev/grpc/proto-docs.html#com-daml-ledger-api-v1-event-query-service-proto).

---

_[View the full topic](https://forum.canton.network/t/how-to-fetch-contract-with-contract-id-or-key-using-grpc-java/6516)._
