---
title: Manage Auction Houses
metaTitle: Manage Auction Houses | Auction House
description: Explains how to manage Auction Houses.
---

## Introduction

[On the previous page](/legacy-documentation/auction-house/settings), we went through the various settings of an Auction House. So now, let’s see how we can use these settings to create and update Auction Houses. 

We'll also talk about different ways of fetching Auction House. Lastly, we'll go see how to withdraw funds from the Auction House fee and treasury accounts.

## Create Auction Houses

An Auction House can be created with all the settings discussed in the previous page. The created Auction House account is referred to as an Auction House **Instance**.

{% dialect-switcher title="JS SDK" %}
{% dialect title="JavaScript" id="js" %}

Let's go through an example of using the Metaplex JS SDK to create an Auction House. Note that by default the current identity is used as the authority of the Auction House. Moreover, by default `SOL` will be set as the `treasuryMint`. Lastly, helper accounts discussed in the last page will be automatically generated by the Auction House, but they can also be set manually while Auction House creation.

```tsx
const auctionHouseSettings = await metaplex
    .auctionHouse()
    .create({
        sellerFeeBasisPoints: 500 // 5% fee
        authority: metaplex.identity(),
        requireSignOff: true,
        canChangeSalePrice: true,
        hasAuctioneer: true, // to enable auctioneer
        auctioneerAuthority: metaplex.identity(),
    });
```

{% /dialect %}
{% /dialect-switcher %}


## Auction House Account

Now that we’ve created an Auction House instance, let’s see what data is stored inside it.

Firstly, it stores all the settings that we have already discussed. In addition to these settings, the Auction House account stores a `creator` field, which points to the address of the wallet used to create the Auction House instance.

Lastly, the Auction House instance also stores some PDA bumps, which are used to derive the addresses of the PDA accounts.

> When building with PDAs, it is common to store the bump seed in the account data itself. This allows developers to easily validate a PDA without having to pass in the bump as an instruction argument.

{% dialect-switcher title="JS SDK" %}
{% dialect title="JavaScript" id="js" %}

The Auction House account model can be explored in the [API References of the `AuctionHouse` model](https://metaplex-foundation.github.io/js/types/js.AuctionHouse.html).

Here’s a small code example showcasing some of the Auction House attributes.

```tsx
const { auctionHouse } = await metaplex.auctionHouse().create({...});

auctionHouse.address;                   // The public key of the Auction House account              
auctionHouse.auctionHouseFeeAccount;    // The public key of the Auction House Fee account
auctionHouse.feeWithdrawalDestination;  // The public key of the account to withdraw funds from Auction House fee account
auctionHouse.treasuryMint;              // The mint address of the token to be used as the Auction House currency
auctionHouse.authority;                 // The public key of the Auction House authority
auctionHouse.creator;                   // The public key of the account used to create the Auction House instance
auctionHouse.bump;                      // The `Bump` of the Auction House instance
auctionHouse.feePayerBump;              // The `Bump` of the fee account
auctionHouse.treasuryBump;              // The `Bump` of the treasury account
auctionHouse.auctioneerAddress;         // he public key of the `Auctioneer` account
```

{% /dialect %}
{% /dialect-switcher %}

## Fetch Auction Houses

Once created, the Auction House instance can be fetched. An Auction House can be uniquely identified by its PDA account address or a combination of its creator address and the treasury mint address.

{% dialect-switcher title="JS SDK" %}
{% dialect title="JavaScript" id="js" %}

An Auction House can be fetched using two ways:

1. **By address**: using the Auction House address
2. **By creator and mint**: using the combination of the `creator` address and the treasury mint. Note that when the Auction House has Auctioneer enabled, the `auctioneerAuthority` is also required in addition to the creator and the mint.

```tsx
// by address
const auctionHouse = await metaplex
    .auctionHouse()
    .findByAddress({ address: new PublicKey("Gjwc...thJS") });

// by creator and mint
// in this example, we assume that the Auction House
// does not have Auctioneer enabled
const auctionHouse = await metaplex
    .auctionHouse()
    .findByCreatorAndMint({
        creator: new PublicKey("Gjwc...thJS"),
        treasuryMint: new PublicKey("DUST...23df")
    });
```

{% /dialect %}
{% /dialect-switcher %}

## Update Settings

As in the case of Candy Machine, once an Auction House instance is created, you can update most of its settings later on as long as you are the authority of the Auction House instance. The following settings can be updated: `authority`, `sellerFeeBasisPoints`, `requiresSignOff`, `canChangeSalePrice`, `feeWithdrawalDestination`, `treasuryWithdrawalDestination`, `auctioneerScopes`.

As we've already discussed, the authority of the Auction House is one of the settings that can be updated, as long as the current authority is the signer and the address of the new authority is mentioned.

{% dialect-switcher title="JS SDK" %}
{% dialect title="JavaScript" id="js" %}

To update the settings, we need the full model in order to compare the current data with the provided data. For instance, if you only want to update the `feeWithdrawalDestination`, you need to send an instruction that updates the data whilst keeping all other properties the same.
    
Also, by default, `feeWithdrawalDestination` and the `treasuryWithdrawalDestination` are set to `metaplex.identity()`, ie., the same wallet which is set as the authority and the creator by default.

```tsx
import { Keypair } from "@solana/web3.js";

const currentAuthority = Keypair.generate();
const newAuthority = Keypair.generate();
const newFeeWithdrawalDestination = Keypair.generate();
const newTreasuryWithdrawalDestination = Keypair.generate();
const auctionHouse = await metaplex
    .auctionHouse()
    .findByAddress({...});

const updatedAuctionHouse = await metaplex
    .auctionHouse()
    .update({
        auctionHouse,
        authority: currentAuthority,
        newAuthority: newAuthority.address,
        sellerFeeBasisPoints: 100,
        requiresSignOff: true,
        canChangeSalePrice: true,
        feeWithdrawalDestination: newFeeWithdrawalDestination,
        treasuryWithdrawalDestination: newTreasuryWithdrawalDestination
    });
```

{% /dialect %}
{% /dialect-switcher %}

## Withdraw Funds

We have discussed in the previous page about the different helper accounts of Auction House. These are the **Fee Account** and the **Treasury Account**.

Funds from both these accounts can be transferred back to "destination" wallets. These withdrawal destination accounts can be set by the Auction House authority.

{% dialect-switcher title="JS SDK" %}
{% dialect title="JavaScript" id="js" %}

Here's a code snippet which transfers funds.
    
1. Auction House Fee Wallet to the Fee Withdrawal Destination Wallet.
2. Transfers funds from Auction House Treasury Wallet to the Treasury Withdrawal Destination Wallet.
    
In both the cases, The Auction House from which the funds are being transferred and the amount of funds to withdrawn need to be specified. This amount can either be in SOL or in the SPL token used by the Auction House as a currency.

```tsx
// withdraw funds from fee account
await metaplex
    .auctionHouse()
    .withdrawFromFeeAccount({
        auctionHouse,
        amount: 5
    });

// withdraw funds from treasury account
await metaplex
    .auctionHouse()
    .withdrawFromTreasuryAccount({
        auctionHouse,
        amount: 10
    });
```

{% /dialect %}
{% /dialect-switcher %}

## Conclusion

At this point we've gone over the Auction House settings, the data an Auction House instance stores and how to create and update this data. However, we still don't know how assets are traded on Auction Houses. We'll talk about this in the [next page](/legacy-documentation/auction-house/trading-assets).
