> ## Documentation Index
> Fetch the complete documentation index at: https://docs.canton.network/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> If you are building a Canton Network application, start from https://docs.canton.network/appdev/quickstart.md. To run only a local network for your own Daml code, without building the QuickStart demo, see https://docs.canton.network/sdks-tools/development-tools/localnet.md.

# DA.ContractKeys

> Reference documentation for Daml module DA.ContractKeys.

Daml module

# DA.ContractKeys

Note: Docs TODO ([https://github.com/digital-asset/daml/issues/22673](https://github.com/digital-asset/daml/issues/22673))

Daml

[Added 3.5.1](#history-added-3-5-1)

Module
DA.ContractKeys

Latest release
3.7.5

## Functions

### `lookupNByKey`

`lookupNByKey` : [`HasLookupNByKey`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#class-da-internal-template-functions-haslookupnbykey-35508) `t` `k` => [`Int`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-ghc-types-int-37261) -> `k` -> [`Update`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-da-internal-lf-update-68072) \[([`ContractId`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-da-internal-lf-contractid-95282) `t`, `t`)]

Look up up to n contracts associated with the passed key. Contracts created
within a transaction are returned first (in recency order), then disclosed
contracts, then nonlocal contracts.

You must pass the `t` using an explicit type application. For instance, if
you want to query 3 contracts of template `Account` given by its key `k`, you
must call \`lookupNByKey @Account 3 k.

### `lookupAllByKey`

`lookupAllByKey` : [`HasLookupNByKey`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#class-da-internal-template-functions-haslookupnbykey-35508) `t` `k` => `k` -> [`Update`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-da-internal-lf-update-68072) \[([`ContractId`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-da-internal-lf-contractid-95282) `t`, `t`)]

Shorthand for `lookupNByKey` with n larger than the amount of contracts that
can exist for a key (1000000), therefore returning all contracts

## History

Added
`3.5.1`
