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

# Publish active contracts

> Returns a stream of the snapshot of the active contracts and incomplete (un)assignments at a ledger offset. Once the stream of GetActiveContractsResponses completes, the client SHOULD begin streaming updates from the update service, starting at the GetActiveContractsRequest.active_at_offset specified in this request. Clients SHOULD NOT assume that the set of active contracts they receive reflects the state at the ledger end. If the given offset is different than the ledger end, and there are (un)assignments in-flight at the given offset, the snapshot may fail with "FAILED_PRECONDITION/PARTICIPANT_PRUNED_DATA_ACCESSED". Note that it is ok to request acs snapshots for party migration with offsets other than ledger end, because party migration is not concerned with incomplete (un)assignments.

[JSON API AsyncAPI](https://docs.canton.network/reference/json-api-asyncapi-reference/index.md)

›

[/v2/state/active-contracts](https://docs.canton.network/reference/json-api-asyncapi-reference/channels/v2-state-active-contracts.md)

›

publish

/v2/state/active-contracts

# Publish active contracts

WebSocket

[Updated 3.7](#history-updated-3-7)

PUBLISH

`/v2/state/active-contracts`

Returns a stream of the snapshot of the active contracts and incomplete (un)assignments at a ledger offset.
Once the stream of GetActiveContractsResponses completes,
the client SHOULD begin streaming updates from the update service,
starting at the GetActiveContractsRequest.active\_at\_offset specified in this request.
Clients SHOULD NOT assume that the set of active contracts they receive reflects the state at the ledger end.
If the given offset is different than the ledger end, and there are (un)assignments in-flight at the given offset,
the snapshot may fail with "FAILED\_PRECONDITION/PARTICIPANT\_PRUNED\_DATA\_ACCESSED".
Note that it is ok to request acs snapshots for party migration with offsets other than ledger end, because party
migration is not concerned with incomplete (un)assignments.

## Protocol Details

Protocol
WebSocket

Channel
/v2/state/active-contracts

Action
publish

Operation ID
sendV2StateActive-contracts

Content type
application/json

Payload
object

## Inputs

### GetActiveContractsRequest

Direction
Client -> Server

Message
GetActiveContractsRequest

`activeAtOffset`
string

required

`eventFormat`
object

required

## Outputs

## Related Schemas

> [accordion] GetActiveContractsRequest
>
> `activeAtOffset`
> string
>
> required
>
> `eventFormat`
> object
>
> required

## History

Updated
`3.7`

channel description updated; publish required fields added: `eventFormat`

Updated
`3.5`

channel description updated; publish description updated; publish required fields removed: `eventFormat`

wscat

```bash wscat theme={"theme":{"light":"github-light","dark":"github-dark"}}
npx wscat \
  -c <WEBSOCKET_URL> \
  -x '{"activeAtOffset": "<integer>", "eventFormat": {"filtersByParty": {}, "filtersForAnyParty": {"cumulative": ["<object>"]}, "verbose": "<boolean>"}}' \
  -w -1
```

message

application/json

```json message theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "activeAtOffset": "<integer>",
  "eventFormat": {
    "filtersByParty": {},
    "filtersForAnyParty": {
      "cumulative": [
        "<object>"
      ]
    },
    "verbose": "<boolean>"
  }
}
```
