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

# POST /v2/commands/completion-by-hash

> Look up a completion by its transaction hash. This is only available for completions received after upgrading to Canton version 3.5. A COMPLETION_NOT_FOUND error will be raised if either of the following is true: - there is no completion with this transaction hash, - the completion is not visible to the user, - the completion was populated before upgrading to Canton version 3.5, - respective completions are all pruned.

Look up a completion by its transaction hash. This is only available for completions received after upgrading to Canton version 3.5. A COMPLETION\_NOT\_FOUND error will be raised if either of the following is true: - there is no completion with this transaction hash, - the completion is not visible to the user, - the completion was populated before upgrading to Canton version 3.5, - respective completions are all pruned.

OpenAPI

[Added 3.6](#history-added-3-6)

```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl --request POST \
  --url 'http://localhost:7575/v2/commands/completion-by-hash' \
  --header 'Authorization: Bearer $TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
  "transactionHash": "<string>"
}'
```

```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
import json
import requests

url = "http://localhost:7575/v2/commands/completion-by-hash"
headers = {'Authorization': 'Bearer <token>', 'Content-Type': 'application/json'}
payload = json.loads(r'''{
  "transactionHash": "<string>"
}''')
response = requests.request(
    "POST", url, headers=headers, json=payload
)

print(response.text)
```

```javascript JavaScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
const response = await fetch('http://localhost:7575/v2/commands/completion-by-hash', {
  method: 'POST',
  headers: {
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
},
  body: JSON.stringify({
  "transactionHash": "<string>"
}),
});

console.log(await response.text());
```

```php PHP theme={"theme":{"light":"github-light","dark":"github-dark"}}
<?php
$curl = curl_init();

curl_setopt_array($curl, [
    CURLOPT_URL => 'http://localhost:7575/v2/commands/completion-by-hash',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_POSTFIELDS => <<<'JSON'
{
  "transactionHash": "<string>"
}
JSON,
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer <token>",
        "Content-Type: application/json"
    ],
]);

$response = curl_exec($curl);
echo $response;
```

```go Go theme={"theme":{"light":"github-light","dark":"github-dark"}}
package main

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

func main() {
  req, _ := http.NewRequest("POST", "http://localhost:7575/v2/commands/completion-by-hash", bytes.NewBufferString(`{
  "transactionHash": "<string>"
}`))
  req.Header.Set("Authorization", "Bearer <token>")
  req.Header.Set("Content-Type", "application/json")
  response, _ := http.DefaultClient.Do(req)
  defer response.Body.Close()
  body, _ := io.ReadAll(response.Body)
  fmt.Println(string(body))
}
```

```java Java theme={"theme":{"light":"github-light","dark":"github-dark"}}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

var request = HttpRequest.newBuilder()
    .uri(URI.create("http://localhost:7575/v2/commands/completion-by-hash"))
    .header("Authorization", "Bearer <token>")
    .header("Content-Type", "application/json")
    .method("POST", HttpRequest.BodyPublishers.ofString("""
{
  "transactionHash": "<string>"
}
"""))
    .build();
var response = HttpClient.newHttpClient().send(
    request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
```

```ruby Ruby theme={"theme":{"light":"github-light","dark":"github-dark"}}
require 'net/http'
require 'uri'

uri = URI('http://localhost:7575/v2/commands/completion-by-hash')
request = Net::HTTP::Post.new(uri)
request['Authorization'] = 'Bearer <token>'
request['Content-Type'] = 'application/json'
request.body = <<~JSON
{
  "transactionHash": "<string>"
}
JSON
response = Net::HTTP.start(uri.hostname, uri.port) do |http|
  http.request(request)
end
puts response.body
```

```json 200 theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "acceptedCompletion": {
    "commandId": "<string>",
    "status": {
      "code": 123,
      "message": "<string>",
      "details": [
        {
          "typeUrl": "<string>",
          "value": "<string>",
          "unknownFields": {
            "fields": "<object>"
          },
          "valueDecoded": "<string>"
        }
      ]
    },
    "updateId": "<string>",
    "userId": "<string>",
    "actAs": [
      "<string>"
    ],
    "submissionId": "<string>",
    "deduplicationPeriod": {
      "DeduplicationDuration": {
        "value": {
          "seconds": 123,
          "nanos": 123,
          "unknownFields": "<object>"
        }
      }
    },
    "traceContext": {
      "traceparent": "<string>",
      "tracestate": "<string>"
    },
    "offset": 123,
    "synchronizerTime": {
      "synchronizerId": "<string>",
      "recordTime": "<string>"
    },
    "paidTrafficCost": 123,
    "transactionHash": "<string>"
  },
  "lastRejectedCompletions": [
    {
      "commandId": "<string>",
      "status": {
        "code": 123,
        "message": "<string>",
        "details": [
          {
            "typeUrl": "<string>",
            "value": "<string>",
            "unknownFields": {
              "fields": "<object>"
            },
            "valueDecoded": "<string>"
          }
        ]
      },
      "updateId": "<string>",
      "userId": "<string>",
      "actAs": [
        "<string>"
      ],
      "submissionId": "<string>",
      "deduplicationPeriod": {
        "DeduplicationDuration": {
          "value": {
            "seconds": 123,
            "nanos": 123,
            "unknownFields": "<object>"
          }
        }
      },
      "traceContext": {
        "traceparent": "<string>",
        "tracestate": "<string>"
      },
      "offset": 123,
      "synchronizerTime": {
        "synchronizerId": "<string>",
        "recordTime": "<string>"
      },
      "paidTrafficCost": 123,
      "transactionHash": "<string>"
    }
  ]
}
```

```text 400 theme={"theme":{"light":"github-light","dark":"github-dark"}}
<string>
```

```json default theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "code": "<string>",
  "cause": "<string>",
  "correlationId": "<string>",
  "traceId": "<string>",
  "context": {},
  "resources": [
    [
      "<string>"
    ]
  ],
  "errorCategory": 123,
  "grpcCodeValue": 123,
  "retryInfo": "<string>",
  "definiteAnswer": false
}
```

## Authorizations

### httpAuth

**Authorization** `string` *required*

HTTP bearer authentication. Send the token as `Authorization: Bearer &lt;token&gt;`. Ledger API standard JWT token

### apiKeyAuth

**Sec-WebSocket-Protocol** `string` *required*

API key authentication in the header. Ledger API standard JWT token (websocket)

## Body

application/json

**transactionHash** `string` *required*

The transaction hash of the prepared transaction whose completion is being looked up. Required: must be non-empty

## Responses

### 200

application/json

**acceptedCompletion** `Completion1`

A completion represents the status of a submitted command on the ledger: it can be successful or failed.

**child attributes**

**commandId** `string` *required*

The ID of the succeeded or failed command. Must be a valid LedgerString (as described in `value.proto`). Required

**status** `JsStatus`

Identifies the exact type of the error. It uses the same format of conveying error details as it is used for the RPC responses of the APIs. Optional

**child attributes**

**code** `integer (int32)` *required*

**message** `string` *required*

**details** `ProtoAny[]`

**child attributes**

**typeUrl** `string` *required*

**value** `string` *required*

**unknownFields** `UnknownFieldSet` *required*

**child attributes**

**fields** `Map_Int_Field` *required*

**valueDecoded** `string`

**updateId** `string`

The update\_id of the transaction or reassignment that resulted from the command with command\_id. Only set for successfully executed commands. Must be a valid LedgerString (as described in `value.proto`). Optional

**userId** `string` *required*

The user-id that was used for the submission, as described in `commands.proto`. Must be a valid UserIdString (as described in `value.proto`). Required

**actAs** `string[]` *required*

The set of parties on whose behalf the commands were executed. Contains the `act_as` parties from `commands.proto` filtered to the requesting parties in CompletionStreamRequest. The order of the parties need not be the same as in the submission. Each element must be a valid PartyIdString (as described in `value.proto`). Required: must be non-empty

**submissionId** `string`

The submission ID this completion refers to, as described in `commands.proto`. Must be a valid LedgerString (as described in `value.proto`). Optional

**deduplicationPeriod** `DeduplicationPeriod1`

The actual deduplication window used for the submission, which is derived from `Commands.deduplication_period`. The ledger may convert the deduplication period into other descriptions and extend the period in implementation-specified ways. Used to audit the deduplication guarantee described in `commands.proto`. The deduplication guarantee applies even if the completion omits this field. Optional

**child attributes**

**Variant 1** `object`

**child attributes**

**DeduplicationDuration** `DeduplicationDuration1` *required*

**child attributes**

**value** `Duration` *required*

**child attributes**

**seconds** `integer (int64)` *required*

**nanos** `integer (int32)` *required*

**unknownFields** `UnknownFieldSet`

This field is automatically added as part of protobuf to json mapping

**child attributes**

**fields** `Map_Int_Field` *required*

**Variant 2** `object`

**child attributes**

**DeduplicationOffset** `DeduplicationOffset1` *required*

**child attributes**

**value** `integer (int64)` *required*

**Variant 3** `object`

**child attributes**

**Empty** `Empty3` *required*

**traceContext** `TraceContext`

The Ledger API trace context The trace context transported in this message corresponds to the trace context supplied by the client application in a HTTP2 header of the original command submission. We typically use a header to transfer this type of information. Here we use message body, because it is used in gRPC streams which do not support per message headers. This field will be populated with the trace context contained in the original submission. If that was not provided, a unique ledger-api-server generated trace context will be used instead. Optional

**child attributes**

**traceparent** `string`

[https://www.w3.org/TR/trace-context/](https://www.w3.org/TR/trace-context/) Optional

**tracestate** `string`

Optional

**offset** `integer (int64)` *required*

May be used in a subsequent CompletionStreamRequest to resume the consumption of this stream at a later time. Must be a valid absolute offset (positive integer). Required

**synchronizerTime** `SynchronizerTime` *required*

The synchronizer along with its record time. The synchronizer id provided, in case of - successful/failed transactions: identifies the synchronizer of the transaction - for successful/failed unassign commands: identifies the source synchronizer - for successful/failed assign commands: identifies the target synchronizer Required

**child attributes**

**synchronizerId** `string` *required*

The id of the synchronizer. Required

**recordTime** `string` *required*

All commands with a maximum record time below this value MUST be considered lost if their completion has not arrived before this checkpoint. Required

**paidTrafficCost** `integer (int64)`

The traffic cost paid by this participant node for the confirmation request for the submitted command. Commands whose execution is rejected before their corresponding confirmation request is ordered by the synchronizer will report a paid traffic cost of zero. If a confirmation request is ordered for a command, but the request fails (e.g., due to contention with a concurrent contract archival), the traffic cost is paid and reported on the failed completion for the request. If you want to correlate the traffic cost of a successful completion with the transaction that resulted from the command, you can use the `offset` field to retrieve the transaction using `UpdateService.GetUpdateByOffset` on the same participant node; or alternatively use the `update_id` field to retrieve the transaction using `UpdateService.GetUpdateById` on any participant node that sees the transaction. Note: for completions processed before the participant started serving traffic cost on the Ledger API, this field will be set to zero. Additionally, the total cost incurred by the submitting node for the submission of the transaction may be greater than the reported cost, for example if retries were issued due to failed submissions to the synchronizer. The cost reported here is the one paid for ordering the confirmation request. Optional

**transactionHash** `string`

The transaction hash signed by the external party for prepared transactions that were submitted using `InteractiveSubmissionService.ExecuteSubmission` or one of its variants. Use this to correlate prepared transactions with their execution result on the *same participant* that executed the transaction. Not available for: - transactions executed on Canton versions prior to 3.5 - transactions of internal parties submitted using `CommandSubmissionService.Submit` and its variants Optional: can be empty

**lastRejectedCompletions** `Completion1[]`

Recent rejected completions for the given transaction hash, in descending offset order. The server may truncate this list if there are too many entries. Use `submission_id` to correlate with a specific command submission. Only completions beyond the current pruning offset are visible. Optional: can be empty

**child attributes**

**commandId** `string` *required*

The ID of the succeeded or failed command. Must be a valid LedgerString (as described in `value.proto`). Required

**status** `JsStatus`

Identifies the exact type of the error. It uses the same format of conveying error details as it is used for the RPC responses of the APIs. Optional

**child attributes**

**code** `integer (int32)` *required*

**message** `string` *required*

**details** `ProtoAny[]`

**child attributes**

**typeUrl** `string` *required*

**value** `string` *required*

**unknownFields** `UnknownFieldSet` *required*

**child attributes**

**fields** `Map_Int_Field` *required*

**valueDecoded** `string`

**updateId** `string`

The update\_id of the transaction or reassignment that resulted from the command with command\_id. Only set for successfully executed commands. Must be a valid LedgerString (as described in `value.proto`). Optional

**userId** `string` *required*

The user-id that was used for the submission, as described in `commands.proto`. Must be a valid UserIdString (as described in `value.proto`). Required

**actAs** `string[]` *required*

The set of parties on whose behalf the commands were executed. Contains the `act_as` parties from `commands.proto` filtered to the requesting parties in CompletionStreamRequest. The order of the parties need not be the same as in the submission. Each element must be a valid PartyIdString (as described in `value.proto`). Required: must be non-empty

**submissionId** `string`

The submission ID this completion refers to, as described in `commands.proto`. Must be a valid LedgerString (as described in `value.proto`). Optional

**deduplicationPeriod** `DeduplicationPeriod1`

The actual deduplication window used for the submission, which is derived from `Commands.deduplication_period`. The ledger may convert the deduplication period into other descriptions and extend the period in implementation-specified ways. Used to audit the deduplication guarantee described in `commands.proto`. The deduplication guarantee applies even if the completion omits this field. Optional

**child attributes**

**Variant 1** `object`

**child attributes**

**DeduplicationDuration** `DeduplicationDuration1` *required*

**child attributes**

**value** `Duration` *required*

**child attributes**

**seconds** `integer (int64)` *required*

**nanos** `integer (int32)` *required*

**unknownFields** `UnknownFieldSet`

This field is automatically added as part of protobuf to json mapping

**child attributes**

**fields** `Map_Int_Field` *required*

**Variant 2** `object`

**child attributes**

**DeduplicationOffset** `DeduplicationOffset1` *required*

**child attributes**

**value** `integer (int64)` *required*

**Variant 3** `object`

**child attributes**

**Empty** `Empty3` *required*

**traceContext** `TraceContext`

The Ledger API trace context The trace context transported in this message corresponds to the trace context supplied by the client application in a HTTP2 header of the original command submission. We typically use a header to transfer this type of information. Here we use message body, because it is used in gRPC streams which do not support per message headers. This field will be populated with the trace context contained in the original submission. If that was not provided, a unique ledger-api-server generated trace context will be used instead. Optional

**child attributes**

**traceparent** `string`

[https://www.w3.org/TR/trace-context/](https://www.w3.org/TR/trace-context/) Optional

**tracestate** `string`

Optional

**offset** `integer (int64)` *required*

May be used in a subsequent CompletionStreamRequest to resume the consumption of this stream at a later time. Must be a valid absolute offset (positive integer). Required

**synchronizerTime** `SynchronizerTime` *required*

The synchronizer along with its record time. The synchronizer id provided, in case of - successful/failed transactions: identifies the synchronizer of the transaction - for successful/failed unassign commands: identifies the source synchronizer - for successful/failed assign commands: identifies the target synchronizer Required

**child attributes**

**synchronizerId** `string` *required*

The id of the synchronizer. Required

**recordTime** `string` *required*

All commands with a maximum record time below this value MUST be considered lost if their completion has not arrived before this checkpoint. Required

**paidTrafficCost** `integer (int64)`

The traffic cost paid by this participant node for the confirmation request for the submitted command. Commands whose execution is rejected before their corresponding confirmation request is ordered by the synchronizer will report a paid traffic cost of zero. If a confirmation request is ordered for a command, but the request fails (e.g., due to contention with a concurrent contract archival), the traffic cost is paid and reported on the failed completion for the request. If you want to correlate the traffic cost of a successful completion with the transaction that resulted from the command, you can use the `offset` field to retrieve the transaction using `UpdateService.GetUpdateByOffset` on the same participant node; or alternatively use the `update_id` field to retrieve the transaction using `UpdateService.GetUpdateById` on any participant node that sees the transaction. Note: for completions processed before the participant started serving traffic cost on the Ledger API, this field will be set to zero. Additionally, the total cost incurred by the submitting node for the submission of the transaction may be greater than the reported cost, for example if retries were issued due to failed submissions to the synchronizer. The cost reported here is the one paid for ordering the confirmation request. Optional

**transactionHash** `string`

The transaction hash signed by the external party for prepared transactions that were submitted using `InteractiveSubmissionService.ExecuteSubmission` or one of its variants. Use this to correlate prepared transactions with their execution result on the *same participant* that executed the transaction. Not available for: - transactions executed on Canton versions prior to 3.5 - transactions of internal parties submitted using `CommandSubmissionService.Submit` and its variants Optional: can be empty

### 400

Invalid value, Invalid value for: body

text/plain

**value** `string` *required*

### default

application/json

**code** `string` *required*

**cause** `string` *required*

**correlationId** `string`

**traceId** `string`

**context** `Map_String` *required*

**resources** `Tuple2_String_String[]`

**errorCategory** `integer (int32)` *required*

**grpcCodeValue** `integer (int32)`

**retryInfo** `string`

**definiteAnswer** `boolean`

## History

Added
`3.6`
