Skip to main content

Marketapp API Python SDK

Async Python library for Marketapp.ws automation
v1.1.0 — Pydantic V2 | Auto-Pay Integration | Full Marketplace & Rent

PyPI Python Versions Downloads License


Features

  • Async-first — Fast and modern async/await support via MarketappClient.
  • Pydantic Models — All API requests and responses are strictly typed and validated using Pydantic V2.
  • Auto-Pay Engine — Built-in tonutils integration! Automatically sign and broadcast TON transactions for purchases, listings, and rent without manual BOC handling.
  • NFT Marketplace — Buy, sell, cancel sales, and change prices. Support for listing directly to Fragment.
  • Rent System — Full API coverage for renting out and renting Usernames, Anonymous Numbers, and Gifts.
  • Fragment Operations — Buy Telegram Stars, Premium, run Giveaways, and top up Ads/Telegram balances directly via Marketapp API.
  • TonConnect Bridge — Connect your rented NFTs to Fragment via API.
  • Graceful Error Handling — Beautiful exceptions for API validations, network issues, and blockchain seqno/balance errors.

Installation

pip install marketapp-api

Requirements:

  • Python 3.9+
  • Marketapp API Token (Get it at Marketapp API Token)
  • (Optional for Auto-Pay) TON wallet seed phrase (12/18/24 words) and a Tonconsole/Toncenter API key.

Quick Start

Read-Only Mode (No Wallet)

If you only need to parse data or generate raw transaction payloads:

import asyncio
from MarketappAPI import MarketappClient

async def main():
    async with MarketappClient(api_token="your_marketapp_token") as client:
        # Fetch collections
        collections = await client.list_collections()
        print(f"Found {len(collections)} collections.")
        
        # Get NFTs on sale
        gifts = await client.get_gifts_on_sale(limit=5)
        for item in gifts.items:
            print(f"{item.name} is selling for {item.min_bid} {item.currency}")

asyncio.run(main())

Auto-Pay Mode (With Wallet)

The library can automatically sign and execute transactions when a wallet seed is provided:

import asyncio
from MarketappAPI import MarketappClient
from MarketappAPI.types.models import BuyNFTBody, SaleNFTData

async def main():
    client = MarketappClient(
        api_token="your_marketapp_token",
        seed="word1 word2 ... word24",
        api_key="YOUR_TONAPI_KEY",
        wallet_version="V5R1" # or "V4R2"
    )
    
    # 1. Buy an NFT (Auto-pays and waits for blockchain confirmation)
    buy_body = BuyNFTBody(data=[
        SaleNFTData(nft_address="EQ...nft_address", price=5.5)
    ])
    
    print("Sending transaction...")
    result = await client.buy_nft(buy_body)
    
    if result.confirmed:
        print(f"Success! TX Hash: {result.tx_hash}")
        print(f"Balance after: {result.balance_after} GRAM")

asyncio.run(main())

API Overview

Collections & Info

Method Description
list_collections() List all supported collections
gift_collections() List Gift collections
get_collection_attributes() Get all attributes and floors for a collection
nft_info() Detailed info and status for a specific NFT

NFT Marketplace

Method Description
put_up_for_sale() List an NFT for sale
fragment_sale() List an NFT visible on Fragment
fragment_auction() Start a Fragment auction
change_price() Update sale price
cancel_sale() Cancel active sale
buy_nft() Buy an NFT
collection_nfts() Browse NFTs on sale by collection
nfts_by_owner() Get NFTs owned by address

Rent System

Method Description
get_gifts_available_for_rent() Browse Gifts for rent
get_usernames_available_for_rent() Browse Usernames for rent
get_numbers_available_for_rent() Browse Numbers for rent
rent_out_gifts/usernames/numbers() List your items for rent
update_*_settings() Update rent duration/prices
rent_nft() Pay to rent an item
extend_rent_nft() Extend current rental duration
cancel_rent() Cancel rent listing
connect_tonconnect() Link rented NFT to Fragment via TonConnect
get_login_code() Fetch TG login code for rented +888 number

Fragment & Stars

Method Description
get_stars_prices() Get Telegram Stars pricing
buy_stars() Buy Stars for a user
buy_stars_giveaway() Run a Stars giveaway
buy_premium() Buy Telegram Premium
ads_topup() Top up Fragment Ads account
telegram_topup() Top up Telegram bot/account balance

All actions that mutate state (buy_nft, put_up_for_sale, buy_stars, etc.) accept an optional auto_pay=False parameter if you want to receive the raw SendTxSchema payload instead of executing the transaction.


Exceptions

All exceptions inherit from MarketappError:

Exception Description
ConfigurationError Invalid client configuration (e.g., missing API token)
APIError General API or network error (e.g., 502 Bad Gateway)
ValidationError HTTP 422 - Invalid request body or parameters
TransactionError TON transaction failed to build or broadcast
WalletError Insufficient balance or failure fetching wallet state
ConfirmationTimeout Transaction sent but not confirmed in time
SeqnoError Failed to fetch seqno from the blockchain

Support & License

Issues: GitHub Issues

Support the Project:

Donate GRAM

UQBsyxZvyQxDwAeOxoaWwO2HJoAmCKUoJlS_OpLzWHD9i2Xj

License: MIT — free for commercial and personal use.


GitHub

Metadata

Release files for marketapp-api 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for marketapp-api 1.0.1
File Size Uploaded Provenance Actions
marketapp_api-1.0.1.tar.gz 16.6 kB Without provenance Details for marketapp_api-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for marketapp-api 1.0.1
File Interpreter ABI Platform Actions
marketapp_api-1.0.1-py3-none-any.whl Python 3 none any Details for marketapp_api-1.0.1-py3-none-any.whl

Total release size: 38.3 kB

Release files / marketapp_api-1.0.1.tar.gz

Download URL marketapp_api-1.0.1.tar.gz
Size 16.6 kB
Tags Source
SHA-256 checksum
How to use checksums
afcc02b10d76ba08f036c2b3e277034b9d46f920f70990565e53442bcfee3766
BLAKE2b-256 checksum
How to use checksums
e98bb206a203db7ba39c78843bd1b54077f9c6270bc2c713ded72def19ab3935
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.34.2

Release files / marketapp_api-1.0.1-py3-none-any.whl

Download URL marketapp_api-1.0.1-py3-none-any.whl
Size 21.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9dddee2e5e5503bec340a295e658886b08e9f77011cc9da951b219637f1077bc
BLAKE2b-256 checksum
How to use checksums
272e05172f02a1164a71c04b44667d57223bc6b8416c91de688d340b9e3b3aaa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.34.2

Security for marketapp-api 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page