List ordinals for sale

This endpoint is used to list one or more ordinals for sale on the marketplace. The endpoint returns a Partially Signed Bitcoin Transaction (PSBT) which the owner must sign. If someone buys the ordinal, the buyer must supply the unspent transaction output (UTXO) covering the ordinal's price and any applicable fees. The seller's signature is required only during the initial listing, while only the buyer's signature is necessary for completing the purchase. Platform Cost: A platform fee is applied only when an ordinal is sold. It is not charged for listing an ordinal. The current fee is 1% of sale amount charged to the seller.

The response from this endpoint is a PSBT, encoded in base64, which the Ordinal owner's wallet needs to sign.

Here's an example of how you can sign a listing transaction with the Xverse wallet:

      
      // XVerse Wallet example of creating a signing request 
      // when listing an Ordinal for sale
      const sellerInput = {
        address: ordinalsAddress, // Seller's ordinal wallet address
        signingIndexes: [0], // always [0] when listing
        // Specify sigHash type as SIGHASH_SINGLE | SIGHASH_ANYONECANPAY
        sigHash: bitcoin.Transaction.SIGHASH_SINGLE | bitcoin.Transaction.SIGHASH_ANYONECANPAY,
      };

      // Create the listing PSBT by calling /marketplace/create-listing API
      // This returns a base64 PSBT in string format which needs to be signed
      const { data } = await axios({
        method: 'post'
        url: 'https://api.ordinalsbot.com/marketplace/create-listing',
        data: {
          sellerOrdinals
          sellerPaymentAddress,
          sellerOrdinalPublicKey
        },
        headers: {
        'x-api-key': API_KEY,
      });

      // When using XVerse Wallet
      // Create the payload for signing the seller transaction
      const payload = {
        network: { type: "Mainnet" },
        message: "Sign Seller Transaction",
        psbtBase64: data.psbt, // PSBT returned by the clear-listing API
        broadcast: false,
        inputsToSign: [sellerInput],
      };

      // Make signing request
      await signTransaction({
        payload,
        onFinish: async (response) => {
          try {
            // signed succesffully

            // Save the listing with the signed PSBT
            const updateListingData = {
              signedListingPSBT: response.psbtBase64,
            };

            // Save the listing PSBT by calling /marketplace/save-listing API
            // This saves the signed PSBT
            const saveResponse= await axios({
              method: 'patch'
              url: 'https://api.ordinalsbot.com/marketplace/save-listing' + sellerOrdinals[0].id,
              data: {
                ordinalId: sellerOrdinals[0].id,
                updateListingData
              },
              headers: {
              'x-api-key': API_KEY,
              }
           });
      
          } catch (Error) {
            // error handling
          }
        },
        onCancel: () => { // User cancelled signing request }
      });

POST List a new ordinal for sale

List a Ordinal for sale

POST https://api.ordinalsbot.com/marketplace/create-listing

API Key is required in the header:

headers: { 'x-api-key': '<YOUR_API_KEY>', ...otherHeaders }

Request Body

NameTypeDescription

sellerOrdinals*

Array

An array with one or more objects. The object should include:

id:string; => Ordinal id for the ordinal to be listed for sale.

price:number | string; => Sale price of the ordinal in Sats.

sellerPaymentAddress

String

The address to receive the sale proceeds when the ordinal is sold. This will be part of the sale transaction that the buyer will sign.

sellerOrdinalPublicKey

String

The public key for the wallet address that owns the ordinal being listed for sale


{
    "psbt": "cHNidP1BAP15AQIAAAAE1K5...........", // base64 transaction to be signed
}

Last updated