Nft

Create an NFT with pinned file and metadata

The metadata JSON file will look like this:

{
    "name": "My Awesome NFT",
    "description": "This is an NFT that represents my creativity as a digital artist!",
    "properties": [
        {
            "trait_type": "Color",
            "value": "Red"
        },
        {
            "trait_type": "Rarity",
            "value": "Medium"
        }
    ]
}
POSThttps://api.w3ipfs.storage/api/nft/

Query

cid asset cid

Headers

pinning_api_key* PINNING-API-KEY
pinning_secret_key* PINNING-SECRET-KEY

Body

file* Read stream representing the file
metadata Optional stringified object

Response

201: Created
{
    "data": {
        "id": "string",
        "asset_cid": "string",
        "metadata_cid": "string",
        "asset_pin_id": "string",
        "metadata_pin_id": "string",
        "size": number,
        "user_id": "string",
        "created_at": "2023-01-01T11:11:11.111111Z",
        "updated_at": "2023-11-11T11:11:11.111111Z",
        "pinned": true,
        "metadata_asset": {
            "name": "string",
            "type": "string"
        },
        "status": "string"
    },
    "status": "success"
}
curl --location --request POST 'https://api.w3ipfs.storage/api/nft/' \
--header 'pinning_api_key: KEY' \
--header 'pinning_secret_key: SECRET' \
--form 'metadata=@"/sample.json"' \
--form 'file=@"/test.png"'

Retrieve an nft by its ID

GEThttps://api.w3ipfs.storage/api/nft/:nftId

Parameters

nftId* nftId

Headers

pinning_api_key* PINNING-API-KEY
pinning_secret_key* PINNING-SECRET-KEY

Response

200: OK
{
    "data": {
        "id": "string",
        "asset_cid": "string",
        "metadata_cid": "string",
        "asset_pin_id": "string",
        "metadata_pin_id": "string",
        "size": number,
        "user_id": "string",
        "created_at": "2023-01-01T11:11:11.111111Z",
        "updated_at": "2023-11-11T11:11:11.111111Z",
        "pinned": true,
        "metadata_asset": {
            "name": "string",
            "type": "string"
        },
        "status": "string"
    },
    "status": "success"
}
curl --location --request GET 'https://api.w3ipfs.storage/api/nft/f0cda369-2846-414d-8e8d-8c0394113bef' \
--header 'pinning_api_key: KEY' \
--header 'pinning_secret_key: SECRET'

Retrieve nfts associated with a user ID

GEThttps://api.w3ipfs.storage/api/nft/nfts/

Query

offset (default 0)
limit (default 10)
pinned Filter by pinned status (options: all, true, false) (default all)
sortBy Field to sort by (options: created_at, size, name). Defaults to created_at
sortOrder Sort direction (options: ASC, DESC). Defaults to DESC

Headers

pinning_api_key* PINNING-API-KEY
pinning_secret_key* PINNING-SECRET-KEY

Response

200: OK
{
    "data": {
        "totals": {
            "files": number,
            "size": number
        },
        "nfts": [
            {
                "id": "string",
                "asset_cid": "string",
                "metadata_cid": "string",
                "asset_pin_id": "string",
                "metadata_pin_id": "string",
                "size": number,
                "user_id": "string",
                "created_at": "2023-01-01T11:11:11.111111Z",
                "updated_at": "2023-11-11T11:11:11.111111Z",
                "pinned": true,
                "metadata_asset": {},
                "status": "string"
            }
        ]
    },
    "status": "success"
}
curl --location --request GET 'https://api.w3ipfs.storage/api/nft/nfts/?offset=0&limit=10&pinned=true&sortBy=name&sortOrder=ASC' \
--header 'pinning_api_key: KEY' \
--header 'pinning_secret_key: SECRET'