Smart Contracts and Collections

Deploy new contracts, fetch contract data, mint NFTs and search for NFT collections.

How we do it: You are the owner of every smart contract created with the Rareful API. You can find your wallet details in the profile page of the dashboard.

Working with Smart Contracts

Deploy a new smart contract

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

Creates a new smart contract.

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_name

string

The name of the contract. ie. "Bored Ape Yacht Club". (If none provided, the contract_name is "Our Web3 Collection")

contract_symbol

string

The symbol that represents the contract. ie. "BAYC". (If none provided, the contract_symbol is "OWC")

contract_type

int

(If none provided, the contract_type defaults to 1)

is_default

bool

If is_default is True, this contract becomes your default contract. This means it shows up first on your dashboard, and minting without specifying a contract address automatically mints to this default contract. (If none provided, is_default defaults to False)

description

String

The description for your contract/collection. This is not saved on the blockchain, but is useful to store if you want to describe the collection in your application.

ie. "A 10,000 item interstellar themed art collection."

(If none provided, the description defaults to "".)

cover_url

String

A link to an image that acts as the background/cover of your contract/collection. This is not saved on the blockchain, but is useful to provide if you want to visually represent the collection in your application.

profile_url

String

A link to an image that acts as the profile photo of your contract/collection. This is mostly for internal use. ie:

blockchain

String

The blockchain/network the contract will be deployed on. The options are "polygon" or "ethereum".

(If none provided, the default is "polygon")

{
    "data": {
        "contract_address": "0xaA481ced0b3554b5cA23d01103A9BD17771dfFd2",
        "owner_public_key": "0x582b7cb2B054A09b8Ee36f95Db285AB34EECED03",
        "transaction_hash": "0x61032bf9c94f2b76499ecf8bf0e26c1c27966fc1cf3deb31a92319b32c7841d4"
    },
    "status": 200,
    "message": "Contract Successfully deployed"
}

Get contracts you have deployed

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

Retrieve all the contracts you have deployed

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)

{
    "data": {
        "contracts": [
            {
                "contract_address": "0x17F4F06f59D3328b23dED316359b18e141473851",
                "contract_name": "Community Collection",
                "cover_url": "https://gateway.pinata.cloud/ipfs/QmbhQ5EftwTf8bmT5Pt9SriVQez9JfpY9XSZXfZEKucu4C",
                "creation_date": "2022-07-06T16:57:03.310Z",
                "description": "My app's community collection",
                "owner_public_key": "0x7d23Ca0FCbE3cdabBa60251f25a1B7f17E9BDcc7",
                "profile_url": "https://gateway.pinata.cloud/ipfs/QmZbbLJrH6DqRagT52x9aRtapuYjUsEw5rmzgqi6xmHreu"
            },
            {
                "contract_address": "0x5A78801521Cb0A76BEda19494a3a7c91340C5F53",
                "contract_name": "Independent Collection",
                "cover_url": "https://gateway.pinata.cloud/ipfs/QmbhQ5EftwTf8bmT5Pt9SriVQez9JfpY9XSZXfZEKucu4C",
                "creation_date": "2022-07-06T16:54:58.854Z",
                "description": "A user's collection",
                "owner_public_key": "0x7d23Ca0FCbE3cdabBa60251f25a1B7f17E9BDcc7",
                "profile_url": "https://gateway.pinata.cloud/ipfs/QmZbbLJrH6DqRagT52x9aRtapuYjUsEw5rmzgqi6xmHreu"
            }
        ]
    },
    "status": 200,
    "message": "Contracts found"
}

Fetch contract NFTs

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

Fetch NFTs in a contract and return associated metadata and image links.

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 for which you are fetching NFTs and metadata. (Required)

blockchain

String

The blockchain this contract was minted on

{
    "data": {
        "blockchain": "polygon",
        "contract_address": "0xaA481ced0b3554b5cA23d01103A9BD17771dfFd2",
        "cover_photo": "https://gateway.pinata.cloud/ipfs/QmbhQ5EftwTf8bmT5Pt9SriVQez9JfpY9XSZXfZEKucu4C",
        "description": "",
        "item_count": 4,
        "items": [
            {
                "image": "https://nftgo.mypinata.cloud/ipfs/QmXq4BBd4QTjSX8DEDN4Nj7kwmGL8fDndSrVpxukoesiyw",
                "list_price": 0,
                "metadata": "https://ipfs.io/ipfs/QmYfeFRtg4tq3upwsPw6xvrP75MYSqyv8E7wpkxNxE4EWr",
                "name": "Awesome NFT 5",
                "owner_history": [
                    "0x899825b3c2339A2A3d738a933920E7C4F0d001Ff"
                ],
                "owner_public_key": "0x899825b3c2339A2A3d738a933920E7C4F0d001Ff",
                "price_history": [
                    10
                ],
                "token_id": "45018383"
            },
            {
                "image": "https://ipfs.io/ipfs/QmcEfLMz7gyA7eKrmxBtHsfQWSXnCt5EztGbfAM9NN3Q1x",
                "list_price": 0,
                "metadata": "https://ipfs.io/ipfs/QmTPphzmuE1G6N1yNuzCFKLcVijUpBUaU4F2h96So6wPEd",
                "name": "My New NFT",
                "owner_history": [
                    "0x4e077a6500a18663d22549D812fCd56A700f3193"
                ],
                "owner_public_key": "0x4e077a6500a18663d22549D812fCd56A700f3193",
                "price_history": [
                    0
                ],
                "token_id": "67014279"
            },
            {
                "image": "https://nftgo.mypinata.cloud/ipfs/QmXq4BBd4QTjSX8DEDN4Nj7kwmGL8fDndSrVpxukoesiyw",
                "list_price": 0,
                "metadata": "https://ipfs.io/ipfs/QmVRrSZN82ZaLQahsCteJRUE3CiHgAsb6Bu1udMT7E5wUs",
                "name": "Awesome NFT",
                "owner_history": [
                    "0x899825b3c2339A2A3d738a933920E7C4F0d001Ff"
                ],
                "owner_public_key": "0x899825b3c2339A2A3d738a933920E7C4F0d001Ff",
                "price_history": [
                    10
                ],
                "token_id": "58509816"
            },
            {
                "image": "https://nftgo.mypinata.cloud/ipfs/QmXq4BBd4QTjSX8DEDN4Nj7kwmGL8fDndSrVpxukoesiyw",
                "list_price": 0,
                "metadata": "https://nftgo.mypinata.cloud/ipfs/QmVRrSZN82ZaLQahsCteJRUE3CiHgAsb6Bu1udMT7E5wUs",
                "name": "Awesome NFT",
                "owner_history": [
                    "0x899825b3c2339A2A3d738a933920E7C4F0d001Ff",
                    "0x4e077a6500a18663d22549D812fCd56A700f3193",
                    "0x899825b3c2339A2A3d738a933920E7C4F0d001Ff"
                ],
                "owner_public_key": "0x899825b3c2339A2A3d738a933920E7C4F0d001Ff",
                "price_history": [
                    0,
                    10,
                    20
                ],
                "token_id": "48265175"
            }
        ],
        "name": "Magic Bear Syndicate",
        "owner": "0x582b7cb2B054A09b8Ee36f95Db285AB34EECED03",
        "profile_photo": "https://gateway.pinata.cloud/ipfs/QmZbbLJrH6DqRagT52x9aRtapuYjUsEw5rmzgqi6xmHreu",
        "symbol": "MBS"
    },
    "status": 200,
    "message": "Contract Found"
}

Fetch contract NFTs

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

Fetch all NFTs in a contract that are currently for sale.

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 for which you are fetching NFTs and metadata.

{
    "data": {
        "blockchain": "polygon",
        "contract_address": "0xaA481ced0b3554b5cA23d01103A9BD17771dfFd2",
        "cover_photo": "https://gateway.pinata.cloud/ipfs/QmbhQ5EftwTf8bmT5Pt9SriVQez9JfpY9XSZXfZEKucu4C",
        "description": "",
        "item_count": 4,
        "items": [
            {
                "image": "https://nftgo.mypinata.cloud/ipfs/QmXq4BBd4QTjSX8DEDN4Nj7kwmGL8fDndSrVpxukoesiyw",
                "list_price": 0,
                "metadata": "https://ipfs.io/ipfs/QmYfeFRtg4tq3upwsPw6xvrP75MYSqyv8E7wpkxNxE4EWr",
                "name": "Awesome NFT 5",
                "owner_history": [
                    "0x899825b3c2339A2A3d738a933920E7C4F0d001Ff"
                ],
                "owner_public_key": "0x899825b3c2339A2A3d738a933920E7C4F0d001Ff",
                "price_history": [
                    10
                ],
                "token_id": "45018383"
            },
            {
                "image": "https://ipfs.io/ipfs/QmcEfLMz7gyA7eKrmxBtHsfQWSXnCt5EztGbfAM9NN3Q1x",
                "list_price": 0,
                "metadata": "https://ipfs.io/ipfs/QmTPphzmuE1G6N1yNuzCFKLcVijUpBUaU4F2h96So6wPEd",
                "name": "My New NFT",
                "owner_history": [
                    "0x4e077a6500a18663d22549D812fCd56A700f3193"
                ],
                "owner_public_key": "0x4e077a6500a18663d22549D812fCd56A700f3193",
                "price_history": [
                    0
                ],
                "token_id": "67014279"
            },
            {
                "image": "https://nftgo.mypinata.cloud/ipfs/QmXq4BBd4QTjSX8DEDN4Nj7kwmGL8fDndSrVpxukoesiyw",
                "list_price": 0,
                "metadata": "https://ipfs.io/ipfs/QmVRrSZN82ZaLQahsCteJRUE3CiHgAsb6Bu1udMT7E5wUs",
                "name": "Awesome NFT",
                "owner_history": [
                    "0x899825b3c2339A2A3d738a933920E7C4F0d001Ff"
                ],
                "owner_public_key": "0x899825b3c2339A2A3d738a933920E7C4F0d001Ff",
                "price_history": [
                    10
                ],
                "token_id": "58509816"
            },
            {
                "image": "https://nftgo.mypinata.cloud/ipfs/QmXq4BBd4QTjSX8DEDN4Nj7kwmGL8fDndSrVpxukoesiyw",
                "list_price": 0,
                "metadata": "https://nftgo.mypinata.cloud/ipfs/QmVRrSZN82ZaLQahsCteJRUE3CiHgAsb6Bu1udMT7E5wUs",
                "name": "Awesome NFT",
                "owner_history": [
                    "0x899825b3c2339A2A3d738a933920E7C4F0d001Ff",
                    "0x4e077a6500a18663d22549D812fCd56A700f3193",
                    "0x899825b3c2339A2A3d738a933920E7C4F0d001Ff"
                ],
                "owner_public_key": "0x899825b3c2339A2A3d738a933920E7C4F0d001Ff",
                "price_history": [
                    0,
                    10,
                    20
                ],
                "token_id": "48265175"
            }
        ],
        "name": "Magic Bear Syndicate",
        "owner": "0x582b7cb2B054A09b8Ee36f95Db285AB34EECED03",
        "profile_photo": "https://gateway.pinata.cloud/ipfs/QmZbbLJrH6DqRagT52x9aRtapuYjUsEw5rmzgqi6xmHreu",
        "symbol": "MBS"
    },
    "status": 200,
    "message": "Contract Found"
}

Last updated