Transfer NFTs Using Python
This tutorial shows how to move an NFT from one account to another with buy and sell offers, using a Python sample app. You create offers, accept them, list the offers for an NFT and cancel an offer.
- Section
- Tutorials
What you need
Download the Quickstart Samples archive, then open and run lesson4-transfer-tokens.py. Choose Testnet or Devnet. The app works with two test accounts, called the Standby account and the Operational account. You can load them from seeds you already have or get new ones.
Selling an NFT
Enter the amount of the sell offer in drops, which are millionths of an XRP, and the NFT ID. You can add a Destination account, the only account that can accept the offer, and a number of seconds until the offer expires. Click Create Sell Offer, then Get Offers. The response holds the NFT Offer Index, labeled nft_offer_index. Another account enters that index and clicks Accept Sell Offer to buy the NFT. Click Get NFTs for each account to see that the NFT has moved.
Buying an NFT
Enter the amount of your offer, the NFT ID and the owner's account, then click Create Buy Offer. The owner finds the offer's nft_offer_index with Get Offers, enters it and clicks Accept Buy Offer.
Listing and cancelling offers
Enter the NFT ID and click Get Offers to list its buy and sell offers. This is a request, not a transaction, so it needs no wallet. To cancel an offer you created, enter its index and click Cancel Offer.
Good to know
The nft_offer_index is different from the NFTokenID. In the code, a flags value of 1 marks a sell offer and 0 marks a buy offer. The creator of an offer can cancel it at any time before it is accepted, and anyone can cancel an expired offer.
Source: xrpl.org. Read 6 December 2026.
Zerpedia states what the source says, in plain words, and gives no opinion. How Zerpedia is made