> ## 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.

# GetContract

Ledger API

›

[Protobuf](https://docs.canton.network/reference/protobuf/overview.md)

›

[com.daml.ledger.api.v2](https://docs.canton.network/reference/protobuf/packages/com-daml-ledger-api-v2.md)

›

GetContract

com.daml.ledger.api.v2

# GetContract

gRPC

[Added 3.4.11](#history-added-3-4-11)

RPC

`/com.daml.ledger.api.v2.ContractService/GetContract`

## Protocol Details

Protocol
gRPC

Service
ContractService

RPC
GetContract

Client stream
No

Server stream
No

## Inputs

### GetContractRequest

Message
com.daml.ledger.api.v2.GetContractRequest

Client stream
No

`contract_id`
string

`querying_parties`
repeated string

## Outputs

### GetContractResponse

Message
com.daml.ledger.api.v2.GetContractResponse

Server stream
No

`created_event`
CreatedEvent

## Related Schemas

> [accordion] com.daml.ledger.api.v2.GetContractRequest
>
> `contract_id`
> string
>
> `querying_parties`
> repeated string

> [accordion] com.daml.ledger.api.v2.GetContractResponse
>
> `created_event`
> CreatedEvent

> [accordion] com.daml.ledger.api.v2.CreatedEvent
>
> `offset`
> int64
>
> `node_id`
> int32
>
> `contract_id`
> string
>
> `template_id`
> Identifier
>
> `contract_key`
> Value
>
> `contract_key_hash`
> bytes
>
> `create_arguments`
> Record
>
> `created_event_blob`
> bytes
>
> `interface_views`
> repeated InterfaceView
>
> `witness_parties`
> repeated string
>
> `signatories`
> repeated string
>
> `observers`
> repeated string
>
> `created_at`
> Timestamp
>
> `package_name`
> string
>
> `acs_delta`
> bool
>
> `representative_package_id`
> string

> [accordion] com.daml.ledger.api.v2.Identifier
>
> `package_id`
> string
>
> `module_name`
> string
>
> `entity_name`
> string

> [accordion] com.daml.ledger.api.v2.Value
>
> `unit`
> Empty
>
> `bool`
> bool
>
> `int64`
> sint64
>
> `date`
> int32
>
> `timestamp`
> sfixed64
>
> `numeric`
> string
>
> `party`
> string
>
> `text`
> string
>
> `contract_id`
> string
>
> `optional`
> Optional
>
> `list`
> List
>
> `text_map`
> TextMap
>
> `gen_map`
> GenMap
>
> `record`
> Record
>
> `variant`
> Variant
>
> `enum`
> Enum

> [accordion] com.daml.ledger.api.v2.Optional
>
> `value`
> Value

> [accordion] com.daml.ledger.api.v2.List
>
> `elements`
> repeated Value

> [accordion] com.daml.ledger.api.v2.TextMap
>
> `entries`
> repeated Entry

> [accordion] com.daml.ledger.api.v2.TextMap.Entry
>
> `key`
> string
>
> `value`
> Value

> [accordion] com.daml.ledger.api.v2.GenMap
>
> `entries`
> repeated Entry

> [accordion] com.daml.ledger.api.v2.GenMap.Entry
>
> `key`
> Value
>
> `value`
> Value

> [accordion] com.daml.ledger.api.v2.Record
>
> `record_id`
> Identifier
>
> `fields`
> repeated RecordField

> [accordion] com.daml.ledger.api.v2.RecordField
>
> `label`
> string
>
> `value`
> Value

> [accordion] com.daml.ledger.api.v2.Variant
>
> `variant_id`
> Identifier
>
> `constructor`
> string
>
> `value`
> Value

> [accordion] com.daml.ledger.api.v2.Enum
>
> `enum_id`
> Identifier
>
> `constructor`
> string

> [accordion] com.daml.ledger.api.v2.InterfaceView
>
> `interface_id`
> Identifier
>
> `view_status`
> Status
>
> `view_value`
> Record
>
> `implementation_package_id`
> string

## History

Added
`3.4.11`

grpcurl

```bash grpcurl theme={"theme":{"light":"github-light","dark":"github-dark"}}
# Add -plaintext if the server is not using TLS.
grpcurl \
  -d @ \
  <HOST:PORT> \
  com.daml.ledger.api.v2.ContractService/GetContract <<'EOF'
{
  "contractId": "string",
  "queryingParties": [
    "string"
  ]
}
EOF
```

OK

application/json

```json OK theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "createdEvent": {
    "offset": "0",
    "nodeId": 0,
    "contractId": "string",
    "templateId": {
      "packageId": "string",
      "moduleName": "string",
      "entityName": "string"
    },
    "contractKey": {
      "unit": "string"
    },
    "contractKeyHash": "BASE64_ENCODED_BYTES",
    "createArguments": {
      "recordId": {
        "packageId": "string",
        "moduleName": "string",
        "entityName": "string"
      },
      "fields": [
        {
          "label": "string",
          "value": {}
        }
      ]
    },
    "createdEventBlob": "BASE64_ENCODED_BYTES"
  }
}
```
