API Introduction

This page describes how to use the API for your project
Note - this guide is currently under construction and uses the TESTNET API URL for all examples, once V2 is fully released, this will be updated.

Who is this for?

The API is designed to be used by competent programmers who have knowledge in the following areas:
  • API's
  • Front-end Web Development
  • Back-end Web Development
  • General programming
We are constantly striving to make the world of NFTs more accessible and since releasing our SFTP Bulk Upload and Payment Gateway, the need for this knowledge to deploy a project have been removed.
Having said this, if you are very skilled in this area or want to implement something custom, then this is the right place for you!

Why API?

The NMKR Studio API is our original flagship product, aiming to provide a technical framework for creators who wish to set up their own project. Since its release, we have continued to provide a better creator experience by releasing more ‘ready-made’ set up options.
Having said this, there is still a large community of people who want to create something more customised, if so, then this is the place.
The API essentially provides all of the functionality we offer, through a programatic interface. Everything from uploading your NFTs, to providing a unique wallet address for a customer to send their minting fee can be done via the API.
If you are looking to do something more advanced or simply prefer using code rather than a user interface, the API might be the right solution for you. For the most advanced and skilled programmers, it may be enough to simply link you to the Swagger API Documentation. In there you can see all of the available API calls (with Schemas) and run some tests before you implement them into your preferred programming language.
If however, you are not looking for anything overly complex, then please consider using our step-by-step guide to get your project ready.
Otherwise, this guide will provide information in-between the two, both technically precise but with an explanation.
We will also be showing examples using Python, which you can then convert as needed to a language of your choosing.

Initial Overview

The API works similarly to other API’s, whereby you are able to utilise the HTTP Get and Post Requests to invoke our Server-Side code to run methods.
To get started, you will first need to set up your API Key - which will be used to authenticate the actions you want to take and make sure you are only able to interact with projects that you own.
You can run API calls from your computer using most popular languages but if you plan to allow users on your website to invoke them, you must ensure you set up your website using server frontend/backend principles. The reason for this is that most browsers will simply block any attempt to make an API call from the front-end UI (CORS Policy Error). See our list of best practises here for more details.

Method Structure

The majority of requests will use some (or all of) the following elements:
  • Base URI, Comprised of:
    • Web Address
    • API Version
    • The Method Name
    • Project UID
    • NFT UID
    • NFT Count
    • JSON Payload
    • Requestor IP address
    • Other Specific Method Data
  • API Key as a BEARER TOKEN in the Request Header
Note - the Project and NFT UID's are now both random strings that cannot be predicted, this extra security feature means that attackers cannot 'guess' the ID, making certain attacks more difficult even if the API Key is compromised.

Example (Python)

Note - this guide uses the TESTNET URI's
Lets take a look at a simple API call ‘Get Counts’ as an overview:
The GetCounts Method, in the Swagger Documentation
We can see the structure of this call is a subset of the options mentioned above, namely:
  • Base URI, Comprised of:
    • Web Address
    • API Version
    • The Method Name
    • Project UID
  • API Key as a BEARER TOKEN in the Request Header
To run this method using Python, we first need to import the requests library:
import requests
The following code will then run the API Call and Print out the response:
import requests
def TESTNETgetCounts():
baseApiCall = 'https://api-testnet.nmkr.io/v2/GetCounts/aaaaaaa-bbbb-cccc-dddd-eeeeeeeeee/'
uploadPost = requests.get(baseApiCall,headers={"Authorization": "Bearer xxxxxxxxxxxxxxxxxxxxxxx"})
Where Project UID = aaaaaaa-bbbb-cccc-dddd-eeeeeeeeee And your API Key = xxxxxxxxxxxxxxxxxxxxxxx
See above how Python’s Request library allows us to easily add Headers in the method call by adding the ‘headers’ parameter.
Note how the URI is constructed and that we are using the 'request.get' method, as this method as we are not sending a payload, only asking for data. If we were sending data, we would use '.post'
Also see how we put the API KEY as the value for the “Authorisation” attribute with “Bearer” + “ “ + API KEY.
This particular method returns a JSON Object as follows:
You can then parse this JSON and extra the information you need as required.

Example (Curl)

Here is the same method shown running the as a “curl” command:
curl -X 'GET' \
'https://api-testnet.nmkr.io/v2/GetCounts/aaaaaaa-bbbb-cccc-dddd-eeeeeeeeee' \
-H 'accept: text/plain' \
-H 'Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxx'

Guide List

We have also provided some additional detail on the most commonly used API queries, which can be found in the additional guides:

V1 (Pre-April-2022)

Note - the V1 implementation is now deprecated. All implementations should use the methods outlined above in this guide as this code will soon become no longer supported.