How to Create and Update NFTs Programmatically Using the Paper API

How to Create and Update NFTs Programmatically Using the Paper API
How to Create & Update NFTs Programmatically

If you're looking to create and update an NFT contract programmatically, you're in the right place. In this guide, I'll walk you through the process step by step, so you can have your new NFT contract (and prebuilt Checkout Link) up and running in no time. Let's dive in!

If you'd prefer to create an NFT contract with no-code, you can do that via our dashboard.

How to Create an NFT Collection With The Same Asset (Without Code)
In this tutorial, we will walk you through the process of creating an NFT contract with a Paper, where all holders of the NFT will have the same image or asset. This type of contract is useful for membership cards, event passes, and more. In this specific example, we will
How to Create an NFT Without Code

Prerequisites

Before we start, make sure you have the following:

  • A title and image for the NFT collection you want to create.
  • (Optional) Unique titles and images for each NFT you'll be minting.
  • A wallet address to receive funds – no need to worry about having crypto on hand!
  • An API key to authenticate your requests to the Paper API.

Creating a Collection with the Same Asset/Image

To create a collection where every NFT has the same asset/image using the Paper API, follow these steps:

  1. Make a POST request to this endpoint: https://withpaper.com/api/2022-08-12/paper-managed-contract
  2. Include the required headers in your request:
Authorization: Bearer {API_KEY}
Content-Type: application/json

Replace {API_KEY} with your actual API key.

3. Include the required parameters in the request body:

{
  "contractType": "THIRDWEB_NFT_DROP_V2",
  "contractChain": "Mumbai",
  "collectionName": "My NFT collection by Paper",
  "primaryWalletAddress": "0x123AbC...",
  "paymentValue": "0.1",
  "paymentCurrency": "USDC",
  "royaltyBasisPoints": 0,
  "imageUrl": "https://replacewithyourimageurl.com/"
}

4. If your request is successful, you'll receive a response with the contract ID and other details.

Creating a Collection with Different Assets/Images

To create a collection where each NFT has a different asset using the Paper API, follow these steps:

  1. Make a POST request to the same endpoint as before: https://withpaper.com/api/2022-08-12/paper-managed-contract
  2. Include the required headers in your request:
Authorization: Bearer {API_KEY}
Content-Type: application/json

Replace {API_KEY} with your actual API key.

3.  Include the required parameters in the request body:

{
  "contractType": "THIRDWEB_NFT_DROP_V2",
  "contractChain": "Mumbai",
  "collectionName": "My Unique NFT collection by Paper",
  "primaryWalletAddress": "0x123AbC...",
  "paymentValue": "0.1",
  "paymentCurrency": "USDC",
  "royaltyBasisPoints": 0,
}

4.  If your request is successful, you'll receive a response with the contract ID and other details.

5.  After creating the contract, you'll need to batch upload NFTs for the collection with different assets. Make a POST request to this endpoint: https://withpaper.com/api/2022-08-12/paper-managed-contract/{contractId}/batch-upload, replacing {contractId} with the contract ID you got in the previous step.

6.  Include the required headers in your request:

Authorization: Bearer {API_KEY}
Content-Type: application/json

Replace {API_KEY} with your actual API key.

7.  Include the required parameters in the request body, like an array of objects containing the NFT data.

{
  "nftsData": [
    {
      "name": "NFT 1",
      "description": "Description for NFT 1",
      "imageUrl": "<https://example.com/nft1.png>"
    },
    {
      "name": "NFT 2",
      "description": "Description for NFT 2",
      "imageUrl": "<https://example.com/nft2.png>"
    }
  ]
}

8.  If your request is successful, you'll receive a response confirming the batch upload.

How to Update an NFT Contract

If you want to update an existing Paper-managed NFT contract, follow these steps:

  1. Make a PUT request to this endpoint: https://withpaper.com/api/2022-08-12/paper-managed-contract/{contractId}, replacing {contractId} with the contract ID you want to update.
  2. Include the required headers in your request:
Authorization: Bearer {API_KEY}
Content-Type: application/json

Replace {API_KEY} with your actual API key.

3.  Include the parameters you want to update in the request body, like collection name, description, image URL, payment value, payment currency, primary wallet address, and royalty basis points.

{
  "collectionName": "Updated NFT collection by Paper",
  "collectionDescription": "Updated description for the NFT collection",
  "imageUrl": "<https://example.com/updated_image.png>",
  "paymentValue": "0.2",
  "paymentCurrency": "USDC",
  "primaryWalletAddress": "0x123AbC...",
  "royaltyBasisPoints": 50
}

4.  If your request is successful, you'll receive a response confirming the contract update.

Wrapping Up

And that's it! By following the steps in this guide, including the necessary header requests, you can create and amend NFT contracts using the Paper API for both collections with the same asset and collections with different assets. This makes managing your NFT collections and making updates a breeze.

Don't forget to test your contracts and double-check that funds are sent to the correct wallet address before launching your NFT collection. With the Paper API, you can also access more advanced configuration options for your contract, such as granular control over pricing, allowlists, and metadata.

Using our APIs, you can simplify the process of creating, managing, and updating your NFT contracts, making it easier than ever to launch and maintain NFT collections in less than 5 minutes. Happy minting!

All our NFT contracts come with pre-built Checkout Links, that allow your customers to easily buy your NFTs with card or crypto.  

2a. Shareable Checkout Links
🕒 This guide takes 5 minutes to create a fully functional checkout link.
How Shareable Checkout Links Work