These docs are for v1.0. Click to read the latest docs for v3.0.

Getting started

Covering the basics from authentication to minting your first NFT.

What we cover in this guide

In this guide, we will explain how to authenticate to our API service, as well as create your first NFT. We will walk you through several endpoints to help you get started. We will cover the following topics:

  1. How to authenticate
  2. How to create a contract
  3. How to create a token-type
  4. How to mint an NFT

Prerequisites

  1. You need a Venly business account, if you don't have one, click here to register in our Developer Portal, or follow our step-by-step guide, Getting Started with Venly.
  2. You need an active trial or paid subscription of the NFT-API. You can start a 30-day free trial for the NFT-API as shown below.
  3. You need your Client ID and Client Secret which can be obtained from the Portal as shown below.
Starting a trial subscription and obtaining a Client ID and Client Secret

Starting a trial subscription and obtaining a Client ID and Client Secret

📘

All the API calls for this guide run on a sandbox environment. You can test and experiment with API calls without causing any harm to the actual blockchain or data.

There are several ways to run API calls, but for this guide, we will be using Swagger or Postman to execute the different endpoints.

1. Authenticating

In order to obtain a bearer token and authorize all API calls, you will need your Client ID and Client Secret. These credentials are necessary for authentication purposes.

📘

Click here to learn how to retrieve a bearer token and authenticate API calls.

  1. Click here to open Swagger for the NFT API
  2. Click on the Authorize button
  3. Enter your Client ID and Client Secret
  4. Click the Authorize button on the bottom

Congratulations 🎉, you have authenticated successfully, and now you can run API calls.

Please note that the base path for all NFT API endpoints is https://nft-api-sandbox.venly.io

2. Creating a Contract

Let's start by defining your first contract. This contract will represent a collection for the NFTs. We will create a contract on the Polygon (MATIC) testnet chain.

📘

As the API calls are running in a sandbox environment, the contract will be created on a testnet chain. In this example.

Request Endpoint: reference

 POST /api/minter/contracts

Request Body:

ParameterDescriptionTypeRequired
nameThe name of your NFT collection/contractString✅
descriptionThe description of your NFT collection/contractString✅
imageThe image URL for your NFT collection/contract that will be displayedString✅
chainThis is the blockchain on which you want to create the contract onString✅
externalUrlThis can be any link such as a link to your website, landing page, etc.String✅
{
  "name": "My first collection",
  "description": "Sample description",
  "image": "https://pbs.twimg.com/profile_images/1669300450649157635/4xg-wsbK_400x400.jpg",
  "chain": "MATIC",
  "externalUrl": "www.venly.io"
}

Response Body:

📘

Save the id from the response body. This is the contract ID.

{
  "name": "My first collection",
  "description": "Sample description",
  "confirmed": false,
  "id": 53492,
  "secretType": "MATIC",
  "symbol": "MYFICO",
  "externalUrl": "www.venly.io",
  "image": "https://pbs.twimg.com/profile_images/1669300450649157635/4xg-wsbK_400x400.jpg",
  "media": [],
  "transactionHash": "0x5baa0794fc31584b04514b8d40d9e016594d335eb5dae2555ad3ca68cf620e18",
  "storage": {
    "type": "cloud",
    "location": "https://metadata-staging.arkane.network/metadata/contracts/53492"
  },
  "external_link": "www.venly.io"
}

3. Creating Token-type

Next, we will create a token-type which serves as a template for minting NFTs. This means you just have to define the NFT template once with parameters like its name, image, attributes, etc, and then you can mint multiple NFTs directly to your end-users wallets.

Defining token types helps structure the information such as attributes and animationUrls.

Request Endpoint: reference

 POST /api/minter/contracts/{contractId}/token-types

Request Body:

ParameterParam TypeDescriptionTypeRequired
{contractId}PathThis is the contract ID, which can be found in the response body of the create contract endpoint.String✅
nameBodyThe name of the token-typeString✅
descriptionBodyThe description of the token-typeString✅
imageBodyThe image URL for the token-type that will be displayedString✅
{
    "name": "My first NFT",
    "description": "Venly",
    "image": "https://storage-qa.venly.io/applications/1f64ded9-2a05-4824-b682-661023359357/StickFigureHi.png"
}

Response Body:

📘

Save the id from the response body. This is the token type ID.

{
  "id": 1,
  "confirmed": false,
  "name": "My first NFT",
  "description": "Venly",
  "fungible": false,
  "burnable": false,
  "image": "https://storage-qa.venly.io/applications/1f64ded9-2a05-4824-b682-661023359357/StickFigureHi.png",
  "imageThumbnail": "https://storage-qa.venly.io/applications/1f64ded9-2a05-4824-b682-661023359357/StickFigureHi.png",
  "imagePreview": "https://storage-qa.venly.io/applications/1f64ded9-2a05-4824-b682-661023359357/StickFigureHi.png",
  "currentSupply": 0,
  "animationUrls": [],
  "attributes": [],
  "transactionHash": "0x60bc12e2a99bb18b05b62099f395b41f25f33136a04ff4cb811a92ebce59c366",
  "storage": {
    "type": "cloud",
    "location": "https://metadata-staging.arkane.network/metadata/contracts/53492/tokens/{id}"
  }
}

4. Minting an NFT

Request Endpoint: reference

 POST /api/minter/contracts/{contractId}/types/{typeId}/tokens

Request Body:

ParameterParam TypeDescriptionTypeRequired
{contractId}PathThis is the contract ID, which can be found in the response body of the create contract endpoint.String✅
{typeId}PathThis is the token type ID, which can be found in the response body of the create token-type endpoint.String✅
destinationsBodyThis object includes details of the wallet address and amount of NFTs to be mintedArray of Objects✅
addressBodyThe wallet address where you want to mint and send the NFTString✅
amountBodyThe number of NFTs you want to mintString✅

📘

Make sure the destinations.address (wallet address) has the same chain as the contract. In this case, it should be a Polygon wallet(MATIC).

{
  "destinations": [
    {
      "address": "0xe396E30554F97088FA6f9297339c3bDc575ba306",
      "amount": 1
    }
  ]
}

Response Body:

[
  {
    "transactionHash": "0xeb02408b363e029eabf51de8458c7f09e2a691f6da6df25af6df2d6b0515b9d0",
    "metadata": {
      "name": "My first NFT",
      "description": "Venly",
      "image": "https://storage-qa.venly.io/applications/1f64ded9-2a05-4824-b682-661023359357/StickFigureHi.png",
      "imagePreview": "https://storage-qa.venly.io/applications/1f64ded9-2a05-4824-b682-661023359357/StickFigureHi.png",
      "imageThumbnail": "https://storage-qa.venly.io/applications/1f64ded9-2a05-4824-b682-661023359357/StickFigureHi.png",
      "backgroundColor": "#ADD8E6",
      "background_color": "#ADD8E6",
      "externalUrl": "www.venly.io",
      "external_url": "www.venly.io",
      "animationUrls": [],
      "attributes": [
        {
          "type": "property",
          "name": "Charisma",
          "value": "9",
          "maxValue": "10",
          "traitType": "Charisma",
          "trait_type": "Charisma"
        },
        {
          "type": "system",
          "name": "tokenTypeId",
          "value": "8",
          "traitType": "Token Type ID",
          "trait_type": "Token Type ID"
        },
        {
          "type": "property",
          "name": "maxSupply",
          "value": "10",
          "traitType": "Max Supply",
          "trait_type": "Max Supply"
        }
      ],
      "contract": {
        "address": "0x5377f7af963ae7edec6a3fa2b349ef60fa3a28d8",
        "name": "My first collection",
        "symbol": "VENZ",
        "image": "https://pbs.twimg.com/profile_images/1669300450649157635/4xg-wsbK_400x400.jpg",
        "imageUrl": "https://pbs.twimg.com/profile_images/1669300450649157635/4xg-wsbK_400x400.jpg",
        "image_url": "https://pbs.twimg.com/profile_images/1669300450649157635/4xg-wsbK_400x400.jpg",
        "description": "Sample description",
        "externalLink": "www.venly.io",
        "external_link": "www.venly.io",
        "externalUrl": "www.venly.io",
        "external_url": "www.venly.io",
        "media": [],
        "type": "ERC_1155"
      },
      "fungible": false
    },
    "destinations": [
      "0x7312750DF4d2057b758a61C7017729c6Ec9bB3E9"
    ],
    "tokenIds": [
      9
    ],
    "mintedTokens": [
      {
        "destination": "0x7312750DF4d2057b758a61C7017729c6Ec9bB3E9",
        "tokenId": 9,
        "txHash": "0xeb02408b363e029eabf51de8458c7f09e2a691f6da6df25af6df2d6b0515b9d0"
      }
    ]
  }
]

Minted NFT Preview

Minted NFT Preview on Venly Market

Minted NFT Preview on Venly Market