---
title: "Buy an asset on the NFT marketplace"
method: POST
path: "/v3/blockchain/marketplace/listing/buy"
tags: ["Marketplace"]
---

# Buy an asset on the NFT marketplace

`POST /v3/blockchain/marketplace/listing/buy`

## Request

- Base URL: `https://api.tatum.io`
- URL: `https://api.tatum.io/v3/blockchain/marketplace/listing/buy`
- Auth: API key in header `x-api-key`

/v3/blockchain/marketplace/listing/buy

**2 credits per API call**

Buy an asset listed on the NFT marketplace.

You can buy the asset either for the native blockchain currency (for example, ETH, MATIC, and so on) or for the fungible tokens of the blockchain.

*   If you want to pay for the asset with the **native blockchain currency**, send the required amount plus the marketplace fee right in the API call (in the `amount` request body parameter).
*   If you want to pay with the **fungible tokens**, [allow the marketplace smart contract to access your tokens](https://apidoc.tatum.io/tag/Fungible-Tokens-\(ERC-20-or-compatible\)#operation/Erc20Approve) before making the purchase. When you make the API call, the marketplace smart contract will deduct the required amount of the tokens from the smart contract where you hold the tokens.

This API is supported for the following blockchains:

*   BNB Smart Chain
*   Celo
*   Ethereum
*   Harmony
*   Klaytn
*   Polygon
*   Solana (in **alpha**)

**The "execution reverted" message**  
When making this API call, you may get the following message:  
`Although one or more Error Occurred [execution reverted] Contract Execution Completed`  
This message is a result of the marketplace version check and has no impact on completing the API call. You can safely ignore it.

**Signing a transaction**  
When buying an asset on the NFT marketplace, you are charged a fee for the transaction, and you must sign the transaction with the private key of the blockchain address from which the fee will be deducted.

Providing the private key in the API is not a secure way of signing transactions, because the private key can be stolen or exposed. Your private keys should never leave your security perimeter. You should use the private keys only for testing a solution you are building on the **testnet** of a blockchain.

For signing transactions on the **mainnet**, we strongly recommend that you use the Tatum [Key Management System (KMS)](https://github.com/tatumio/tatum-kms) and provide the signature ID instead of the private key in the API. Alternatively, you can use the [Tatum JavaScript client](https://github.com/tatumio/tatum-js/tree/v2).

## Request body

- union
  - BuyAssetOnMarketplace
    - `chain` 'BSC' | 'ETH' | 'KLAY' | 'MATIC' | 'ONE', required: The blockchain to work with
    - `contractAddress` string, required: The blockchain address of the marketplace smart contract
    - `listingId` string, required: The ID of the listing with the asset that you want to buy
    - `fromPrivateKey` string, required: The private key of the blockchain address from which the fee will be deducted
    - `amount` string: (Only if you pay with the native blockchain currency) The price of the asset that you want to buy plus the marketplace fee. Do not use if you pay with fungible tokens.
    - `erc20Address` string: (Only if you pay with the fungible tokens) The blockchain address of the fungible tokens. Do not use if you pay with the native blockchain currency.
    - `buyer` string: (Only if you want to buy the asset on behalf of someone else and this person wants to pay with the fungible tokens; for example, for buying the asset from a custodial wallet address) The blockchain address of the buyer on whose behalf you are buying the asset<br/>The buyer must <a href="https://apidoc.tatum.io/tag/Fungible-Tokens-(ERC-20-or-compatible)#operation/Erc20Approve" target="_blank">allow the marketplace smart contract to access their tokens</a> before you make the purchase.
    - `nonce` number: The nonce to be set to the transaction; if not present, the last known nonce will be used
    - `fee` CustomFee: The custom defined fee; if not present, will be calculated automatically
      - `gasPrice` string, required: The price for one gas unit (in Gwei)
      - `gasLimit` string, required: The maximum number of gas units that you are willing to spend on processing the transaction at the provided gas price
  - BuyAssetOnMarketplaceKMS
    - `chain` 'BSC' | 'ETH' | 'KLAY' | 'MATIC' | 'ONE', required: The blockchain to work with
    - `contractAddress` string, required: The blockchain address of the marketplace smart contract
    - `listingId` string, required: The ID of the listing with the asset that you want to buy
    - `signatureId` string, uuid, required: The KMS identifier of the private key of the blockchain address from which the fee will be deducted
    - `index` number: (Only if the signature ID is mnemonic-based) The index of the address from which the fee will be deducted that was generated from the mnemonic
    - `amount` string: (Only if you pay with the native blockchain currency) The price of the asset that you want to buy plus the marketplace fee. Do not use if you pay with fungible tokens.
    - `erc20Address` string: (Only if you pay with the fungible tokens) The blockchain address of the fungible tokens. Do not use if you pay with the native blockchain currency.
    - `buyer` string: (Only if you want to buy the asset on behalf of someone else and this person wants to pay with the fungible tokens; for example, for buying the asset from a custodial wallet address) The blockchain address of the buyer on whose behalf you are buying the asset<br/>The buyer must <a href="https://apidoc.tatum.io/tag/Fungible-Tokens-(ERC-20-or-compatible)#operation/Erc20Approve" target="_blank">allow the marketplace smart contract to access their tokens</a> before you make the purchase.
    - `nonce` number: The nonce to be set to the transaction; if not present, the last known nonce will be used
    - `fee` CustomFee: The custom defined fee; if not present, will be calculated automatically
      - `gasPrice` string, required: The price for one gas unit (in Gwei)
      - `gasLimit` string, required: The maximum number of gas units that you are willing to spend on processing the transaction at the provided gas price
  - BuyAssetOnMarketplaceCelo
    - `chain` 'CELO', required: The blockchain to work with
    - `contractAddress` string, required: The blockchain address of the marketplace smart contract
    - `listingId` string, required: The ID of the listing with the asset that you want to buy
    - `feeCurrency` 'CELO' | 'CUSD' | 'CEUR', required: The currency in which the transaction fee will be paid
    - `fromPrivateKey` string, required: The private key of the blockchain address from which the fee will be deducted
    - `amount` string: (Only if you pay with the native blockchain currency) The price of the asset that you want to buy plus the marketplace fee. Do not use if you pay with fungible tokens.
    - `erc20Address` string: (Only if you pay with the fungible tokens) The blockchain address of the fungible tokens. Do not use if you pay with the native blockchain currency.
    - `buyer` string: (Only if you want to buy the asset on behalf of someone else and this person wants to pay with the fungible tokens; for example, for buying the asset from a custodial wallet address) The blockchain address of the buyer on whose behalf you are buying the asset<br/>The buyer must <a href="https://apidoc.tatum.io/tag/Fungible-Tokens-(ERC-20-or-compatible)#operation/Erc20Approve" target="_blank">allow the marketplace smart contract to access their tokens</a> before you make the purchase.
    - `nonce` number: The nonce to be set to the transaction; if not present, the last known nonce will be used
    - `fee` CustomFee: The custom defined fee; if not present, will be calculated automatically
      - `gasPrice` string, required: The price for one gas unit (in Gwei)
      - `gasLimit` string, required: The maximum number of gas units that you are willing to spend on processing the transaction at the provided gas price
  - BuyAssetOnMarketplaceCeloKMS
    - `chain` 'CELO', required: The blockchain to work with
    - `contractAddress` string, required: The blockchain address of the marketplace smart contract
    - `listingId` string, required: The ID of the listing with the asset that you want to buy
    - `feeCurrency` 'CELO' | 'CUSD' | 'CEUR', required: The currency in which the transaction fee will be paid
    - `signatureId` string, uuid, required: The KMS identifier of the private key of the blockchain address from which the fee will be deducted
    - `index` number: (Only if the signature ID is mnemonic-based) The index of the address from which the fee will be deducted that was generated from the mnemonic
    - `amount` string: (Only if you pay with the native blockchain currency) The price of the asset that you want to buy plus the marketplace fee. Do not use if you pay with fungible tokens.
    - `erc20Address` string: (Only if you pay with the fungible tokens) The blockchain address of the fungible tokens. Do not use if you pay with the native blockchain currency.
    - `buyer` string: (Only if you want to buy the asset on behalf of someone else and this person wants to pay with the fungible tokens; for example, for buying the asset from a custodial wallet address) The blockchain address of the buyer on whose behalf you are buying the asset<br/>The buyer must <a href="https://apidoc.tatum.io/tag/Fungible-Tokens-(ERC-20-or-compatible)#operation/Erc20Approve" target="_blank">allow the marketplace smart contract to access their tokens</a> before you make the purchase.
    - `nonce` number: The nonce to be set to the transaction; if not present, the last known nonce will be used
    - `fee` CustomFee: The custom defined fee; if not present, will be calculated automatically
      - `gasPrice` string, required: The price for one gas unit (in Gwei)
      - `gasLimit` string, required: The maximum number of gas units that you are willing to spend on processing the transaction at the provided gas price
  - BuyAssetOnMarketplaceSolana
    - `chain` 'SOL', required: The blockchain to work with
    - `contractAddress` string, required: The blockchain address of the marketplace smart contract
    - `listingId` string, required: The blockchain address of the listing with the asset that you want to buy
    - `from` string, required: The blockchain address of the buyer
    - `authorityPrivateKey` string: The private key used for signing transactions as authority; required if <code>requiresSignOff</code> is set to "true" for the marketplace
    - `fromPrivateKey` string, required: The private key of the buyer
  - BuyAssetOnMarketplaceSolanaKMS
    - `chain` 'SOL', required: The blockchain to work with
    - `contractAddress` string, required: The blockchain address of the marketplace smart contract
    - `listingId` string, required: The blockchain address of the listing with the asset that you want to buy
    - `from` string, required: The blockchain address of the buyer
    - `authoritySignatureId` string, uuid: The KMS identifier of the private key used for signing transactions as authority; required if <code>requiresSignOff</code> is set to "true" for the marketplace
    - `signatureId` string, uuid, required: The KMS identifier of the private key of the buyer

## Response `200`

OK

- union
  - TransactionHash
    - `txId` string, required: The hash (ID) of the transaction
  - SignatureId
    - `signatureId` string, uuid, required: The internal Tatum ID of the prepared transaction for Key Management Sysytem (KMS) to sign<br/>This is different from the <code>signatureId</code> parameter that you provided in the request body. The <code>signatureId</code> parameter in the request body specifies the signature ID associated with the private key in KMS.

## Other responses

- `400`: Bad Request
- `401`: Unauthorized. Not valid or inactive subscription key present in the HTTP Header.
- `403`: Forbidden. The request is authenticated, but it is not possible to perform the operation due to logical error or invalid permissions.
- `500`: Internal server error. There was an error on the server during the processing of the request.

---

[API](https://skmtc.dev/tatum/apis/smart-contracts.md) - [All operations](https://skmtc.dev/tatum/apis/smart-contracts/llms.txt) - [OpenAPI document](https://skmtc.dev/tatum/apis/smart-contracts/revisions/c0146043bb37?raw)
