# GRPC Api submit and wait for Archive choice

**URL:** <https://forum.canton.network/t/grpc-api-submit-and-wait-for-archive-choice/8230>\
**Category:** App Development\
**Tags:** grpc, ledger-api\
**Created:** [October 13, 2025, 10:40am UTC](https://forum.canton.network/t/grpc-api-submit-and-wait-for-archive-choice/8230 "2025-10-13T10:40:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_Martins](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/david_martins/32/1792_2.png) [@David\_Martins](https://forum.canton.network/u/David_Martins)\
**Post date:** [October 13, 2025, 10:40am UTC](https://forum.canton.network/t/grpc-api-submit-and-wait-for-archive-choice/8230/1 "2025-10-13T10:40:14Z")

</div>

Hello,

We have an ongoing project targeting Daml 3.x and the canton network and have deployed an artifact into Devnet. Now we wanted to clear the ledger info for this package and we were attempting to run a Archive command via the GRPC api through the **CommandService/SubmitAndWait** endpoint with the following payload:

> **Body Payload**
>
> ```json
> {
> "commands": {
> "command_id": "<command_id>",
> "commands": [
> {
> "exercise": {
> "template_id": {
> "package_id": "<package_id>",
> "module_name": "<module_name>",
> "entity_name": "<entity_name>"
> },
> "choice": "Archive",
> "choice_argument": {
> "unit": {}
> },
> "contract_id": "<contract_id>"
> }
> }
> ],
> "deduplication_duration": {},
> "act_as": [
> "<party_id>"
> ]
> }
> }
> 
> ```

But with this payload we are getting this error message:  
`COMMAND_PREPROCESSING_FAILED(8,dd6a8889): mismatching type: DA.Internal.Template:Archive and value: ValueUnit`

Any assistance would be appreciated.

---

<div class="post-metadata">

**Author:** ![WallaceKelly](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/wallacekelly/32/5046_2.png) [@WallaceKelly](https://forum.canton.network/u/WallaceKelly)\
**Post date:** [October 13, 2025, 6:16pm UTC](https://forum.canton.network/t/grpc-api-submit-and-wait-for-archive-choice/8230/3 "2025-10-13T18:16:45Z")

</div>

Here is a **gRPC Ledger API** request to _archive_ a contract:

`com.daml.ledger.api.v2.CommandService.SubmitAndWait`

```json
{
  "commands": {
    "act_as": [
      "{{appUserParty}}"
    ],
    "command_id": "command02",
    "commands": [
      {
        "exercise": {
          "template_id": {
            "package_id": "#AdminWorkflows",
            "module_name": "Canton.Internal.Ping",
            "entity_name": "Ping"
          },
          "contract_id": "{{contractId}}",
          "choice": "Archive",
          "choice_argument": {
            "record": {}
          }
        }
      }
    ]
  }
}

```

To confirm, you can use the following requests to _create_ and _query_ for a simple contract:

> **create contract**
>
> `com.daml.ledger.api.v2.CommandService.SubmitAndWait`
> 
> ```json
> {
> "commands": {
> "command_id": "command01",
> "act_as": [
> "{{appUserParty}}"
> ],
> "commands": [
> {
> "create": {
> "template_id": {
> "package_id": "#AdminWorkflows",
> "module_name": "Canton.Internal.Ping",
> "entity_name": "Ping"
> },
> "create_arguments": {
> "fields": [
> {
> "label": "id",
> "value": {
> "text": "testing"
> }
> },
> {
> "label": "initiator",
> "value": {
> "party": "{{appUserParty}}"
> }
> },
> {
> "label": "responder",
> "value": {
> "party": "{{appUserParty}}"
> }
> }
> ]
> }
> }
> }
> ]
> }
> }
> 
> ```

> **query by update-id**
>
> `com.daml.ledger.api.v2.UpdateService.GetUpdateById`
> 
> ```json
> {
> "update_id": "{{updateId}}",
> "update_format": {
> "include_transactions": {
> "transaction_shape": "TRANSACTION_SHAPE_ACS_DELTA",
> "event_format": {
> "verbose": false,
> "filters_by_party": {
> "{{appUserParty}}": {
> "cumulative": [
> {
> "template_filter": {
> "include_created_event_blob": false,
> "template_id": {
> "package_id": "#AdminWorkflows",
> "module_name": "Canton.Internal.Ping",
> "entity_name": "Ping"
> }
> }
> }
> ]
> }
> }
> }
> }
> }
> }
> 
> ```

> **query acs**
>
> `com.daml.ledger.api.v2.StateService.GetActiveContracts`
> 
> ```json
> {
> "verbose": false,
> "active_at_offset": {{ledgerEndOffset}},
> "filter": {
> "filters_by_party": {
> "{{appUserParty}}": {
> "cumulative": [
> {
> "template_filter": {
> "include_created_event_blob": false,
> "template_id": {
> "package_id": "#AdminWorkflows",
> "module_name": "Canton.Internal.Ping",
> "entity_name": "Ping"
> }
> }
> }
> ]
> }
> }
> }
> }
> 
> ```

These were created with the splice-node bundle 0.4.20.

---

<div class="post-metadata">

**Author:** ![WallaceKelly](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/wallacekelly/32/5046_2.png) [@WallaceKelly](https://forum.canton.network/u/WallaceKelly)\
**Post date:** [October 13, 2025, 6:17pm UTC](https://forum.canton.network/t/grpc-api-submit-and-wait-for-archive-choice/8230/4 "2025-10-13T18:17:20Z")

</div>

As a point of comparison, here is a **JSON Ledger API** request to _archive_ a contract:

`POST v2/commands/submit-and-wait`

```json
{
  "commandId": "command02",
  "commands": [
    {
      "ExerciseCommand": {
        "templateId": "#AdminWorkflows:Canton.Internal.Ping:Ping",
        "contractId": "{{contractId}}",
        "choice": "Archive",
        "choiceArgument": {}
      }
    }
  ],
  "actAs": [
    "{{appUserParty}}"
  ]
}

```

To confirm, you can use the following requests to _create_ and _query_ for a simple contract:

> **create contract**
>
> `POST v2/commands/submit-and-wait`
> 
> ```json
> {
> "commandId": "command01",
> "commands": [
> {
> "CreateCommand": {
> "templateId": "#AdminWorkflows:Canton.Internal.Ping:Ping",
> "createArguments": {
> "id": "testing",
> "initiator": "{{appUserParty}}",
> "responder": "{{appUserParty}}"
> }
> }
> }
> ],
> "actAs": [
> "{{appUserParty}}"
> ]
> }
> 
> ```

> **query by update-id**
>
> `POST /v2/updates/update-by-id`
> 
> ```json
> {
> "updateId": "{{updateId}}",
> "updateFormat": {
> "includeTransactions": {
> "transactionShape": "TRANSACTION_SHAPE_LEDGER_EFFECTS",
> "eventFormat": {
> "verbose": false,
> "filtersByParty": {
> "{{appUserParty}}": {
> "cumulative": [
> {
> "identifierFilter": {
> "TemplateFilter": {
> "value": {
> "includeCreatedEventBlob": false,
> "templateId": "#AdminWorkflows:Canton.Internal.Ping:Ping"
> }
> }
> }
> }
> ]
> }
> }
> }
> }
> }
> }
> 
> ```

> **query acs**
>
> `POST /v2/state/active-contracts`
> 
> ```json
> {
> "verbose": false,
> "activeAtOffset": "{{ledgerEndOffset}}",
> "filter": {
> "filtersByParty": {
> "{{appUserParty}}": {
> "cumulative": [
> {
> "identifierFilter": {
> "TemplateFilter": {
> "value": {
> "includeCreatedEventBlob": false,
> "templateId": "#AdminWorkflows:Canton.Internal.Ping:Ping"
> }
> }
> }
> }
> ]
> }
> }
> }
> }
> 
> ```

These were created with the splice-node bundle 0.4.20.

---

<div class="post-metadata">

**Author:** ![David\_Martins](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/david_martins/32/1792_2.png) [@David\_Martins](https://forum.canton.network/u/David_Martins)\
**Post date:** [October 14, 2025, 8:46am UTC](https://forum.canton.network/t/grpc-api-submit-and-wait-for-archive-choice/8230/5 "2025-10-14T08:46:19Z")

</div>

Hello @WallaceKelly, thank you for your reply,

The change from “unit“ to “record“ did work as intended, however, I believe the error in question was a bit opaque, as it did not refer to what it was expecting instead of the “ValueUnit“.

In any case thanks for the resolution, I’ll close the topic.
