Skip to content
Documentation/canton-network-docs/Ledger APIOpenAPIView on canton-network-docs
canton-network-docs/Ledger APIOpenAPI

POST /v2/events/events

POST
/
v2
/
events
/
events-by-contract-id
Try it
POST /v2/events/events-by-contract-id

cURL

curl --request POST \
  --url https://api.example.com/v2/events/events-by-contract-id \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "contractId": "<string>",
  "eventFormat": {
    "filtersByParty": {},
    "filtersForAnyParty": {
      "cumulative": [
        {
          "identifierFilter": {
            "Empty": {}
          }
        }
      ]
    },
    "verbose": true
  }
}
'
import requests

url = "https://api.example.com/v2/events/events-by-contract-id"

payload = {
    "contractId": "<string>",
    "eventFormat": {
        "filtersByParty": {},
        "filtersForAnyParty": { "cumulative": [{ "identifierFilter": { "Empty": {} } }] },
        "verbose": True
    }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    contractId: '<string>',
    eventFormat: {
      filtersByParty: {},
      filtersForAnyParty: {cumulative: [{identifierFilter: {Empty: {}}}]},
      verbose: true
    }
  })
};

fetch('https://api.example.com/v2/events/events-by-contract-id', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.example.com/v2/events/events-by-contract-id",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode([
    'contractId' => '<string>',
    'eventFormat' => [
        'filtersByParty' => [
                
        ],
        'filtersForAnyParty' => [
                'cumulative' => [
                                [
                                                                'identifierFilter' => [
                                                                                                                                'Empty' => [
                                                                                                                                                                                                                                                                
                                                                                                                                ]
                                                                ]
                                ]
                ]
        ],
        'verbose' => true
    ]
  ]),
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <token>",
    "Content-Type: application/json"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.example.com/v2/events/events-by-contract-id"

	payload := strings.NewReader("{\n  \"contractId\": \"<string>\",\n  \"eventFormat\": {\n    \"filtersByParty\": {},\n    \"filtersForAnyParty\": {\n      \"cumulative\": [\n        {\n          \"identifierFilter\": {\n            \"Empty\": {}\n          }\n        }\n      ]\n    },\n    \"verbose\": true\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.example.com/v2/events/events-by-contract-id")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"contractId\": \"<string>\",\n  \"eventFormat\": {\n    \"filtersByParty\": {},\n    \"filtersForAnyParty\": {\n      \"cumulative\": [\n        {\n          \"identifierFilter\": {\n            \"Empty\": {}\n          }\n        }\n      ]\n    },\n    \"verbose\": true\n  }\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.example.com/v2/events/events-by-contract-id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"contractId\": \"<string>\",\n  \"eventFormat\": {\n    \"filtersByParty\": {},\n    \"filtersForAnyParty\": {\n      \"cumulative\": [\n        {\n          \"identifierFilter\": {\n            \"Empty\": {}\n          }\n        }\n      ]\n    },\n    \"verbose\": true\n  }\n}"

response = http.request(request)
puts response.read_body
200
400
default
{
  "created": {
    "createdEvent": {
      "offset": 123,
      "nodeId": 123,
      "contractId": "<string>",
      "templateId": "<string>",
      "createArgument": "<unknown>",
      "witnessParties": [
        "<string>"
      ],
      "signatories": [
        "<string>"
      ],
      "createdAt": "<string>",
      "packageName": "<string>",
      "representativePackageId": "<string>",
      "acsDelta": true,
      "contractKey": "<unknown>",
      "contractKeyHash": "<string>",
      "createdEventBlob": "<string>",
      "interfaceViews": [
        {
          "interfaceId": "<string>",
          "viewStatus": {
            "code": 123,
            "message": "<string>",
            "details": [
              {
                "typeUrl": "<string>",
                "value": "<string>",
                "unknownFields": {
                  "fields": {}
                },
                "valueDecoded": "<string>"
              }
            ]
          },
          "viewValue": "<unknown>",
          "implementationPackageId": "<string>"
        }
      ],
      "observers": [
        "<string>"
      ]
    },
    "synchronizerId": "<string>"
  },
  "archived": {
    "archivedEvent": {
      "offset": 123,
      "nodeId": 123,
      "contractId": "<string>",
      "templateId": "<string>",
      "witnessParties": [
        "<string>"
      ],
      "packageName": "<string>",
      "implementedInterfaces": [
        "<string>"
      ]
    },
    "synchronizerId": "<string>"
  }
}
"<string>"
{
  "code": "<string>",
  "cause": "<string>",
  "context": {},
  "errorCategory": 123,
  "correlationId": "<string>",
  "traceId": "<string>",
  "resources": [
    [
      "<string>"
    ]
  ],
  "grpcCodeValue": 123,
  "retryInfo": "<string>",
  "definiteAnswer": true
}

Authorizations

Authorization
string
header
required

Ledger API standard JWT token

Body

application/json
contractId
string
required

The contract id being queried.

Required

eventFormat
EventFormat · object
required

Format of the events in the result, the presentation will be of TRANSACTION_SHAPE_ACS_DELTA.

Required

Show child attributes

Response

200
application/json
created
JsCreated · object

The create event for the contract with the contract_id given in the request provided it exists and has not yet been pruned.

Optional

Show child attributes

archived
JsArchived · object

The archive event for the contract with the contract_id given in the request provided such an archive event exists and it has not yet been pruned.

Optional

Show child attributes