https://github.com/tonkeeper/pytonapi
TonAPI SDK allows developers to build decentralized applications on top of the TON blockchain without having to deal with the complexity of the underlying technology.
https://github.com/tonkeeper/pytonapi
the-open-network ton tonapi tonconsole
Last synced: 5 days ago
JSON representation
TonAPI SDK allows developers to build decentralized applications on top of the TON blockchain without having to deal with the complexity of the underlying technology.
- Host: GitHub
- URL: https://github.com/tonkeeper/pytonapi
- Owner: tonkeeper
- License: mit
- Created: 2023-05-03T14:55:51.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2025-07-10T17:23:05.000Z (8 months ago)
- Last Synced: 2026-01-01T15:22:40.885Z (2 months ago)
- Topics: the-open-network, ton, tonapi, tonconsole
- Language: Python
- Homepage: https://pypi.org/project/pytonapi/
- Size: 277 KB
- Stars: 175
- Watchers: 5
- Forks: 37
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 📦 PyTONAPI
[](https://ton.org)
[](https://pypi.python.org/pypi/pytonapi)

[](https://github.com/tonkeeper/pytonapi/blob/main/LICENSE)




Python SDK for [tonapi.io](https://tonapi.io).\
Information about the API can be found in the [documentation](https://docs.tonconsole.com/tonapi/api-v2).\
To use the API **you need an API key**, you can get it here [tonconsole.com](https://tonconsole.com/).
For creating wallets, transferring TON, Jetton, NFTs, and other operations, recommend using tonutils in combination with TonapiClient. For more information, refer to the library documentation.
## Usage
### Installation
```bash
pip install pytonapi
```
### Examples
```python
from pytonapi import AsyncTonapi
# Declare an asynchronous function for using await
async def main():
# Create a new Tonapi object with the provided API key
tonapi = AsyncTonapi(api_key="Your API key")
# Specify the account ID
account_id = "EQC-3ilVr-W0Uc3pLrGJElwSaFxvhXXfkiQA3EwdVBHNNess" # noqa
# Retrieve account information asynchronously
account = await tonapi.accounts.get_info(account_id=account_id)
# Print account details
print(f"Account Address (raw): {account.address.to_raw()}")
print(f"Account Address (userfriendly): {account.address.to_userfriendly(is_bounceable=True)}")
print(f"Account Balance (nanoton): {account.balance.to_nano()}")
print(f"Account Balance (amount): {account.balance.to_amount()}")
if __name__ == '__main__':
import asyncio
# Run the asynchronous function
asyncio.run(main())
```
* **Additional examples** can be found [examples](https://github.com/tonkeeper/pytonapi/tree/main/examples) folder.
## Donations
**TON** - `UQCDrgGaI6gWK-qlyw69xWZosurGxrpRgIgSkVsgahUtxZR0`
**USDT** (TRC-20) - `TDHMG7JRkmJBDD1qd4bNhdfoy2uzVd8ixA`
## Contribution
We welcome your contributions! If you have ideas for improvement or have identified a bug, please create an issue or
submit a pull request.
## Support
Supported by [TONAPI](https://tonapi.io) and [TON Society](https://github.com/ton-society/grants-and-bounties) (Grants
and Bounties program).
## License
This repository is distributed under the [MIT License](https://github.com/tonkeeper/pytonapi/blob/main/LICENSE). Feel
free to use, modify, and distribute the code in accordance
with the terms of the license.