Bring your own contract
How to use the Mint API with your existing Smart Contract in Polygon.
When you use the standalone Minting API, Crossmint takes care of deploying a smart contract on your behalf for every collection. This Crossmint contract may not meet all of your custom needs. In those cases, you can bring your own contract and have the Minting API mint from it on your behalf. It can also handle gas fee payments, scalability, reliability and user wallet creation for you.
Bringing your contract is currently under private alpha
If you'd like access, please reach out to support to let us know about your use case.
Smart contract pre-requisites
The Crossmint Minting API imposes the following requirements on your smart contract:
-
It must implement the ERC721 standard
-
The contract can have payable or non-payable mint functions as long as it is free to mint.
-
Such function must allow the Crossmint treasury account to mint off of it. Refer to Crossmint Treasury Addresses for the appropriate address depending on your chain and environment.
We recommend that you use Open Zeppelin's audited
AccessControl
contract to manage the authorization logic. Here is a very basic abbreviated example of how to implement this:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/access/AccessControl.sol";
...
contract BYOCMinter is ERC721, AccessControl {
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
constructor() payable ERC721("EVM 721 Starter", "XMPL") {
_grantRole(MINTER_ROLE, msg.sender);
// THIS IS THE IMPORTANT DETAIL
_grantRole(MINTER_ROLE, '0x13253aa4Abe1861124d4c286Ee4374cD054D3eb9'); // polygon mumbai
_grantRole(MINTER_ROLE, '0xa8C10eC49dF815e73A881ABbE0Aa7b210f39E2Df'); // polygon mainnet
}
function mint(address _to, string calldata uri) external onlyRole(MINTER_ROLE) {
// mint function logic
}
}
Additional Integrations
The Minting API supports many additional integrations such as Salesforce and Infura SDK (ERC721Mintable). Please contact support if you'd like to get started or test other integrations!
Integration Guide
1️⃣ Create a Crossmint developer account and set up your project
To get started, the first thing you'll need to do is register as a developer in the Crossmint developer console.
Crossmint has two consoles: one for production, at www.crossmint.com/console, and one for testing and development, at staging.crossmint.com/console.
Once your account is created and logged into the developer console, you can navigate to the API Keys
tab and create a key with the nfts.create & nfts.read
scope.
2️⃣ Register your smart contract
While on the Crossmint developer console, navigate to the Payments
tab, click on New Collection
, and fill in the form. The description, image and logo are not relevant here, so you can leave them blank. For blockchain, enter Polygon
.
Once created, click on Contract Registration
, and enter the following info about your smart contract:
- Contract type:
ERC-721
- Contract address:
the address of your deployed smart contract
- ABI section for mint function: copy the ABI for your contract obtained on compilation or by successful contract verification on Polygonscan (or equivalent chain explorer)
- NFT recipient address mint function argument
- NFT amount mint function argument: leave as “
N/A
”

contract registration example via developer console
3️⃣ Contract review
Copy the collectionID from the collection page in the Crossmint console:
Then provide your Crossmint team point of contact with such collectionID.
We will use this information to create a mintAPI collection on your behalf. We will provide you a new collectionId in this process that you can use to make calls to the Minting API.
4️⃣ Start minting NFTs!
You can call any of the Mint API functions documented in our API reference.
The only difference is that the Mint an NFT
function request changes: you can’t pass custom metadata (as that’s controlled by your contract), and you must all pass all the parameters needed to call your mint function, except the one specifying the recipient (which is populated by our application). All in all, the request body looks as follows:
{
"recipient": "<locator in format specified at https://docs.crossmint.com/docs/recipients>"
"contractArguments": {
// JSON object with the arguments to the mint function and specified value
}
}
Below is an example:
{
"recipient": "email:<email address>:poly",
"contractArguments": {
"tokenCount_": 1,
"signature": "0xabc..."
}
}
With this request, users will receive the NFT in a custodial wallet associated with their email address.
Refer to the Crossmint Minting API docs and reference for more operations beyond basic minting, best practices, etc.
Updated 21 days ago