> ## Documentation Index
> Fetch the complete documentation index at: https://developers.circle.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Getting started with the Contracts Python SDK

Use the [Python SDK](https://pypi.org/project/circle-smart-contract-platform/)
to interact with [Contracts APIs](/api-reference/contracts/common/ping), which
allow you interact with smart contracts on the blockchain using the Developer
Services platform.

This page provides short examples of how to install and use the Smart Contract
Platform SDK. For complete examples, see the [Sample Projects](/sample-projects)
page. For more information see the [Contracts documentation](/contracts).

<Warning>
  **Pydantic v2 upgrade**

  Starting from major version 9, the Python SDK uses Pydantic v2. This change
  brings performance improvements, enhanced features, and bug fixes.

  If you are already using the SDK, and choose to upgrade to major version 9, you
  may need to make some changes to your code.

  For more information, see
  [Server-side SDK Pydantic v2 upgrade](/sdks/pydantic-v2-upgrade).
</Warning>

## Prerequisites

To use the Python SDK, ensure you have:

* Python installed.
* A [Circle Developer Console](https://console.circle.com) account
* An [API key](/build/keys) created in the Console:\
  **Keys → Create a key → API key → Standard Key**
* Your
  [Entity Secret registered](https://developers.circle.com/wallets/dev-controlled/register-entity-secret)

Although not a requirement for using the SDK, Circle recommends that you
[use a virtual environment](https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/)
for development. A Python virtual environment is an isolated environment that
you can use to silo your project from the global Python environment.

## Install the SDK

Use the following command to install the SDK with
[pip](https://pypi.org/project/pip/):

```shell theme={null}
pip install circle-smart-contract-platform
```

## Contracts client

To start using the SDK, you first need to configure a client and initialize it
with your API key and entity secret.

### Import the client

The following example shows how to import the client and configure it to use
your API key and entity secret:

```python theme={null}
from circle.web3 import utils

client = utils.init_smart_contract_platform_client(
  api_key="Your API KEY",
  entity_secret="Your entity secret"
)
```

### Import a smart contract

The following example shows how to import a smart contract using the client:

```python theme={null}
from circle.web3 import smart_contract_platform

api_instance = smart_contract_platform.DeployImportApi(client)

# import contract
try:
    request = smart_contract_platform.ImportContractRequest.from_dict({
        "name": "UChildERC20Proxy",
        "address": "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",
        "blockchain": "MATIC"
    })
    response = api_instance.import_contract(request)
    print(response)
except smart_contract_platform.ApiException as e:
    print("Exception when calling DeployImportApi->import_contract: %s\n" % e)
```

## Client configuration options

The client for the Contracts SDK accepts the following configuration parameters:

| **Option**      | **Required?** | **Description**                                                                                 |
| --------------- | ------------- | ----------------------------------------------------------------------------------------------- |
| `api_key`       | Yes           | The API key used to authenticate requests to the Circle API.                                    |
| `entity_secret` | Yes           | Your configured entity secret.                                                                  |
| `host`          | No            | The base URL that overrides the default API URL of `https://api.circle.com/v1/w3s`.             |
| `user_agent`    | No            | Custom user agent request header. If provided, it's added before the default user agent header. |
