Skip to main content

Token Gate


The Token Gate guard restricts minting to token holders of a configured mint account. If the payer does not have the required amount of tokens, minting will fail.


Guard Settings

The Token Gate guard contains the following settings:

  • Amount: The number of tokens required.
  • Mint: The address of the mint account defining the SPL Token we want to gate with.


Here’s an example of how to set up a Candy Machine using the Token Gate guard.

import { token } from '@metaplex-foundation/js';

const { candyMachine } = await metaplex.candyMachines().create({
// ...
guards: {
tokenGate: {
amount: token(300),
mint: tokenMint.address,

API References: Operation, Input, Output, Transaction Builder, Guard Settings.

Mint Settings

The Token Gate guard does not need Mint Settings.

However, if you’re planning on constructing instructions without the help of our SDKs, you will need to add the payer’s token account to the remaining accounts of the mint instruction. See the Candy Guard’s program documentation for more details.

Route Instruction

The Token Gate guard does not support the route instruction.