# Get contract packages

Get a paginated list of contract packages.

```
GET /contract-packages
```

This endpoint allows you to retrieve a paginated list of contract packages. You can filter the results by owner public key, specify the page number and size, and choose the sorting order and field. Additionally, you can include optional deploys number data in the response. The example shows a sample response with relevant details for each contract package, including contract package hash, owner public key, name, description, metadata, latest version contract type ID, timestamp, icon URL, and deploys number.

## Query params

| Query param        | Description              |
| ------------------ | ------------------------ |
| `owner_public_key` | Owner public key filter. |

## Sorting

| Property    | Description                          |
| ----------- | ------------------------------------ |
| `timestamp` | Sort contract packages by timestamp. |

Default sorting is `timestamp DESC`

## Optional properties

| Property         | Type  | Description                                                                                                                                                                                                                |
| ---------------- | ----- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `deploys_number` | `int` | Number of deploys in the specified number of the past days. It's a [function includer](https://docs.cspr.cloud/1.2.x/documentation/overview/optional-properties#functions) that accepts the number of days as an argument. |

## Response

[`PaginatedResponse`](https://docs.cspr.cloud/1.2.x/documentation/overview/pagination)[`<ContractPackage>`](https://docs.cspr.cloud/1.2.x/rest-api/contract-package)

## Example

```bash
curl -X 'GET' \
  'https://api.testnet.cspr.cloud/contract-packages' \
  -H 'Accept: application/json' \
  -H 'Authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
```

```json
{
  "data": [
    {
      "contract_package_hash": "ae2feaa4e86841c1c6f40f1779e1e1cb1d9d4d52a0eb82a8962829646524e744",
      "owner_public_key": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01",
      "name": "MyContractPackage1",
      "description": "A sample contract package",
      "metadata": {
        "name": "MyToken1",
        "symbol": "MT1",
        "decimals": 18,
        "balances_uref": "uref-0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef-007",
        "total_supply_uref": "uref-abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef-007",
        "ownership_mode": 1,
        "nft_kind": 2,
        "nft_metadata_kind": 1,
        "whitelist_mode": 0,
        "holder_mode": 1,
        "minting_mode": 2,
        "burn_mode": 1,
        "identifier_mode": 0,
        "metadata_mutability": 1,
        "owner_reverse_lookup_mode": 1,
        "events_mode": 2
      },
      "latest_version_contract_type_id": 3,
      "timestamp": "2023-01-01T12:00:00Z",
      "icon_url": "https://example.com/icon1.png",
      "deploys_number": 42
    },
    {
      "contract_package_hash": "be2feaa4e86841c1c6f40f1779e1e1cb1d9d4d52a0eb82a8962829646524e745",
      "owner_public_key": "abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
      "name": "MyContractPackage2",
      "description": "Another sample contract package",
      "metadata": {
        "name": "MyToken2",
        "symbol": "MT2",
        "decimals": 18,
        "balances_uref": "uref-abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef-007",
        "total_supply_uref": "uref-0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef-007",
        "ownership_mode": 1,
        "nft_kind": 2,
        "nft_metadata_kind": 1,
        "whitelist_mode": 0,
        "holder_mode": 1,
        "minting_mode": 2,
        "burn_mode": 1,
        "identifier_mode": 0,
        "metadata_mutability": 1,
        "owner_reverse_lookup_mode": 1,
        "events_mode": 2
      },
      "latest_version_contract_type_id": 4,
      "timestamp": "2023-01-02T12:00:00Z",
      "icon_url": "https://example.com/icon2.png",
      "deploys_number": 56
    },
    ...
  ],
  "item_count": 100,
  "page_count": 10
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cspr.cloud/1.2.x/rest-api/contract-package/get-contract-packages.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
