---
title: "POST /v2/interactive-submission/preferred-packages"
method: POST
path: "/v2/interactive-submission/preferred-packages"
---

# POST /v2/interactive-submission/preferred-packages

`POST /v2/interactive-submission/preferred-packages`

Compute the preferred packages for the vetting requirements in the request.
A preferred package is the highest-versioned package for a provided package-name
that is vetted by all the participants hosting the provided parties.

Ledger API clients should use this endpoint for constructing command submissions
that are compatible with the provided preferred packages, by making informed decisions on:
- which are the compatible packages that can be used to create contracts
- which contract or exercise choice argument version can be used in the command
- which choices can be executed on a template or interface of a contract

If the package preferences could not be computed due to no selection satisfying the requirements,
a `FAILED_PRECONDITION` error will be returned.

Can be accessed by any Ledger API client with a valid token when Ledger API authorization is enabled.

Experimental API: this endpoint is not guaranteed to provide backwards compatibility in future releases

## Request body

- GetPreferredPackagesRequest
  - `packageVettingRequirements` PackageVettingRequirement[], required — The package-name vetting requirements for which the preferred packages should be resolved. Generally it is enough to provide the requirements for the intended command's root package-names. Additional package-name requirements can be provided when additional Daml transaction informees need to use package dependencies of the command's root packages. Required: must be non-empty
    - `parties` string[], required — The parties whose participants' vetting state should be considered when resolving the preferred package. Required: must be non-empty
    - `packageName` string, required — The package-name for which the preferred package should be resolved. Required
  - `synchronizerId` string — The synchronizer whose vetting state should be used for resolving this query. If not specified, the vetting states of all synchronizers to which the participant is connected are used. Optional
  - `vettingValidAt` string — The timestamp at which the package vetting validity should be computed on the latest topology snapshot as seen by the participant. If not provided, the participant's current clock time is used. Optional

## Response `200`

- GetPreferredPackagesResponse
  - `packageReferences` PackageReference[], required — The package references of the preferred packages. Must contain one package reference for each requested package-name. If you build command submissions whose content depends on the returned preferred packages, then we recommend submitting the preferred package-ids in the ``package_id_selection_preference`` of the command submission to avoid race conditions with concurrent changes of the on-ledger package vetting state. Required: must be non-empty
    - `packageId` string, required — Required
    - `packageName` string, required — Required
    - `packageVersion` string, required — Required
  - `synchronizerId` string, required — The synchronizer for which the package preferences are computed. If the synchronizer_id was specified in the request, then it matches the request synchronizer_id. Required

## Other responses

- `400` — Invalid value, Invalid value for: body
- `default`

---

[API](https://skmtc.dev/canton/apis/json-ledger-api-http-endpoints.md) · [All operations](https://skmtc.dev/canton/apis/json-ledger-api-http-endpoints/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/canton/json-ledger-api-http-endpoints/revisions/296292e8b8f1/schema)
