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

# GET /v2/interactive-submission/preferred-package-version

> Get the preferred package version for constructing a command submission. A preferred package is the highest-versioned package for a provided package-name that is vetted by all the participants hosting the provided parties.

JSON Ledger API

# GET /v2/interactive-submission/preferred-package-version

OpenAPI

[Updated 3.6](#history-updated-3-6)

[Deprecated 3.5](#history-deprecated-3-5)

[Removed in 3.7](#history-removed-3-7)

GET

`/v2/interactive-submission/preferred-package-version`

**Removed in 3.7.** Historical definition from 3.6.

Get the preferred package version for constructing a command submission. A preferred package is the highest-versioned package for a provided package-name that is vetted by all the participants hosting the provided parties.

## Protocol Details

Operation ID
getV2Interactive-submissionPreferred-package-version

Authentication
Bearer token

Published
3.6

## Inputs

### Query parameters

`parties`
string\[]

`package-name`
string

required

`vetting_valid_at`
string (date-time)

`synchronizer-id`
string

## Outputs

### 200

application/json

`packagePreference`
PackagePreference

Not populated when no preferred package is found Optional

### 400

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

Removed in
`3.7`

Last available in 3.6. Retained for historical reference.

Updated
`3.6`

The GET /v2/interactive-submission/preferred-package-version operation changed in this snapshot.

Deprecated
`3.5`

Updated
`3.5`

The GET /v2/interactive-submission/preferred-package-version operation changed in this snapshot.

cURL

```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl --request GET \
  --url 'http://localhost:7575/v2/interactive-submission/preferred-package-version' \
  --header 'Authorization: Bearer $TOKEN'
```

Python

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

url = "http://localhost:7575/v2/interactive-submission/preferred-package-version"
headers = {'Authorization': 'Bearer <token>'}
response = requests.request("GET", url, headers=headers)

print(response.text)
```

JavaScript

```javascript JavaScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
const response = await fetch('http://localhost:7575/v2/interactive-submission/preferred-package-version', {
  method: 'GET',
  headers: {
  "Authorization": "Bearer <token>"
},
});

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

PHP

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

curl_setopt_array($curl, [
    CURLOPT_URL => 'http://localhost:7575/v2/interactive-submission/preferred-package-version',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer <token>"
    ],
]);

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

Go

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

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

func main() {
  req, _ := http.NewRequest("GET", "http://localhost:7575/v2/interactive-submission/preferred-package-version", nil)
  req.Header.Set("Authorization", "Bearer <token>")
  response, _ := http.DefaultClient.Do(req)
  defer response.Body.Close()
  body, _ := io.ReadAll(response.Body)
  fmt.Println(string(body))
}
```

Java

```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/interactive-submission/preferred-package-version"))
    .header("Authorization", "Bearer <token>")
    .method("GET", HttpRequest.BodyPublishers.noBody())
    .build();
var response = HttpClient.newHttpClient().send(
    request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
```

Ruby

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

uri = URI('http://localhost:7575/v2/interactive-submission/preferred-package-version')
request = Net::HTTP::Get.new(uri)
request['Authorization'] = 'Bearer <token>'
response = Net::HTTP.start(uri.hostname, uri.port) do |http|
  http.request(request)
end
puts response.body
```

200

application/json

```json 200 theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "packagePreference": {
    "packageReference": {
      "packageId": "<string>",
      "packageName": "<string>",
      "packageVersion": "<string>"
    },
    "synchronizerId": "<string>"
  }
}
```

400

text/plain

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

default

application/json

```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
}
```
