# Update Listing

{% hint style="info" %}
An API Key is required to interact with MarketPlace APIs. Please contact us to get an API Key and get started.
{% endhint %}

This endpoint updates an existing marketplace listing with a new price. Calling the endpoint returns a psbt which needs to be signed by the seller's ordinal wallet address. Once signed the signed psbt needs to be returned by calling `/marketplace/confirm-relist`. if confirm-relist is not called then the existing ordinal listing remains unchanged.

### `POST` Update a Listing

## Update a marketplace listing

<mark style="color:green;">`POST`</mark> `https://api.ordinalsbot.com/marketplace/relist`

Example using Xverse Wallet:

```javascript
// XVerse Wallet example of creating a signing request 
// updating an ordinal by calling relist
// Create the relist PSBT by calling /marketplace/relist 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/relist',
  data: {
    ordinalId,
    price:1200,   // updated price
    sellerPaymentAddress,
    sellerOrdinalPublicKey
  },
  headers: {
  'x-api-key': API_KEY,
  }
});

// When using XVerse Wallet
// Create the payload for signing the seller transaction
const sellerInput = {
  address: ordinalsAddress, // Seller's ordinal wallet address
  signingIndexes: [0], // always [0] when listing/relisting
  // Specify sigHash type as SIGHASH_SINGLE | SIGHASH_ANYONECANPAY
  sigHash: bitcoin.Transaction.SIGHASH_SINGLE | bitcoin.Transaction.SIGHASH_ANYONECANPAY,
};
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 relist PSBT by calling /marketplace/confirm-relist API
      // This saves the signed PSBT
      const saveResponse= await axios({
        method: 'post'
        url: 'https://api.ordinalsbot.com/marketplace/confirm-relist',
        data: {
          ordinalId,
          signedListingPSBT: response.psbtBase64
        },
        headers: {
        'x-api-key': API_KEY,
        }
    });
    } catch (Error) {
      // error handling
    }
  },
  onCancel: () => { /* User cancelled signing request */}
});
```

#### Request Body

| Name                                        | Type   | Description                                                                                             |
| ------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------- |
| sellerOrdinalPublicKey                      | String | The public key for the wallet address that owns the ordinal                                             |
| ordinalId<mark style="color:red;">\*</mark> | String | Ordinal id to update                                                                                    |
| price                                       | Number | The listing price for the ordinal                                                                       |
| sellerPaymentAddress                        | String | Payment wallet address for the seller, this wallet address will receive the payment the ordinal is sold |

{% tabs %}
{% tab title="200: OK " %}

```json

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

```

{% endtab %}

{% tab title="500: Internal Server Error " %}

```json
{
    status: 'error',
    error: 'error reason'
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ordinalsbot.com/marketplace-1/update-listing.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
