# Welcome to 3mint

Build your next generation loyalty program with digital assets

## Overview

3mint is a SaaS platform and API toolkit that allows any entity to build a next generation loyalty program. With our self-serve platform and our simple code snippets, you have the complete stack to easily deploy your digital assets, distribute your collectibles to new and current users, and provide benefits to your holders.

Building a Web3 loyalty experience typically requires running blockchain infrastructure such as nodes and client software, building and maintaining smart contracts, creating and deploying metadata, handling cryptocurrency and valuable wallets, triggering and tracking transactions, managing royalties, and then building interfaces that enable users to connect a wallet and leverage the underlying technology (😮‍💨 phew, that was a long sentence). All of this has to be done before your end-user can even start seeing the benefits!

Our goal at 3mint is to abstract away the complexity and friction surrounding the Web3 stack so you can focus on acquiring new users and creating a loyal customer base. **If you want to see the benefits of creating web3-based loyalty programs, be sure to check out our** [**blog**](https://www.blog.3mint.io/)**!**

| The usual Web3 stack                                                                                                                                                      | Replaced with 3mint                       |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------- |
| <ul><li>UI </li><li>Smart contracts </li><li>Metadata</li><li>Wallets</li><li>Transaction monitoring</li><li>Account security</li><li>Blockchain infrastructure</li></ul> | <ul><li>3mint Platform and APIs</li></ul> |

{% hint style="info" %}
We want to make sure we're building the right features for you. If you have any requests for existing or upcoming features, reach out to [support@3mint.io](mailtTo:support@3mint.io) or fill out this [form](https://g134jizfxmb.typeform.com/to/sjlJdFf2) (takes 10 seconds)!
{% endhint %}

## Who can use this service?

The 3mint product is built for both marketers and developers. If you would like to dive deeper into each section, click on the blue titles below.&#x20;

### For Marketers

#### [3mint Platform](#3mint-platform)

Manage all your contracts, NFTs, and distribution links from one platform without ever having to manage your own cryptocurrency or smart contracts. Integrate directly into your existing marketing and CRM providers to ensure you're using the tools you know best.

### For Developers

{% hint style="info" %}
End-to-end examples can be found in each corresponding guide. If you're looking to immediately send your first request, we recommend you dive into those.
{% endhint %}

#### [Contracts API](/developer-guides/contracts)

Deploy token or collectible contracts to an EVM chain or Solana in seconds. Update both contract and NFT metadata to provide gamified experiences to your customers.

#### [Mint API](/developer-guides/mint)

Mint collectibles and tokens directly into user wallets to reward their loyalty. Batch transactions and manage gas automatically, without ever having to worry about blockchain congestion.

#### [Wallets API](/developer-guides/wallets)

Remove the complexity of Web3 for your users. Our custodial wallet API allows users to log in with their preferred auth methods without having to manage their private keys.

#### [Token Gating API](/developer-guides/token-gating)

Token-gate anything, from a static webpage, to access to perks and events, to accounts and virtual experiences. Fully multi-chain, highly flexible requirements, and super fast.

## Want to deep dive?

Dive a little deeper and check out comprehensive examples and understand how it all works:

{% content-ref url="/pages/L0dF3KmHiaIRVapgrgll" %}
[Developer Guides](/developer-guides/introduction)
{% endcontent-ref %}

## Need the full specs?

Start exploring our API reference to get an idea of everything that's possible with the API:

{% content-ref url="/pages/0FaQZ6z5Dd8DHSbapcvu" %}
[API Reference](/api-reference/overview)
{% endcontent-ref %}


# Introduction

A self-serve platform to manage all your Web3 campaigns

## Overview

The 3mint platform allows marketing teams to create digital assets (collections and tokens), upload their digital content and metadata, create distribution links that can be shared with their customers, and monitor their campaign success with on and off chain analytics.

## Who can use this platform?

Companies of every shape and size can use our product! Broadly, we see three different types of customers: 1) DTC brands focusing on their core product and trying to improve their customer's experience, 2) large multi-brand companies that need a loyalty program that spans across several of their products, and 3) marketing agencies that need to manage their clients' customer retention and acquisition strategies.&#x20;

If you think you fall within those three categories, you've come to the right place!&#x20;

## What will you find in this section?

Each section gives a detailed explanation to working with the platform and ensuring you have your web3 campaign covered end-to-end. **If you would like a more technical breakdown of each feature, we have provided more information in the** [**Developer Guides**](/developer-guides/introduction) **section of the docs.**

###


# Deploy a contract

One-click deploy on the chain of your choosing

{% hint style="info" %}
If you would like an explainer on what a contract is, make sure to visit our [Web3 101 ](/faq/web3-101)page!
{% endhint %}

## Deploying on 3mint

To deploy a contract, go to the Contracts page and click the "Create contract" button (**1**). From there, you need to choose the type of contract you want to deploy (**2**) and input details regarding the contract you are deploying (**3**).

### 1. Go to the Contracts page

<figure><img src="/files/BK5gtCEhRZ38B4cATe7Y" alt=""><figcaption></figcaption></figure>

### **2. Choose the Contract type**

<figure><img src="/files/lwe9XER446r7U7dYL7ME" alt=""><figcaption></figcaption></figure>

### **3. Input Collection Data**

<figure><img src="/files/QtqD92bvkWh7tWqtBkQP" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Contracts can currently be deployed on:

* Polygon Mainnet and Mumbai
* Arbitrum Mainnet and Goerli
* Optimism Mainnet and Goerli
  {% endhint %}

### Result

Once everything you've chosen looks good, press "Deploy" at the bottom of the screen and the contract will be deployed to your blockchain and network of choice. No wallet, crypto, or private key needed! After a few seconds, you'll be redirected back to the main page and you should see your contract included in the table.

<figure><img src="/files/PoW1CxnxfIefKEuGl78h" alt=""><figcaption></figcaption></figure>


# Upload your NFT data

Upload your entire collection in minutes

Before anything can be minted, there needs to be digital content (image, video, audio, etc.) and metadata available for each potential NFT. If you were to try minting an NFT with a contract you just deployed, but without providing any content beforehand, you would basically be giving someone nothing!&#x20;

**This is crucial to understand: when uploading your NFT data, you are not actually minting anything on the blockchain, but just preparing the data necessary to mint it.** The term "minting" refers to the idea of deploying an NFT to a blockchain so that it lives forever.

### 1. Go to the Contracts Info page

Click on the "NFT Data" button on the right-hand side of the contract row.&#x20;

<figure><img src="/files/nnsQaRYGs4zQNCAKzqWQ" alt=""><figcaption></figcaption></figure>

From there, you'll be taken to a page that shows you all the NFT data you have prepared (you won't see anything if this is the first time you upload).&#x20;

<figure><img src="/files/I49loJDxfyEVCuejdShM" alt=""><figcaption></figcaption></figure>

### **2. Upload your data**

#### Option 1: Single Upload

Click on "Single Upload" and fill in your NFT details, starting with the name, media, and description.

<figure><img src="/files/3nxSAldEiGAAxLvNyPTn" alt=""><figcaption></figcaption></figure>

Once the NFT name, media, and description is added, add optional metadata attributes, the NFT's price and whether or not there is a max quantity that can be minted (this is only applicable to ERC1155 contracts). If you want to provide these NFTs for free, simple choose the "Free" option under the price section.

<figure><img src="/files/QjDF8P0rg8hbSeHR6T2d" alt=""><figcaption></figcaption></figure>

#### Option 2: Batch Upload

If you want to upload more than one piece of data at a time, you can batch upload instead. For CSV uploads, we recommend you download the example CSV we provide and fill in your NFT details there.

<figure><img src="/files/T2tsadr7XxlwUVOLelD4" alt=""><figcaption></figcaption></figure>

Once you press "Upload", you'll see a loading screen appear that will let you know how the upload is progressing.

### Result

Once the data is uploaded, you will see the NFT data appear in the table and you can begin minting NFTs through distribution links.

<figure><img src="/files/rGta3fJnwqpugCmdqQgQ" alt=""><figcaption></figcaption></figure>


# Create checkout links

Share your NFTs with your customers with branded checkout links

## What are checkout links?

At the core of the 3mint platform is the ability to easily share the digital collectibles you have created to existing and new customers. These links can be standalone web pages or integrations within your existing website. In either case, they can be fully customized to match your branding.&#x20;

There are three types of Checkout Links:

1. **Default**: Automatically created when you upload your NFT data. This link can be sent to anyone and they will be able to claim or purchase the digital collectible.
2. **General**: Manually created and is only valid for your existing customer base.
3. **Specific**: Manually created and is only valid for specific customers you have selected.

Below is a guide for how these links can be created.

## Creating a Checkout Link

### 1. Go to the Checkout Links page

Click on the "Links" button on the right-hand side of the NFT row. &#x20;

<figure><img src="/files/TuhCNjZgpMUbx6SX1Unz" alt=""><figcaption></figcaption></figure>

This will bring you to a page where you will see all the links you have created. Whenever you upload NFT data, one default link is automatically created for it.&#x20;

<figure><img src="/files/AoexsSGwyi8yAj0tBhjv" alt=""><figcaption></figcaption></figure>

### 2. Click on the "Create Link" Button

This will open up a modal that allows you to choose the contacts you want to whitelist **(A)**, verify that you have selected the right contacts **(B)**, and then add specific parameters relevant to the link **(C)**.

#### A. Choose your contacts

<figure><img src="/files/9Ell111qFTeGUYRQhbkN" alt=""><figcaption></figcaption></figure>

#### B. Confirm the selection

<figure><img src="/files/O6bQqVajud4nJiSSPTJm" alt=""><figcaption></figcaption></figure>

#### C. Choose checkout parameters

<figure><img src="/files/cneAwEbJuwbzDXT31C2q" alt=""><figcaption></figcaption></figure>

This last step is particularly important as it will determine where a user will receive the digital collectible (a 3mint wallet or their own non-custodial wallet), how many digital collectibles they can receive, and what dates the link should be active.

Once you have selected all your options, click on the "Create" button.

### Result

<figure><img src="/files/LuDm4FtMueUNMQQcAm6d" alt=""><figcaption></figcaption></figure>


# Add customers

Import your existing customers and gain new ones

Work in progress.


# Monitor your links

Keep track of your customers' activity

Work in progress.


# Introduction

This section is meant for developers who may be creating custom Web3 experiences with the APIs and SDK provided by 3mint. **If you would like a less technical breakdown of each feature, please go to the** [**3mint Platform**](/3mint-platform/introduction) **section.**


# Contracts

A deep dive into the available contracts

The Mint API facilitates the minting and transferring of web3 assets to users, without you or your users having to worry about transaction management or gas payments, which are entirely managed by the API service.

{% hint style="info" %}
The Mint API is not intended to be used for merkle mints, where users pay to claim the NFTs. If you require this functionality, please contact us at [dev@3mint.io](mailTo:dev@3mint.io)
{% endhint %}

There are two types of assets that can be minted using the API:&#x20;

* Tokens (ERC-20, etc.)
* NFTs (ERC-721, ERC-721A, ERC-1155, etc.)

{% hint style="info" %}
Today, 3mint supports Ethereum, Polygon, Arbitrum, and Optimism. Solana will soon be added.
{% endhint %}

### Minting Tokens&#x20;

The setup procedure is extremely simple:&#x20;

1. Deploy an ERC20 contract through the 3mint dashboard
2. Integrate the API endpoint into your codebase

### Minting NFTs&#x20;

For minting NFTs, the setup procedure takes the following steps:&#x20;

1. Deploy your contract on the 3mint dashboard
2. Upload relevant media files and metadata attributes to the 3mint dashboard&#x20;
3. Integrate the API endpoint into your codebase

**The NFT contract** is what will allow your NFTs to be minted (i.e., created for your users to hold in their wallet). At its core, a contract is a simple table that has the user’s wallet address in the left column and the NFT the user owns in the right column. Of course, there is much more functionality that can be added, which is why we either let you choose a standard, audited default contract that 3mint provides or you can bring your own, with all the features you can think of.

{% hint style="warning" %}
When 3mint's address is added as a Minter to the contract address, the mint API will send the NFT directly to the intended user's wallet. This is more efficient than minting it to a 3mint wallet and then sending it to the user.
{% endhint %}

**Uploading your media and metadata** is what will allow your NFTs to display digital content and have unique attributes to describe them. The content itself can be an image, an audio recording, or even a video. To ensure your NFTs truly live forever, the content and associated metadata will need to be uploaded to IPFS or Arweave, both peer-to-peer networking protocols that distribute your data across thousands of nodes. This process can be quite technical, but with the help of the 3mint dashboard, all you need to do is upload your digital file and let us know what metadata attributes you want to include; we take it from there!

**Integrating the API endpoint** takes 30 seconds. Once you have your API key (provided on the 3mint dashboard), all you need to do is choose which NFT to send, who should receive it, and fire away! Every time the endpoint is called, a new NFT will be minted using the digital content and metadata you uploaded in step 2. If you uploaded 1000 images and have already minted 200, the next image chosen will be the 201st.


# Contract Architecture

In-depth view of how 3mint contracts are structured

Work in progress.


# End-to-end Example

Work in progress.


# Mint

A more detailed look at our Mint solution

## Overview

With the rising popularity of NFTs and tokens as reward mechanisms, an increasing number of brands, enterprises, tech companies, and game developers are exploring ways to use NFTs to better engage with their users. While the predominant way to interact with NFTs has been through one-time drops (e.g. with PFP collections and NFT memberships), it’s becoming clear that recurring, programmatic distribution models are better suited for loyalty and reward programs as well as token-gated commerce broadly.

With that said, there are real challenges to implement fast, stable, programmatic minting at scale, due to the constrained nature of blockchains themselves.

### The Problems

**Problem #1: Transactions get dropped**&#x20;

A blockchain like Ethereum relies on nodes propagating signed transactions across its p2p network. As these transactions get dispersed, they should eventually get included within a block. However, when the network is under high congestion, a node may actually drop your transaction (which also causes nonce gap issues for your remaining transactions). Needless to say, times of high congestion are often when you most need your transaction to go through (e.g., preventing liquidations!).

**Problem #2: Transactions get stuck...along with everything else behind them**&#x20;

Almost as bad (or maybe even worse) than your transaction dropping is your transaction getting stuck in the mempool. Ethereum’s security model relies on transaction fees; hence, whether or not your transaction goes through will depend heavily on where you set fees relative to the existing market. If you’ve designated a gas fee that is lower than the average in the mempool, your queue of transactions may get stuck.

**Problem #3: Paying too much… bad fee management**&#x20;

In order to prevent problem #1 and #2, you might decide to just include a huge premium on the average transaction fee. While that may be okay for a few transfers, this becomes quite expensive if you are sending 100,000+ transactions (even on a cheaper chain like Polygon or Arbitrum). You might try to visit ETH Gas Station, identify the trader rate, and then send that to the network. For the most part, that can work...except when you need it most. Prices can get quite volatile and fees can fluctuate significantly by the time you send your transaction.

**Problem #4: Paying in crypto**&#x20;

Last, but definitely not least, sometimes the problem happens even before you send the transactions. Many firms are uncomfortable or legally unable to hold crypto on their balance sheet. This problem is only accentuated the more chains (and hence more native tokens) you use. You can't get transactions through if you don't even have tokens to pay the fees in the first place.

### The Solution

The problems described above are already pretty common. And as large enterprises continue entering the web3 space, the number of transactions will increase exponentially, further testing the scalability and throughput of the underlying infrastructure. If not handled properly, any web3 experience you create will be plagued with issues and unhappy customers.

Our Mint API ensures all of these issues are a thing of the past. With our dedicated infrastructure, transaction monitoring software, and robust fee-replacement mechanism, you simply choose whom you want to send a token to, and we ensure it gets there, no matter the blockchain activity. Whether it's NFTs, ERC20s, native coins, or even Verifiable Credentials (VCs) based on Decentralized Identifiers (DIDs), we support it all.

### Example Use Cases&#x20;

* Send ERC-20s as a reward to your users for creating an account
* Guarantee KYC completion on-chain by sending an SBT to all verified accounts
* Enhance your loyalty program by sending NFTs to your customers who finish specific quests
* Increase your sales by sending NFT coupons directly to your customers' wallets
* Send your top 1% of customers an exclusive NFT (that can then use our token gating API to provide perks!)

## How it all works

What does the Mint API do?&#x20;

* Mint and distribute NFTs or tokens to designated addresses in batch&#x20;
* Gas optimization and payment&#x20;
* Transaction management and execution

### Minting and Distribution&#x20;

The API will mint NFTs and tokens to designated wallet addresses based on the predetermined 3mint smart contract you have deployed (either through the platform or API endpoints).

### Gas Optimization and Payment&#x20;

Before processing transactions, the API calculates an estimate of the gas cost required and optimizes for the best time to issue transactions.

3mint pays for the gas cost directly, ensuring that you never need to hold cryptocurrencies.&#x20;

### Transaction Management & Execution&#x20;

All transactions sent through the API are monitored throughout their lifecycle. If any transactions are dropped by nodes or seem stuck, we use our fee-replacement engine to re-publish transactions. This also ensures no nonce gap issues inhibit your chain of requests.

During times of very high congestion, we keep a record of all transactions in our queue and feed these to the nearest node when space opens up. This means it's possible to send even 1 million+ transactions through our system.


# How To

A step by step guide for using the Mint API

The Mint API facilitates the minting and transferring of web3 assets to users, without you or your users having to worry about transaction management or gas payments, which are entirely managed by the API service.

{% hint style="info" %}
The Mint API is not intended to be used for merkle mints, where users pay to claim the NFTs. If you require this functionality, please contact us at [dev@3mint.io](mailTo:dev@3mint.io)
{% endhint %}

There are two types of assets that can be minted using the API:&#x20;

* Tokens (ERC-20, etc.)
* NFTs (ERC-721, ERC-721A, ERC-1155, etc.)

{% hint style="info" %}
Today, 3mint supports Ethereum, Polygon, Arbitrum, and Optimism. Solana will soon be added.
{% endhint %}

### Minting Tokens&#x20;

The setup procedure is extremely simple:&#x20;

1. Deploy an ERC20 contract through the 3mint dashboard
2. Integrate the API endpoint into your codebase

### Minting NFTs&#x20;

For minting NFTs, the setup procedure takes the following steps:&#x20;

1. Deploy your contract on the 3mint dashboard
2. Upload relevant media files and metadata attributes to the 3mint dashboard&#x20;
3. Integrate the API endpoint into your codebase

**The NFT contract** is what will allow your NFTs to be minted (i.e., created for your users to hold in their wallet). At its core, a contract is a simple table that has the user’s wallet address in the left column and the NFT the user owns in the right column. Of course, there is much more functionality that can be added, which is why we either let you choose a standard, audited default contract that 3mint provides or you can bring your own, with all the features you can think of.

{% hint style="warning" %}
When 3mint's address is added as a Minter to the contract address, the mint API will send the NFT directly to the intended user's wallet. This is more efficient than minting it to a 3mint wallet and then sending it to the user.
{% endhint %}

**Uploading your media and metadata** is what will allow your NFTs to display digital content and have unique attributes to describe them. The content itself can be an image, an audio recording, or even a video. To ensure your NFTs truly live forever, the content and associated metadata will need to be uploaded to IPFS or Arweave, both peer-to-peer networking protocols that distribute your data across thousands of nodes. This process can be quite technical, but with the help of the 3mint dashboard, all you need to do is upload your digital file and let us know what metadata attributes you want to include; we take it from there!

**Integrating the API endpoint** takes 30 seconds. Once you have your API key (provided on the 3mint dashboard), all you need to do is choose which NFT to send, who should receive it, and fire away! Every time the endpoint is called, a new NFT will be minted using the digital content and metadata you uploaded in step 2. If you uploaded 1000 images and have already minted 200, the next image chosen will be the 201st.


# End-to-end Example

Programmatically minting an Ethereum ERC1155 NFT

## 1. Get your API keys

Create a [3mint](https://app.3mint.io) account and find your API key on the Settings page.

<figure><img src="/files/qb7SOd68Dh54YKk7iCyx" alt=""><figcaption><p>The key displayed is for demonstration purposes only and will not work in production</p></figcaption></figure>

Your API requests are authenticated using API keys. Any request that doesn't include an API key will return an error.

**The key received should remain secret, which means it should only be accessed on the back end**. Authorization to the API is performed via the X-API-KEY header.&#x20;

## 2. Deploy a contract

The building block of any NFT is the contract that you first need to deploy to a blockchain. Think of this contract as public way to show who owns which NFT (i.e., it's a simple table that has the user’s wallet address in the left column and the NFT the user owns in the right column).&#x20;

To deploy a contract, go to the Contracts page and click the "Create contract" button. From there, you need to choose the type of contract you want to deploy (**A**), input details regarding the contract you are deploying (**B**), and since we are launching an NFT, we'll also choose where our NFT data should be stored (**C**).

**A. Choose "One or More Copies"**

<figure><img src="/files/lwe9XER446r7U7dYL7ME" alt=""><figcaption><p>ERC-1155 is the best choice if you want to create more than 1 of the same NFT</p></figcaption></figure>

**B. Input Collection Data**

<figure><img src="/files/FjUVeVPnJVfuBTidS9SA" alt=""><figcaption><p>The image uploaded will be visible on platforms like OpenSea</p></figcaption></figure>

**C. Choose Decentralized blockchain as you Data Location**

<figure><img src="/files/l2O7VoxOSBiQy9cU9P3g" alt=""><figcaption><p>If you want to change your NFTs after they have been minted, Designated Server would be the preferred option</p></figcaption></figure>

Once everything you've chosen looks good, press "Deploy" at the bottom of the screen and the contract will be deployed to your blockchain and network of choice. No wallet, crypto, or private key needed! After a few seconds, you'll be directed back to the main page and you should see your contract included in the table.

## 3. Upload NFT Data

Now it's time to upload the digital content and metadata your NFTs will use when minted (i.e., created and sent to someone's wallet). To do this, click on the "info" button on the right-hand side of the contract row.&#x20;

<figure><img src="/files/ysiOSEwSZPmADxHag6ZH" alt=""><figcaption><p>The contract address can be copied and searched on Etherscan</p></figcaption></figure>

From there, you'll be taken to a page that shows you all the NFT data you have prepared (none so far, but we'll change that in a second!). Click on "Single Upload" and fill in your NFT details.

<figure><img src="/files/vluHXEDOwhTYowqkV3FX" alt=""><figcaption><p>You can add as many attributes as you'd like</p></figcaption></figure>

Once uploaded, this data will live on a decentralized blockchain forever, ensuring your holders truly own this data. If you want to upload more than 1 NFT at a time, just use the "Batch Upload" button instead.

Just like that, you now have a contract deployed and the NFT data needed to start sending your NFTs programmatically.&#x20;

## 4. Mint with Code

Minting can be done directly through your codebase. If you have a POS system, you can deliver these NFTs for certain purchases that your customers make.

{% hint style="info" %}
Every API request must include Content-Type and X-API-KEY headers.
{% endhint %}

{% tabs %}
{% tab title="curl" %}
{% code lineNumbers="true" %}

```json
curl -X POST https://api.3mint.io/api/v1/mint   
   -H "Content-Type: application/json"
   -H "X-API-KEY: [YOUR_API_KEY]"
   -d '{"to": ["[WALLET_OF_USER]"],
       "chain": "ethereum",
       "network": "mainnet",
       "type":"erc1155",
       "contractAddress": "[CONTRACT_ADDRESS]",
       "quantity": 1
       }'
```

{% endcode %}
{% endtab %}

{% tab title="Axios (JS)" %}
{% code lineNumbers="true" %}

```javascript
import axios from 'axios';

// replace with your 3mint api key
const apiKey = 'demo';
const url = 'https://api.3mint.io/api/v1/mint';

// Include conditions to verify
const to = '[WALLET_OF_USER]'
const contractAddress = '[PROJECT_CONTRACT_ADDRESS]'

var requestOptions = {
  method: 'POST',
  url: `${url}`,
  headers: {
    'Content-Type': 'application/json',
    'X-API-KEY': `${apiKey}`
  },
  data: {
    'to': [`${to}`],
    'chain': 'ethereum',
    'network': 'mainnet',
    'type':'erc1155',
    'contractAddress': `${contractAddress}`,
    'quantity': 1
   }
};

axios(config)
.then(response => console.log(response))
.catch(error => console.log(error));
```

{% endcode %}
{% endtab %}

{% tab title="Fetch (JS)" %}
{% code lineNumbers="true" %}

```javascript
import fetch from 'node-fetch';

// replace with your 3mint api key
const apiKey = 'demo';
const fetchURL = 'https://api.3mint.io/api/v1/mint';

// Include conditions to verify
const to = '[WALLET_OF_USER]'
const contractAddress = '[PROJECT_CONTRACT_ADDRESS]'

var requestBody = JSON.stringify({
  'to': `${to}`,
    'chain': 'ethereum',
    'network': 'mainnet',
    'type':'erc1155',
    'contractAddress': `${contractAddress}`,
    'quantity': 1
});

var requestOptions = {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-API-KEY': `${apiKey}`
  },
  body: requestBody,
};

// Make the request and print the formatted response:
fetch(fetchURL, requestOptions)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(error => console.log('error', error));
```

{% endcode %}
{% endtab %}
{% endtabs %}


# Code Snippets

Different ways to mint tokens

{% hint style="info" %}
**SDK Coming Soon**

With the release of our SDK, you'll be able to easily integrate all features within your framework of choice.
{% endhint %}

## NFT Mint

### Minting an ERC721 NFT

This example mints a new ERC721 NFT and sends it directly to the specified user.

{% tabs %}
{% tab title="cURL" %}
{% code lineNumbers="true" %}

```json
curl -X POST https://api.3mint.io/api/v1/mint   
   -H "Content-Type: application/json"
   -H "X-API-KEY: [YOUR_API_KEY]"
   -d '{"chain": "polygon",
         "network": "mainnet",
         "type": "erc721",
         "to": "0x958fb436dB50DB2F689C364712113cc226b38151",
         "contractAddress": "0x552a43cb61bc127d81b1f280bc39f62e5a51c0c2",
         "quantity": 1 // How many NFTs should be minted -- must be positive integer 
       }'
```

{% endcode %}
{% endtab %}

{% tab title="Axios (JS)" %}
{% code lineNumbers="true" %}

```javascript
import axios from 'axios';

// replace with your 3mint api key
const apiKey = 'demo';
const url = 'https://api.3mint.io/api/v1/mint';

var requestOptions = {
  method: 'POST',
  url: `${url}`,
  headers: {
    'Content-Type': 'application/json',
    'X-API-KEY': `${apiKey}`
  },
  data: {
    'chain': 'polygon',
    'network': 'mainnet',
    'type': 'erc721',
    'to': '0x958fb436dB50DB2F689C364712113cc226b38151',
    'contractAddress': '0x552a43cb61bc127d81b1f280bc39f62e5a51c0c2',
    'quantity': 1 // How many NFTs should be minted -- must be positive integer 
  }
};

axios(config)
.then(response => console.log(response))
.catch(error => console.log(error));
```

{% endcode %}
{% endtab %}
{% endtabs %}

### Minting an ERC1155 NFT

This example mints a new ERC1155 NFT and sends it directly to the specified user.

{% tabs %}
{% tab title="cURL" %}
{% code lineNumbers="true" %}

```json
curl -X POST https://api.3mint.io/api/v1/mint   
   -H "Content-Type: application/json"
   -H "X-API-KEY: [YOUR_API_KEY]"
   -d '{"chain": "polygon",
         "network": "mainnet",
         "type": "erc1155",
         "to": "0x958fb436dB50DB2F689C364712113cc226b38151",
         "contractAddress": "0x552a43cb61bc127d81b1f280bc39f62e5a51c0c2",
         "tokenId": "1",
         "quantity": 1 // How many NFTs should be minted -- must be positive integer 
       }'
```

{% endcode %}
{% endtab %}

{% tab title="Axios (JS)" %}
{% code lineNumbers="true" %}

```javascript
import axios from 'axios';

// replace with your 3mint api key
const apiKey = 'demo';
const url = 'https://api.3mint.io/api/v1/mint';

var requestOptions = {
  method: 'POST',
  url: `${url}`,
  headers: {
    'Content-Type': 'application/json',
    'X-API-KEY': `${apiKey}`
  },
  data: {
    'chain': 'polygon',
    'network': 'mainnet',
    'type': 'erc1155',
    'to': '0x958fb436dB50DB2F689C364712113cc226b38151',
    'contractAddress': '0x552a43cb61bc127d81b1f280bc39f62e5a51c0c2',
    'tokenId': '1',
    'quantity': 1 // How many NFTs should be minted -- must be positive integer
  }
};

axios(config)
.then(response => console.log(response))
.catch(error => console.log(error));
```

{% endcode %}
{% endtab %}
{% endtabs %}

## ERC20 Airdrop

### Minting an ERC20 token

This example sends an existing ERC20 token directly to the specified user.

{% tabs %}
{% tab title="cURL" %}
{% code lineNumbers="true" %}

```json
curl -X POST https://api.3mint.io/api/v1/mint   
   -H "Content-Type: application/json"
   -H "X-API-KEY: [YOUR_API_KEY]"
   -d '{"chain": "polygon",
         "network": "mainnet",
         "type": "erc20",
         "to": "0x958fb436dB50DB2F689C364712113cc226b38151",
         "contractAddress": "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984",
         "quantity": 1.01 // How many tokens should be sent -- must be positive float
       }'
```

{% endcode %}
{% endtab %}

{% tab title="Axios (JS)" %}
{% code lineNumbers="true" %}

```javascript
import axios from 'axios';

// replace with your 3mint api key
const apiKey = 'demo';
const url = 'https://api.3mint.io/api/v1/mint';

var requestOptions = {
  method: 'POST',
  url: `${url}`,
  headers: {
    'Content-Type': 'application/json',
    'X-API-KEY': `${apiKey}`
  },
  data: {
    'chain': 'polygon',
    'network': 'mainnet',
    'type': 'erc20',
    'to': '0x958fb436dB50DB2F689C364712113cc226b38151',
    'contractAddress': '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984',
    'quantity': 1.01 // How many tokens should be sent -- must be positive float
  }
};

axios(config)
.then(response => console.log(response))
.catch(error => console.log(error));
```

{% endcode %}
{% endtab %}
{% endtabs %}


# Wallets

A more detailed look at our Wallets solution (coming Q4)

## Overview

Remove the complexity of Web3 for your users. Our custodial wallet API allows users to log in with their preferred auth methods without having to manage their private keys. The 3mint Wallet SDK offers three options for asset custody: fully custodial, semi-custodial, and self-custodial. All options are integrable in 5 minutes or less, and can work with existing Web2 systems.

### Custodial Wallet&#x20;

3mint generates wallets for each user based on existing accounts in the company’s account management system (ecommerce, CRM, etc.). Private key management is entirely handled by 3mint, and wallet recovery is possible.

### Semi-custodial Wallet&#x20;

Users generate wallets based on their preferred method of passwordless authentication, including email-based, social login, and other OAuth methods. With this API, the user maintains control and ownership of their cryptographic key pair, and while the authentication flow removes all visible Web3 complexity, recovery relies on the user’s chosen OAuth provider.

### Self-custodial Wallet&#x20;

3mint always provides the option for users to use their own self-custodial wallet of choice, such as MetaMask or Coinbase Wallet.


# End-to-end Example

Work in progress.


# Mobile Pass

3mint offers a user-friendly platform that enables the issuance of digital passes specifically tailored for Apple and Google Wallet.

Mobile passes for Apple and Google Wallet can be linked to either a crypto wallet or an NFT, which allows for a broad range of use cases, such as in-person offers, tickets, and reservations. The provided API endpoints for generating and validating passes enables you to communicate with users through location-based notifications and real-time updates. Additionally, for passes linked to NFTs, we monitor ownership changes through token transfer events and cancel passes if an NFT is transferred.

Our top priority is security and safety, and we do not monitor any user data. Although we allow passes to send location or date-based push notifications, this feature interacts directly with the Apple Wallet and Google Wallet APIs, and we do not have access to any user information.


# Creating Passes

Sending a request to our platform will generate a wallet pass for mobile devices

### Verify Ownership

#### 3mint Wallet

We validate users who own a 3mint wallet automatically by leveraging their existing authentication. You can skip to the ["Creating a pass"](#creating-a-pass) section, otherwise you must generate a signature for other crypto wallets.

#### Other Wallets

To create a mobile pass associated with the user's crypto wallet or NFT, their ownership must be proven. This is achieved by requesting the user to sign a message from their wallet.

We require the message to sign to be in the following format:

```javascript
`Sign this message to generate a mobile pass with 3mint.io\n${userPublicAddress}\n${Date.now()}`;
```

The message contains the user's public wallet address and a timestamp to ensure every signed message is unique.

Using the message, a user must sign it using their crypto wallet, such as MetaMask or Coinbase wallets. This process will generate the signature which allows anyone to decrypt it using the user's associated public key for verification.

The user's wallet is responsible for signing the message and can be achieved using a web3 library such as [ether.js](https://github.com/ethers-io/ethers.js/) to trigger the action. It will initiate a signing request for the user's wallet, then it is up to the user to interact and follow the wallet prompts:

```javascript
// Initialize
const provider = new ethers.providers.Web3Provider(window.ethereum);

// Connect
const publicAddresses = await provider.send("eth_requestAccounts", []);

// Sign
const message = `Sign this message to generate a mobile pass with 3mint.io\n${publicAddresses[0]}\n${Date.now()}`;
const signer = provider.getSigner();
const signature = await signer.signMessage(message);
```

### Creating a Pass

Now that we have a signature that proves the user's ownership of the wallet or NFT, we can create a request to generate a mobile pass:

```javascript
const payload = {
    "userAddress": publicAddresses[0], // From previous step
    "chain": {
        "name": "evm",
        "network": 80001 // Polygon Mumbai
    },
    "signatureMessage": message, // From previous step; not required for 3mint wallet users
    "signature": signature, // From previous step; not required for 3mint wallet users
    "image": "https://path-to-image",
    "nft": { // Optional
        "contractInterface": "0xd9b67a26", // ERC-1155 = 0xd9b67a26, ERC-721 = 0x80ac58cd
        "contractAddress": "***",
        "tokenId": "***"
    },
    "pass": { // Apple example, customize as needed =>
        "description": "3mint NFT Pass",
        "logoText": "MY EVENTS",
        "labelColor": "rgb(255,153,0)",
        "backgroundColor": "rgb(0,0,128)",
        "foregroundColor": "rgb(255,255,204)",
        "appLaunchURL": "httsp://3mint.io",
        "auxiliaryFields": [
            {
                "key": "1",
                "label": "Aux 1",
                "value": "Abc"
            },
            {
                "key": "2",
                "label": "Aux 2",
                "value": "Def"
            },
            {
                "key": "3",
                "label": "Aux 3",
                "value": "Xyz"
            }
        ],
        "backFields": [
            {
                "key": "4",
                "label": "Back 1",
                "value": "Abc"
            },
            {
                "key": "5",
                "label": "Back 2",
                "value": "Def"
            },
            {
                "key": "6",
                "label": "Back 3",
                "value": "Xyz"
            }
        ],
        "headerFields": [
            {
                "key": "7",
                "label": "Header 1",
                "value": "Abc"
            },
            {
                "key": "8",
                "label": "Header 2",
                "value": "Def"
            },
            {
                "key": "9",
                "label": "Header 3",
                "value": "Xyz"
            }
        ],
        "primaryFields": [
            {
                "key": "10",
                "label": "Primary 1",
                "value": "Abc"
            },
            {
                "key": "11",
                "label": "Primary 2",
                "value": "Def"
            },
            {
                "key": "12",
                "label": "Primary 3",
                "value": "Xyz"
            }
        ],
        "secondaryFields": [
            {
                "key": "13",
                "label": "Secondary 1",
                "value": "Abc"
            },
            {
                "key": "14",
                "label": "Secondary 2",
                "value": "Def"
            },
            {
                "key": "15",
                "label": "Secondary 3",
                "value": "Xyz"
            }
        ],
        "associatedStoreIdentifiers": [0]
    }
}
```

With this payload, you can send the request to our 3mint endpoint, ensure your account is authenticated by providing the 3mint API key in the request header:

```javascript
const response = await fetch('https://api.3mint.io/nft/pass', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    "X-API-KEY": '***'
  },
  body: JSON.stringify(payload)
});

const result = await response.json();
```

The result will contain the pass details including a URL for the user to download the pass to their Apple or Google wallet:

```json
{
    "id": "***",
    "createdAt": "2023-03-01T14:43:24.528384+00:00",
    "delegation": null,
    "expireAction": null,
    "expiredAt": null,
    "externalId": null,
    "lastScannedAt": null,
    "ownerAddress": "***",
    "platform": "apple",
    "chain": {
        "name": "evm",
        "network": "80001"
    },
    "registrations": [],
    "nfts": [
        {
            "id": "***",
            "contractAddress": "***",
            "tokenId": "***",
            "contractInterface": "0xd9b67a26"
        }
    ],
    "buffer": {...},
    "fileURL": "https://api.3mint.io/api/link/laWZp4I0RRRGJQpme2hbRzcGJbaX34Yx"
}
```

The `fileURL` value can be offered as a link for the users to tap from their mobile device. It will prompt the user to add the pass to their Apple or Google wallet:

<figure><img src="/files/dgN4qzb13hf6KPDuZxCt" alt=""><figcaption></figcaption></figure>

#### QR Code

You may create a QR code using a library, such as [qrcode](https://github.com/soldair/node-qrcode), to display it for the user to scan with their mobile camera by passing in the file URL from the previous response:

```javascript
const url = QRCode.toDataURL(response.fileURL);
...
<img src={url} width="250" height="250" alt="QR Code for Mobile Pass" />
```

<figure><img src="/files/NZ862ScMf4w37q886lbj" alt=""><figcaption></figcaption></figure>


# Token Gating

A more detailed look at our token-gating solution

## Overview

As Web3 brings new experiences to users, token gating is exploding in popularity. This new authorization method provides access to static or dynamic content based on the user’s ownership of one or more tokens. It can be used to access private discord channels, Shopify perks, digital content, and exclusive IRL events. As brands adopt Web3 and the Metaverse continues to expand, more and more projects will need to implement their own gating mechanism.\
\
From an end user's perspective, the experience of unlocking a gate should be silky smooth: a one-click process that takes milliseconds to complete. Unfortunately, in many cases today this standard isn't quite met, and as token-gating becomes more common, users will increasingly demand a 10x faster experience than traditional log-in systems.

Implementing token gating should also be effortless for developers. However, this isn't always as simple as it seems. Need to check how long a user has held a specific token? Are multiple NFT collections involved? Is the collection a Rarible or OpenSea contract with millions of different projects? Each of these scenarios require rolling your own logic and takes time away from your actual goal: bringing a delightful experience to your users.

With 3mint's token gating API, developers can create even the most complicated gating mechanics with a single call and end users are guaranteed fast response times.

If you would like to request an API key please reach out at <dev@3mint.io> or fill out this [form](https://g134jizfxmb.typeform.com/to/sjlJdFf2)!

### Example Use Cases&#x20;

Gate access to:&#x20;

* Single article or blog post&#x20;
* Website&#x20;
* Product on an eCommerce site&#x20;
* Webinar&#x20;
* Account&#x20;
* Live event&#x20;
* Virtual experience

### Example Gating Conditions

* User owns an NFT with a specific TokenID
* User owns one or more NFTs within a collection
* User holds at least 0.1 ETH or other ERC-20s&#x20;
* User has held an NFT within a collection for at least 6 months
* User has an NFT with specific metadata attributes

## How it all works

### Contract Checking

Once the backend receives the list of requirements the address must meet, the tool verifies each condition individually by calling the respective Smart Contract endpoints.

#### Checking ERC721 balance

{% tabs %}
{% tab title="Ethers" %}
{% code lineNumbers="true" %}

```javascript
export const contract = new ethers.Contract(
  PROJECT_CONTRACT_ADDRESS,
  genericErc721Abi,
  getDefaultProvider([NETWORK], [PROVIDER_KEY])
)

export const walletOwnsToken = async (address: string) => {
  const [balance]: [BigNumber] = await contract.functions.balanceOf(address)
  return balance._hex >= [MIN_AMOUNT]
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

#### Checking ERC1155 balance

{% tabs %}
{% tab title="Ethers" %}
{% code lineNumbers="true" %}

```javascript
export const contract = new ethers.Contract(
  PROJECT_CONTRACT_ADDRESS,
  genericErc1155Abi,
  getDefaultProvider([NETWORK], [PROVIDER_KEY])
)

export const walletOwnsToken = async (address: string) => {
  const [balance]: [BigNumber] = await contract.functions.balanceOf(address)
  return balance._hex >= [MIN_AMOUNT]
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

#### Checking ERC20 balance

{% tabs %}
{% tab title="Ethers" %}
{% code lineNumbers="true" %}

```javascript
const ethers = require('ethers')

export const contract = new ethers.Contract(
  TOKEN_CONTRACT_ADDRESS,
  genericErc20Abi,
  getDefaultProvider([NETWORK], [PROVIDER_KEY])
)

export const walletOwnsToken = async (address: string) => {
  const [balance]: [BigNumber] = await contract.functions.balanceOf(address)
  const formatedBalance = ethers.utils.formatUnits(balance, [TOKEN_DECIMALS])
  return formatedBalance >= [MIN_AMOUNT]
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

**Checking Eth balance**

{% tabs %}
{% tab title="Ethers" %}
{% code lineNumbers="true" %}

```javascript
const ethers = require('ethers')

const network = [NETWORK]
const provider = ethers.getDefaultProvider(network, [PROVIDER_KEY])
const address = [USER_ADDRESS]

provider.getBalance(address).then((balance) => {
 // convert a currency unit from wei to ether
 const balanceInEth = ethers.utils.formatEther(balance)
 return balanceInEth >= [MIN_AMOUNT]
})
```

{% endcode %}
{% endtab %}
{% endtabs %}

### Checking time requirements

{% hint style="warning" %}
Time requirements cannot be used for requests that have a Type of "combo", it must be used with "ercnft", "erc20", "coin", etc.
{% endhint %}

For minTime and minTimestamp conditions, we pull all transfer events related to the specific NFT, token, or native coin for the wallet address included in the request and ensure the balance expected stays the same throughout these events.

### Speedy Responses

We cache all long-running requests and verify their conditions asynchronously to ensure speedy response times for even the most complicated token gating requirements.


# End-to-end Example

Programmatic gating for customers holding an Ethereum ERC1155 NFT

{% hint style="info" %}
To token gate an article, your users first need to hold the right NFT. If you want to create this NFT and send it to them, please check our [Airdrop an NFT](/developer-guides/mint/end-to-end-example) example above!
{% endhint %}

## 1. Get your API keys

Create a [3mint](https://app.3mint.io) account and find your API key on the Settings page.

<figure><img src="/files/qb7SOd68Dh54YKk7iCyx" alt=""><figcaption><p>The key displayed is for demonstration purposes only and will not work in production</p></figcaption></figure>

Your API requests are authenticated using API keys. Any request that doesn't include an API key will return an error.

**The key received should remain secret, which means it should only be accessed on the back end**. Authorization to the API is performed via the X-API-KEY header.&#x20;

## 2. Check Ownership

To verify whether a user has the right NFT, send an authenticated request to the tokenGate endpoint from your website. If you would like to add over parameters (length of time held, quantity held, metadata attributes, please check our [Token Gating](broken://pages/Rtm0fhxsPd6k8R1gnMzM) guide)

{% hint style="info" %}
Every API request must include Content-Type and X-API-KEY headers.
{% endhint %}

{% tabs %}
{% tab title="curl" %}
{% code lineNumbers="true" %}

```json
curl -X POST https://api.3mint.io/api/v1/tokenGate   
   -H "Content-Type: application/json"
   -H "X-API-KEY: [YOUR_API_KEY]"
   -d '{"walletAddress": "[WALLET_OF_USER]",
       "chain": "ethereum",
       "network": "mainnet",
       "requirements": [
           {
               "type": "erc721",
               "contractAddress": "[PROJECT_CONTRACT_ADDRESS]",
               "minBalance": 1,
           }
         ] 
       }'
```

{% endcode %}
{% endtab %}

{% tab title="Axios (JS)" %}
{% code lineNumbers="true" %}

```javascript
import axios from 'axios';

// replace with your 3mint api key
const apiKey = 'demo';
const url = 'https://api.3mint.io/api/v1/tokenGate';

// Include conditions to verify
const ownerAddress = '[WALLET_OF_USER]'
const contractAddress = '[PROJECT_CONTRACT_ADDRESS]'

var requestOptions = {
  method: 'POST',
  url: `${url}`,
  headers: {
    'Content-Type': 'application/json',
    'X-API-KEY': `${apiKey}`
  },
  data: {
    'walletAddress': `${ownerAddress}`,
    'chain': 'ethereum',
    'network': 'mainnet',
    'requirements': [
         {
             'type': 'erc721',
             'contractAddress': `${contractAddress}`,
             'minBalance': 1,
         }
     ]
   }
};

axios(config)
.then(response => console.log(response))
.catch(error => console.log(error));
```

{% endcode %}
{% endtab %}

{% tab title="Fetch (JS)" %}
{% code lineNumbers="true" %}

```javascript
import fetch from 'node-fetch';

// replace with your 3mint api key
const apiKey = 'demo';
const fetchURL = 'https://api.3mint.io/api/v1/tokenGate';

// Include conditions to verify
const ownerAddress = '[WALLET_OF_USER]'
const contractAddress = '[PROJECT_CONTRACT_ADDRESS]'

var requestBody = JSON.stringify({
  'walletAddress': `${ownerAddress}`,
  'chain': 'ethereum',
  'network': 'mainnet',
  'requirements': [
         {
             'type': 'erc721',
             'contractAddress': `${contractAddress}`,
             'minBalance': 1,
         }
     ]
});

var requestOptions = {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-API-KEY': `${apiKey}`
  },
  body: requestBody,
};

// Make the request and print the formatted response:
fetch(fetchURL, requestOptions)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(error => console.log('error', error));
```

{% endcode %}
{% endtab %}
{% endtabs %}

#### Response (by default)

{% code overflow="wrap" lineNumbers="true" %}

```json
{ "result" : true }
```

{% endcode %}


# Code Snippets

Different ways to token gate

{% hint style="info" %}
**SDK Coming Soon**

With the release of our SDK, you'll be able to easily integrate all features within your framework of choice.
{% endhint %}

{% hint style="info" %}
**Demo API key**

You can test the token gating API endpoint using "demo" as the API key. This will work for test networks and is rate limited. **This cannot yet be used for airdrop and wallets APIs.**
{% endhint %}

## NFT Ownership

### User owns 2 ERC721 NFTs

This example verifies that an address holds exactly 2 NFTs from the Bored Ape Yacht Club collection.

{% tabs %}
{% tab title="cURL" %}
{% code lineNumbers="true" %}

```json
curl -X POST https://api.3mint.io/api/v1/tokenGate   
   -H "Content-Type: application/json"
   -H "X-API-KEY: [YOUR_API_KEY]"
   -d '{"walletAddress": "0x958fb436dB50DB2F689C364712113cc226b38151",
       "chain": "ethereum",
       "network": "mainnet",
       "requirements": [
           {
               "type": "erc721",
               "contractAddress": "0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D",
               "minBalance": 2,
               "maxBalance": 2
           }
         ] 
       }'
```

{% endcode %}
{% endtab %}

{% tab title="Axios (JS)" %}
{% code lineNumbers="true" %}

```javascript
import axios from 'axios';

// replace with your 3mint api key
const apiKey = 'demo';
const url = 'https://api.3mint.io/api/v1/tokenGate';

var requestOptions = {
  method: 'POST',
  url: `${url}`,
  headers: {
    'Content-Type': 'application/json',
    'X-API-KEY': `${apiKey}`
  },
  data: {
    'walletAddress': '0x958fb436dB50DB2F689C364712113cc226b38151',
    'chain': 'ethereum',
    'network': 'mainnet',
    'requirements': [
         {
            'type': 'erc721',
            'contractAddress': '0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D',
            'minBalance': 2,
            'maxBalance': 2
        },
     ]
   }
};

axios(config)
.then(response => console.log(response))
.catch(error => console.log(error));
```

{% endcode %}
{% endtab %}
{% endtabs %}

### User owns at least 1 ERC1155 with a specific token ID

This example verifies that an address holds at least one NFT from the Crypto Baristas collection.

{% hint style="info" %}
Since the smart contracts that OpenSea and Rarible provide have thousands of different NFT projects listed on them, the only way to accurately token gate something is by including the different IDs that a user should own.
{% endhint %}

{% tabs %}
{% tab title="cURL" %}
{% code lineNumbers="true" %}

```json
curl -X POST https://api.3mint.io/api/v1/tokenGate   
   -H "Content-Type: application/json"
   -H "X-API-KEY: [YOUR_API_KEY]"
   -d '{"walletAddress": "0x958fb436dB50DB2F689C364712113cc226b38151",
       "chain": "ethereum",
       "network": "mainnet",
       "requirements": [
           {
               "type": "erc1155",
                "contractAddress": "0xf6793da657495ffeff9ee6350824910abc21356c",
                "tokenIds": [
                    9720425186420365222353899819497168751076639606951250294350818944954633551881,
                    9720425186420365222353899819497168751076639606951250294350818944954633551883,
                    9720425186420365222353899819497168751076639606951250294350818944954633551885,
                    ...
                ],
                "minBalance": 1
            }
         ] 
       }'
```

{% endcode %}
{% endtab %}

{% tab title="Axios (JS)" %}
{% code lineNumbers="true" %}

```javascript
import axios from 'axios';

// replace with your 3mint api key
const apiKey = 'demo';
const url = 'https://api.3mint.io/api/v1/tokenGate';

var requestOptions = {
  method: 'POST',
  url: `${url}`,
  headers: {
    'Content-Type': 'application/json',
    'X-API-KEY': `${apiKey}`
  },
  data: {
    'walletAddress': '0x958fb436dB50DB2F689C364712113cc226b38151',
    'chain': 'ethereum',
    'network': 'mainnet',
    'requirements': [
         {
            'type': 'erc1155',
            'contractAddress': '0xf6793da657495ffeff9ee6350824910abc21356c',
            'tokenIds': [
                9720425186420365222353899819497168751076639606951250294350818944954633551881,
                9720425186420365222353899819497168751076639606951250294350818944954633551883,
                9720425186420365222353899819497168751076639606951250294350818944954633551885,
                ...
            ],
            'minBalance': 1
        },
     ]
   }
};

axios(config)
.then(response => console.log(response))
.catch(error => console.log(error));
```

{% endcode %}
{% endtab %}
{% endtabs %}

### User owns multiple ERC721 NFTs from different collections

This example verifies that an address holds at least 1 Bored Ape and two ApeDocs NFT.

{% tabs %}
{% tab title="cURL" %}
{% code lineNumbers="true" %}

```json
curl -X POST https://api.3mint.io/api/v1/tokenGate   
   -H "Content-Type: application/json"
   -H "X-API-KEY: [YOUR_API_KEY]"
   -d '{"walletAddress": "0x958fb436dB50DB2F689C364712113cc226b38151",
       "chain": "ethereum",
       "network": "mainnet",
       "requirements": [
           {
                "type": "erc721",
                "contractAddress": "0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D",
                "minBalance": 1
            },
            {
                "logic": "and",
                "type": "erc721",
                "contractAddress": "0x552a43cb61bc127d81b1f280bc39f62e5a51c0c2",
                "minBalance": 2
            }
         ] 
       }'
```

{% endcode %}
{% endtab %}

{% tab title="Axios (JS)" %}
{% code lineNumbers="true" %}

```javascript
import axios from 'axios';

// replace with your 3mint api key
const apiKey = 'demo';
const url = 'https://api.3mint.io/api/v1/tokenGate';

var requestOptions = {
  method: 'POST',
  url: `${url}`,
  headers: {
    'Content-Type': 'application/json',
    'X-API-KEY': `${apiKey}`
  },
  data: {
    'walletAddress': '0x958fb436dB50DB2F689C364712113cc226b38151',
    'chain': 'ethereum',
    'network': 'mainnet',
    'requirements': [
         {
          'type': 'erc721',
          'contractAddress': '0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D',
          'minBalance': 1
          },
          {
          'logic': 'and',
          'type': 'erc721',
          'contractAddress': '0x552a43cb61bc127d81b1f280bc39f62e5a51c0c2',
          'minBalance': 2
          },
       ]
    }
};

axios(config)
.then(response => console.log(response))
.catch(error => console.log(error));
```

{% endcode %}
{% endtab %}
{% endtabs %}

### User owns 1 ERC721 NFT for at least 6 months and 10 days

{% hint style="warning" %}
You cannot have both minTime and minBalance parameters set in the same object request.
{% endhint %}

This example verifies that an address has held 1 NFT from the Bored Ape Yacht Club collection for at least 6 months and 10 days.

{% tabs %}
{% tab title="cURL" %}
{% code lineNumbers="true" %}

```json
curl -X POST https://api.3mint.io/api/v1/tokenGate   
   -H "Content-Type: application/json"
   -H "X-API-KEY: [YOUR_API_KEY]"
   -d '{"walletAddress": "0x958fb436dB50DB2F689C364712113cc226b38151",
       "chain": "ethereum",
       "network": "mainnet",
       "requirements": [
           {
               "contractType": "erc721",
               "contractAddress": "0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D",
               "minBalance": 1,
               "minTime": "0.6.10.0.0" //format: "years.months.days.hours.minutes"
            },
         ] 
       }'
```

{% endcode %}
{% endtab %}

{% tab title="Axios (JS)" %}
{% code lineNumbers="true" %}

```javascript
import axios from 'axios';

// replace with your 3mint api key
const apiKey = 'demo';
const url = 'https://api.3mint.io/api/v1/tokenGate';

var requestOptions = {
  method: 'POST',
  url: `${url}`,
  headers: {
    'Content-Type': 'application/json',
    'X-API-KEY': `${apiKey}`
  },
  data: {
    'walletAddress': '0x958fb436dB50DB2F689C364712113cc226b38151',
    'chain': 'ethereum',
    'network': 'mainnet',
    'requirements': [
         {
            'contractType': 'erc721',
            'contractAddress': '0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D',
            'minBalance': 1,
            'minTime': '0.6.10.0.0' //format: 'years.months.days.hours.minutes'
        },
     ]
   }
};

axios(config)
.then(response => console.log(response))
.catch(error => console.log(error));
```

{% endcode %}
{% endtab %}
{% endtabs %}

### User owns 1 ERC721 NFT since the beginning of 2022

{% hint style="warning" %}
minTimestamp must follow format in example below (e.g., 2014-09-08T08:02:17.160Z)
{% endhint %}

This example verifies that an address has held 1 NFT from the Bored Ape Yacht Club collection since the beginning of 2022.

{% tabs %}
{% tab title="cURL" %}

```json
curl -X POST https://api.3mint.io/api/v1/tokenGate   
   -H "Content-Type: application/json"
   -H "X-API-KEY: [YOUR_API_KEY]"
   -d '{"walletAddress": "0x958fb436dB50DB2F689C364712113cc226b38151",
       "chain": "ethereum",
       "network": "mainnet",
       "requirements": [
           {
               "type": "erc721",
               "contractAddress": "0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D",
               "minBalance": 1,
               "minTimestamp": "2022-01-01T00:00:00.000Z"
            },
         ] 
       }'
```

{% endtab %}

{% tab title="Axios (JS)" %}
{% code lineNumbers="true" %}

```javascript
import axios from 'axios';

// replace with your 3mint api key
const apiKey = 'demo';
const url = 'https://api.3mint.io/api/v1/tokenGate';

var requestOptions = {
  method: 'POST',
  url: `${url}`,
  headers: {
    'Content-Type': 'application/json',
    'X-API-KEY': `${apiKey}`
  },
  data: {
    'walletAddress': '0x958fb436dB50DB2F689C364712113cc226b38151',
    'chain': 'ethereum',
    'network': 'mainnet',
    'requirements': [
         {
            'type': 'erc721',
            'contractAddress': '0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D',
            'minBalance': 1,
            'minTimestamp': '2022-01-01T00:00:00.000Z'
        },
     ]
   }
};

axios(config)
.then(response => console.log(response))
.catch(error => console.log(error));
```

{% endcode %}
{% endtab %}
{% endtabs %}

### User owns 1 ERC721 NFT with specific metadata attributes

This example verifies that an address holds at least 1 Crypto Punk with two attribute types.

{% tabs %}
{% tab title="cURL" %}
{% code lineNumbers="true" %}

```json
curl -X POST https://api.3mint.io/api/v1/tokenGate   
   -H "Content-Type: application/json"
   -H "X-API-KEY: [YOUR_API_KEY]"
   -d '{"walletAddress": "0x958fb436dB50DB2F689C364712113cc226b38151",
       "chain": "ethereum",
       "network": "mainnet",
       "requirements": [
           {
                "type": "erc721",
                "contractAddress": "0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D",
                "minBalance": 1,
                "attributes": [
                    {
                        "traitType": "Type",
                        "value": "Female 2"
                    },
                    {
                        "traitType": "Attribute",
                        "value": "Wild Blonde"
                    }
                ],
            },
         ] 
       }'
```

{% endcode %}
{% endtab %}

{% tab title="Axios (JS)" %}
{% code lineNumbers="true" %}

```javascript
import axios from 'axios';

// replace with your 3mint api key
const apiKey = 'demo';
const url = 'https://api.3mint.io/api/v1/tokenGate';

var requestOptions = {
  method: 'POST',
  url: `${url}`,
  headers: {
    'Content-Type': 'application/json',
    'X-API-KEY': `${apiKey}`
  },
  data: {
    'walletAddress': '0x958fb436dB50DB2F689C364712113cc226b38151',
    'chain': 'ethereum',
    'network': 'mainnet',
    'requirements': [
         {
            'type': 'erc721',
            'contractAddress': '0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D',
            'minBalance': 1,
            'attributes': [
                {
                    'traitType': 'Type',
                    'value': 'Female 2'
                },
                {
                    'traitType': 'Attribute',
                    'value': 'Wild Blonde'
                }
            ],
        },
     ]
   }
};

axios(config)
.then(response => console.log(response))
.catch(error => console.log(error));javascr
```

{% endcode %}
{% endtab %}
{% endtabs %}

## Token Ownership

{% hint style="info" %}
Token balance amounts can include decimals.
{% endhint %}

### Address owns at least 2 WETH

{% tabs %}
{% tab title="cURL" %}
{% code lineNumbers="true" %}

```json
curl -X POST https://api.3mint.io/api/v1/tokenGate   
   -H "Content-Type: application/json"
   -H "X-API-KEY: [YOUR_API_KEY]"
   -d '{"walletAddress": "0x958fb436dB50DB2F689C364712113cc226b38151",
       "chain": "ethereum",
       "network": "mainnet",
       "requirements": [
           {
               "type": "erc20",
               "contractAddress": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
               "minBalance": 2
            },
         ] 
       }'
```

{% endcode %}
{% endtab %}

{% tab title="Axios (JS)" %}
{% code lineNumbers="true" %}

```javascript
import axios from 'axios';

// replace with your 3mint api key
const apiKey = 'demo';
const url = 'https://api.3mint.io/api/v1/tokenGate';

var requestOptions = {
  method: 'POST',
  url: `${url}`,
  headers: {
    'Content-Type': 'application/json',
    'X-API-KEY': `${apiKey}`
  },
  data: {
    'walletAddress': '0x958fb436dB50DB2F689C364712113cc226b38151',
    'chain': 'ethereum',
    'network': 'mainnet',
    'requirements': [
         {
            'type': 'erc20',
            'contractAddress': '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
            'minBalance': 2
        },
     ]
   }
};

axios(config)
.then(response => console.log(response))
.catch(error => console.log(error));javascr
```

{% endcode %}
{% endtab %}
{% endtabs %}

### Address has held at least 2 WETH for 30 days

{% tabs %}
{% tab title="cURL" %}
{% code lineNumbers="true" %}

```json
curl -X POST https://api.3mint.io/api/v1/tokenGate   
   -H "Content-Type: application/json"
   -H "X-API-KEY: [YOUR_API_KEY]"
   -d '{"walletAddress": "0x958fb436dB50DB2F689C364712113cc226b38151",
       "chain": "ethereum",
       "network": "mainnet",
       "requirements": [
           {
               "type": "erc20",
               "contractAddress": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
               "minBalance": 2,
               "minTime": "0.0.30.0.0"
            },
         ] 
       }'
```

{% endcode %}
{% endtab %}

{% tab title="Axios (JS)" %}
{% code lineNumbers="true" %}

```javascript
import axios from 'axios';

// replace with your 3mint api key
const apiKey = 'demo';
const url = 'https://api.3mint.io/api/v1/tokenGate';

var requestOptions = {
  method: 'POST',
  url: `${url}`,
  headers: {
    'Content-Type': 'application/json',
    'X-API-KEY': `${apiKey}`
  },
  data: {
    'walletAddress': '0x958fb436dB50DB2F689C364712113cc226b38151',
    'chain': 'ethereum',
    'network': 'mainnet',
    'requirements': [
         {
            'type': 'erc20',
            'contractAddress': '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
            'minBalance': 2,
            'minTime': '0.0.30.0.0'
        },
     ]
   }
};

axios(config)
.then(response => console.log(response))
.catch(error => console.log(error));javascr
```

{% endcode %}
{% endtab %}
{% endtabs %}

## Coin Ownership

{% hint style="info" %}
Coin balance amounts can include decimals.
{% endhint %}

### Address owns at least 2.5 ETH

{% tabs %}
{% tab title="cURL" %}
{% code lineNumbers="true" %}

```json
curl -X POST https://api.3mint.io/api/v1/tokenGate   
   -H "Content-Type: application/json"
   -H "X-API-KEY: [YOUR_API_KEY]"
   -d '{"walletAddress": "0x958fb436dB50DB2F689C364712113cc226b38151",
       "chain": "ethereum",
       "network": "mainnet",
       "requirements": [
           {
               "type": "coin",
               "chain": "ethereum"
               "network": "mainnet",
               "minBalance": 2.5
            },
         ] 
       }'
```

{% endcode %}
{% endtab %}

{% tab title="Axios (JS)" %}
{% code lineNumbers="true" %}

```javascript
import axios from 'axios';

// replace with your 3mint api key
const apiKey = 'demo';
const url = 'https://api.3mint.io/api/v1/tokenGate';

var requestOptions = {
  method: 'POST',
  url: `${url}`,
  headers: {
    'Content-Type': 'application/json',
    'X-API-KEY': `${apiKey}`
  },
  data: {
    'walletAddress': '0x958fb436dB50DB2F689C364712113cc226b38151',
    'chain': 'ethereum',
    'network': 'mainnet',
    'requirements': [
         {
            'type': 'coin',
            'minBalance': 2.5,
        },
     ]
   }
};

axios(config)
.then(response => console.log(response))
.catch(error => console.log(error));javascr
```

{% endcode %}
{% endtab %}
{% endtabs %}

## Combos

{% hint style="info" %}
Combos can be deeply nested (i.e., you can have a combo within a combo). This allows you to do complex token gating mechanisms, like:

if ((A and B) or (C and (D or E))), then...
{% endhint %}

### User owns 5 ETH or 2 WETH plus 1 to 4 ERC721 NFTs&#x20;

This example verifies that an address holds at least 5 ETH or 2 WETH and 1 to 4 ApeDocs NFTs.

{% tabs %}
{% tab title="cURL" %}
{% code lineNumbers="true" %}

```json
curl -X POST https://api.3mint.io/api/v1/tokenGate   
   -H "Content-Type: application/json"
   -H "X-API-KEY: [YOUR_API_KEY]"
   -d '{"walletAddress": "0x958fb436dB50DB2F689C364712113cc226b38151",
       "chain": "ethereum",
       "network": "mainnet",
       "requirements": [
            {
                "type": "coin",
                "minBalance": 5
            },
            {
                "logic": "or",
                "type": "combo",
                "requirements": [
                    {
                        "type": "erc20",
                        "contractAddress": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
                        "minBalance": 2
                    },
                    {
                        "logic": "and",
                        "type": "erc721",
                        "contractAddress": "0x552a43cb61bc127d81b1f280bc39f62e5a51c0c2",
                        "minBalance": 1,
                        "maxBalance": 4
                    }
                ]
            }
        ]
   }'
```

{% endcode %}
{% endtab %}

{% tab title="Axios (JS)" %}
{% code lineNumbers="true" %}

```javascript
import axios from 'axios';

// replace with your 3mint api key
const apiKey = 'demo';
const url = 'https://api.3mint.io/api/v1/tokenGate';

var requestOptions = {
  method: 'POST',
  url: `${url}`,
  headers: {
    'Content-Type': 'application/json',
    'X-API-KEY': `${apiKey}`
  },
  data: {
    'walletAddress': '0x958fb436dB50DB2F689C364712113cc226b38151',
    'chain': 'ethereum',
    'network': 'mainnet',
    'requirements': [
         {
            'type': 'coin',
            'minBalance': 5
        },
        {
            'logic': 'or',
            'type': 'combo',
            'requirements': [
                {
                    'type': 'erc20',
                    'contractAddress': '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
                    'minBalance': 2
                },
                {
                    'logic': 'and',
                    'type': 'erc721',
                    'contractAddress': '0x552a43cb61bc127d81b1f280bc39f62e5a51c0c2',
                    'minBalance': 1,
                    'maxBalance': 4
                }
            ]
        },
     ]
  } 
};

axios(config)
.then(response => console.log(response))
.catch(error => console.log(error));javascr
```

{% endcode %}
{% endtab %}
{% endtabs %}


# Overview

{% hint style="info" %}
APIs currently work on:

* Polygon Mainnet and Mumbai
  {% endhint %}


# Contracts


# Deploy Contract

Create and deploy a contract (ERC20, ERC721, ERC1155 or equivalent) to the chain and network of choice.

{% openapi src="/files/2Py7FhKKgnURq2NjjhHR" path="/v1/contract" method="post" %}
[api-json.json](https://1032756590-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmEIcCxTJJ3QAa0VWWBYx%2Fuploads%2F12vC9sHbeiPgREX2EBGP%2Fapi-json.json?alt=media\&token=e97b3929-f979-4703-90ca-1c7a78a62b5c)
{% endopenapi %}


# Get Contract

Get information about a contract, such as name, description, symbol, chain, and network.

{% openapi src="/files/2Py7FhKKgnURq2NjjhHR" path="/v1/contract" method="get" %}
[api-json.json](https://1032756590-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmEIcCxTJJ3QAa0VWWBYx%2Fuploads%2F12vC9sHbeiPgREX2EBGP%2Fapi-json.json?alt=media\&token=e97b3929-f979-4703-90ca-1c7a78a62b5c)
{% endopenapi %}


# Collectibles


# Get All Templates

{% openapi src="/files/2Py7FhKKgnURq2NjjhHR" path="/v1/nft/template/{contractId}" method="get" %}
[api-json.json](https://1032756590-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmEIcCxTJJ3QAa0VWWBYx%2Fuploads%2F12vC9sHbeiPgREX2EBGP%2Fapi-json.json?alt=media\&token=e97b3929-f979-4703-90ca-1c7a78a62b5c)
{% endopenapi %}


# Mint Collectible

Mint NFTs or tokens from a deployed contract to a web3 wallet

{% openapi src="/files/2Py7FhKKgnURq2NjjhHR" path="/v1/nft/mint" method="post" %}
[api-json.json](https://1032756590-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmEIcCxTJJ3QAa0VWWBYx%2Fuploads%2F12vC9sHbeiPgREX2EBGP%2Fapi-json.json?alt=media\&token=e97b3929-f979-4703-90ca-1c7a78a62b5c)
{% endopenapi %}


# Wallets


# Create Wallet

Creates a new user wallet on a given chain. If user ID is not provided, a new user will automatically be created.

{% openapi src="/files/2Py7FhKKgnURq2NjjhHR" path="/v1/wallet" method="post" %}
[api-json.json](https://1032756590-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmEIcCxTJJ3QAa0VWWBYx%2Fuploads%2F12vC9sHbeiPgREX2EBGP%2Fapi-json.json?alt=media\&token=e97b3929-f979-4703-90ca-1c7a78a62b5c)
{% endopenapi %}


# Get Wallet

Retreive a wallet address

{% openapi src="/files/2Py7FhKKgnURq2NjjhHR" path="/v1/wallet" method="get" %}
[api-json.json](https://1032756590-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmEIcCxTJJ3QAa0VWWBYx%2Fuploads%2F12vC9sHbeiPgREX2EBGP%2Fapi-json.json?alt=media\&token=e97b3929-f979-4703-90ca-1c7a78a62b5c)
{% endopenapi %}


# Customers


# Create Customer

Creates a new customer with name, email, and other information.&#x20;

{% openapi src="/files/2Py7FhKKgnURq2NjjhHR" path="/v1/customer" method="post" %}
[api-json.json](https://1032756590-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmEIcCxTJJ3QAa0VWWBYx%2Fuploads%2F12vC9sHbeiPgREX2EBGP%2Fapi-json.json?alt=media\&token=e97b3929-f979-4703-90ca-1c7a78a62b5c)
{% endopenapi %}


# Get Customer

Fetches all information on a customer.&#x20;

{% openapi src="/files/2Py7FhKKgnURq2NjjhHR" path="/v1/customer" method="get" %}
[api-json.json](https://1032756590-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmEIcCxTJJ3QAa0VWWBYx%2Fuploads%2F12vC9sHbeiPgREX2EBGP%2Fapi-json.json?alt=media\&token=e97b3929-f979-4703-90ca-1c7a78a62b5c)
{% endopenapi %}


# Delete Customer

Delete an existing customer.&#x20;

{% openapi src="/files/2Py7FhKKgnURq2NjjhHR" path="/v1/customer/delete" method="patch" %}
[api-json.json](https://1032756590-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmEIcCxTJJ3QAa0VWWBYx%2Fuploads%2F12vC9sHbeiPgREX2EBGP%2Fapi-json.json?alt=media\&token=e97b3929-f979-4703-90ca-1c7a78a62b5c)
{% endopenapi %}


# Claim Links


# Create Link

Create a mint for a particular user or group of users with claim parameters, such as claim dates, price, group labels, etc..

{% openapi src="/files/2Py7FhKKgnURq2NjjhHR" path="/v1/link" method="post" %}
[api-json.json](https://1032756590-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmEIcCxTJJ3QAa0VWWBYx%2Fuploads%2F12vC9sHbeiPgREX2EBGP%2Fapi-json.json?alt=media\&token=e97b3929-f979-4703-90ca-1c7a78a62b5c)
{% endopenapi %}


# Update Link

Update a mint link with claim parameters, such as claim dates, price, group labels, etc..

{% openapi src="/files/2Py7FhKKgnURq2NjjhHR" path="/v1/link/{id}" method="patch" %}
[api-json.json](https://1032756590-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmEIcCxTJJ3QAa0VWWBYx%2Fuploads%2F12vC9sHbeiPgREX2EBGP%2Fapi-json.json?alt=media\&token=e97b3929-f979-4703-90ca-1c7a78a62b5c)
{% endopenapi %}


# Token Gating


# Create Gate

## Verifying token gating requirements

## Validate address elements

<mark style="color:green;">`POST`</mark> `https://api.3mint.io/api/v1/tokenGate`

Single API call that verifies the ownership of a token and returns whether or not certain conditions are met.

#### Headers

| Name                                           | Type   | Description                        |
| ---------------------------------------------- | ------ | ---------------------------------- |
| X-API-KEY<mark style="color:red;">\*</mark>    | String | API key required for authorization |
| Content-Type<mark style="color:red;">\*</mark> | String | application/json                   |

#### Request Body

| Name                                            | Type   | Description                                                    |
| ----------------------------------------------- | ------ | -------------------------------------------------------------- |
| contractAddress                                 | String | The address of an ERC-20, ERC-721, or ERC-1155 contract        |
| logic                                           | String | The and / or element to combine multiple requirements          |
| requirements                                    | List   | An extra list of requirements if a combo requirement is needed |
| type<mark style="color:red;">\*</mark>          | String | The type of asset being verified: erc1155, erc721, erc20, coin |
| walletAddress<mark style="color:red;">\*</mark> | String | The address of an Externally Owned Account (EOA)               |
| network                                         | String | The network in question: Mainnet, Mumbai, Goerli, etc.         |
| tokenIds                                        | Array  | A list of token IDs                                            |
| chain                                           | String | The blockchain to use: Ethereum, Polygon, Optimism, etc.       |
| minBalance                                      | String | Minimum balance required                                       |
| maxBalance                                      | String | Maximum balance required                                       |
| minTime                                         | String | Minimum amount of time a wallet must hold the required balance |
| minTimestamp                                    | String | The date from which the wallet must hold the required balance  |

{% tabs %}
{% tab title="400: Bad Request One or more arguments are invalid or required arguments are missing" %}

```javascript
{
  "code":"invalid_request",
  "msg":"string"
}
```

{% endtab %}

{% tab title="200: OK Successful response" %}

```javascript
{
    "result": "true"
}
```

{% endtab %}

{% tab title="401: Unauthorized The access token doesn't meet the token ownership requirements." %}

```javascript
{
  "code":"invalid_request",
  "msg":"string"
}
```

{% endtab %}
{% endtabs %}


# Web3 101

## **What is a Smart Contract?**

The building block of any NFT is the contract that you first need to deploy to a blockchain. Think of this contract as public way to show who owns which NFT (i.e., it's a simple table that has the user’s wallet address in the left column and the NFT the user owns in the right column). Below are the types of contracts available on 3mint.

### Single Copy (ERC-721)

This standard is used for creating tokens that are all non-fungible. Non-fungible means that an item is one of a kind, completely unique, and can't be traded for another item. Examples of collections that use ERC-721 include Bored Apes Yacht Club, Cryptopunks, and Cryptokitties.

#### Key Characteristics

* Non-fungible tokens representing ownership of arbitrary data.
* Only one NFT can reside in a single contract.
* Ideal for digital assets that represent one's immutable ownership of those assets (e.g. digital art).

### Multiple Copies (ERC-1155)

This standard is used for creating tokens that can be fungible, semi-fungible, and/or non-fungible. This is a common choice for creating multiple copies of a token and minting many NFTs at scale. Example use cases include in-game items and pick-ups, NFT tickets, songs, proof of attendance, etc.

#### Key Characteristics

* Semi-fungible tokens categorized by token kind.
* Multiple NFTs can reside in a single contract.
* Ideal for gaming collectables, membership badges, and POAPs.

### Token (ERC-20)

This standard is used for creating the equivalent of virtual currencies on a blockchain. By default, every ERC-20 token is fungible and is not considered an NFT. There is no artwork or other media (image, video, etc.) attached to the token.

**Key Characteristics**

* Fungible token that can be used as currency
* No digital content or metadata associated
* Ideal for loyalty points

It is important to understand your current and future use case before committing to a contract type as the contracts are not upgradable and can't be changed once deployed. **If you would like a more technical breakdown of each contract available on 3mint, visit the** [**Contract Architectures**](/developer-guides/contracts/contract-architecture) **page**


# Platform

Most commonly asked questions

#### Why can't I see the image of the NFT I created on platforms like OpenSea?

The most common reason you may not see your NFT image is if you have minted an NFT, but did not upload digital content for it on the 3mint platform (this will occur for both ERC721 and ERC1155 contracts). To do so, make sure you have added media content for your collections by clicking on the "info" button in the row related to the specific collection you would like to modify.


