Minting and File Upload

These endpoints include minting NFTs with urls, minting NFTs with file uploading, and pre-uploading files to speed up minting

Minting NFTs

Mint a new NFT with media that is stored in a url

POST https://api.rareful.io/v1/mintFromUrl

Mints a new NFT to the given wallet address/user_id, or creates a new user and mints to them. This last piece of functionality is useful if a user wants to purchase an NFT from a collection but they do not yet have a wallet they are conected to.

Headers

Name
Type
Description

API_KEY*

String

Your API Key can found on the dashboard, and will be used to authenticate all requests (Required)

Content-Type*

String

application/json (Required)

Request Body

Name
Type
Description

contract_address

string

The contract address to mint the NFT on. If none provided, your default contract will be used

recipient_public_key*

String

The wallet address to mint to. A user with this wallet address will be created if one does not already exists. One of user id and public key must be provided

name

String

The name of the NFT. This will be included in the NFT metadata on the blockchain. It defaults to ""

url*

String

A link to the image/media that will become your NFT. Must be included if s3_url and ipfs_uri are not

mint_price

Int

How much did you charge to mint this NFT, if at all?

description

String

The description of the NFT. This will be included in the NFT metadata on the blockchain. It defaults to "".

attributes

JSON

Many NFTs include an attributes JSON which describes the NFT.

A sample JSON is:

[ { "trait_type": "Base", "value": "Horse" }, { "trait_type": "Eyes", "value": "Small" }, { "trait_type": "Power", "value": 3 } ]

s3_url*

String

The s3_url returned from calling the upload route. Must be included if url is not

ipfs_uri*

String

The ipfs_uri returned from calling the upload route. Must be included if url is not

recipient_user_id*

String

The user id to mint to. A new user will be generated with this id if one does not already exist. One of user id and public key must be provided

other_metadata

JSON

Arbitrary additional parameters can be passed in as a dictionary. For example:

{"height": 42, "color": red"}

{
    "data": {
        "contract_address": "0xaA481ced0b3554b5cA23d01103A9BD17771dfFd2",
        "contract_owner_public_key": "0x582b7cb2B054A09b8Ee36f95Db285AB34EECED03",
        "token_id": 67014279,
        "token_owner_public_key": "0x4e077a6500a18663d22549D812fCd56A700f3193",
        "transaction_hash": "0x0e16dd6fd3ae885ffcfa11f3b69be98b169a78b6d580fdc8070e3819a01f436c"
    },
    "status": 200,
    "message": "NFT has been minted"
}

Batch mint a series of NFTs

POST https://api.rareful.io/v1/batchMintFromUrls

Mint a series of NFTs. Mostly the same parameters as /mintFromUrl except as arrays, and the contract address is a single parameter. Arrays must be of the same length, and a maximum of 1000 elements. Additionally, a webhook url can also be passed which will receive the entire response once the batch has been minted.

Headers

Name
Type
Description

API_KEY*

String

Your API Key can found on the dashboard, and will be used to authenticate all requests (Required)

Content-Type*

String

application/json (Required)

Request Body

Name
Type
Description

contract_address

string

The contract address to mint the NFTs on. If none provided, your default contract will be used

recipient_public_keys*

[String]

An array of wallet addresses to mint to. For each address in the array, a user with the wallet address will be created if one does not already exist. Either recipient_public_keys or recipient_user_ids must be passed

names

[String]

An array of the names of the NFTs. This will be included in the NFT metadata on the blockchain. It defaults to an array of empty strings.

urls*

[String]

An array of links to the image/media that will become the NFT. Must be included if s3_urls and ipfs_uris are not

mint_prices

[Int]

An array of prices for how much you charged to mint each NFT, if at all.

descriptions

[String]

An array of descriptions of the NFTs. This will be included in the NFT metadata on the blockchain. It defaults to an array of empty strings

attributes

[JSON]

An array of attributes in JSON which describes the NFTs.

A sample JSON is:

[ { "trait_type": "Base", "value": "Horse" }, { "trait_type": "Eyes", "value": "Small" }, { "trait_type": "Power", "value": 3 } ]

s3_urls*

[String]

An array of s3_urls returned from calling the upload route. Must be included if urls are not

ipfs_uris*

[String]

An array of ipfs_uris returned from calling the upload route. Must be included if urls are not

recipient_user_ids*

[String]

An array of user ids to mint to. For each user id, a new user will be generated with the id if one does not already exist. Either Recipient_public_keys or recipient_user_ids must be passed

other_metadatas

[JSON]

Arbitrary additional parameters can be passed in as an array of dictionaries. For example:

[{"height": 42, "color": red"}, {"height": 35, "color": blue"}, ...]

webhook_url

String

A url which will receive all the mint data once the batch has been finished minting. Should take a post request with a json body, and no authorization (you can generate unique webhook links and use that to ensure security). Expects a transaction_hash string, contract_address string, an array of token id integers, an array of wallet address strings.

{
    "data": {
        "contract_address": "0xaA481ced0b3554b5cA23d01103A9BD17771dfFd2",
        "contract_owner_public_key": "0x582b7cb2B054A09b8Ee36f95Db285AB34EECED03",
        "token_ids": [1, 2, 3, ...],
        "token_owner_public_keys": ["0x4e077a6500a18663d22549D812fCd56A700f3193","0x4e077a6500a18663d22549D812fCd56A700f3193", "0x4e077a6500a18663d22549D812fCd56A700f3193", ...]
    },
    "status": 200,
    "message": "NFT mints are in progress"
}

Mint a new NFT by uploading a file

POST https://api.rareful.io/v1/mintFromFile

Mints a new NFT to the given wallet address

Headers

Name
Type
Description

API_KEY*

String

Your API Key can found on the dashboard, and will be used to authenticate all requests (Required)

Content-Type*

String

multipart/form-data (Required)

Request Body

Name
Type
Description

file*

file

The file that will be uploaded to represent the NFT. Max size is 64mb, and accepted formats are png, jpg, jpeg, and gif. (Required)

metadata

object

This is a json object that matches the fields from the mintFromUrl route (except without the urls). Here is an example:

{

"recipient_user_id": "User1",

"name": "My New NFT",

"description": "This is a brand new NFT"

}

{
    "data": {
        "contract_address": "0xaA481ced0b3554b5cA23d01103A9BD17771dfFd2",
        "contract_owner_public_key": "0x582b7cb2B054A09b8Ee36f95Db285AB34EECED03",
        "token_id": 67014279,
        "token_owner_public_key": "0x4e077a6500a18663d22549D812fCd56A700f3193",
        "transaction_hash": "0x0e16dd6fd3ae885ffcfa11f3b69be98b169a78b6d580fdc8070e3819a01f436c"
    },
    "status": 200,
    "message": "NFT has been minted"
}

Minting from s3_url and ipfs_uri (in mintFromUrl) is quicker for large files (since files have been pre-uploaded). A potential flow would be to use the uploadFromURL or uploadFromFile routes ahead of time to convert regular files to decentralized ones, and then use the mintFromUrl route for the minting.

Upload a file to a decentralized IPFS host

POST https://api.rareful.io/v1/uploadFromUrl

Uploads a hosted media file to a decentralized ipfs host and amazon s3. These two links can then be used in the mintFromUrl route to mint. It is recommended to use ipfs to mint your NFTs since then they exist independently from your server and will always be accessible.

Headers

Name
Type
Description

API_KEY*

String

Your API Key can found on the dashboard, and will be used to authenticate all requests (Required)

Content-Type*

String

application/json (Required)

Request Body

Name
Type
Description

url*

file

The file that will be uploaded to IPFS as a url. Accepted formats are png, jpg, jpeg, and gif. (Required)

{
    "data": {
        "cid": "QmeDVja9RxZjddjAh2LNvWUUFJ8SGCrRVewpeyf4MB3axf",
        "ipfs_uri": "ipfs://QmeDVja9RxZjddjAh2LNvWUUFJ8SGCrRVewpeyf4MB3axf",
        "s3_url": "https://rareful-bucket.s3.us-east-2.amazonaws.com/public/QmeDVja9RxZjddjAh2LNvWUUFJ8SGCrRVewpeyf4MB3axf.jpg"
    },
    "message": "File successfully uploaded",
    "status": 200
}

Upload a file to a decentralized IPFS host

POST https://api.rareful.io/v1/uploadFromFile

Uploads a file to a decentralized ipfs host and amazon s3. These two links can then be used in the mintFromUrl route to mint. It is recommended to use ipfs to mint your NFTs since then they exist independently from your server and will always be accessible.

Headers

Name
Type
Description

API_KEY*

String

Your API Key can found on the dashboard, and will be used to authenticate all requests (Required)

Content-Type*

String

multipart/form-data (Required)

Request Body

Name
Type
Description

file*

file

The file that will be uploaded to IPFS as a url. Accepted formats are png, jpg, jpeg, and gif. (Required)

{
    "data": {
        "cid": "QmeDVja9RxZjddjAh2LNvWUUFJ8SGCrRVewpeyf4MB3axf",
        "ipfs_uri": "ipfs://QmeDVja9RxZjddjAh2LNvWUUFJ8SGCrRVewpeyf4MB3axf",
        "s3_url": "https://rareful-bucket.s3.us-east-2.amazonaws.com/public/QmeDVja9RxZjddjAh2LNvWUUFJ8SGCrRVewpeyf4MB3axf.jpg"
    },
    "message": "File successfully uploaded",
    "status": 200
}

Last updated