Articles on: Sayl for Web3

NFT API calls

Base URL for API calls

Be sure to use the correct base API.

When you are testing in our sandbox environment: https://dev-public-api.sayl.cloud/

When you are working in the live environment: https://public-api.sayl.cloud/

Mixing the two URLs will obviously lead to unexpected results.


Authorization

Make sure you created in the Sayl admin an API key (see settings, API).
Add in the API call headers the key "Authorization" and as value "Bearer " followed with the API key. There should be a space between Bearer and the key.

All calls are Accept application/json and Content-Type application/json.

Retrieve all defined NFTs in your account:

https://dev-public-api.sayl.cloud/web3/nfts

Based on those results, you will find the ID for each NFT. This helps you to go to the second step:

Example of retrieving a specific NFT

https://dev-public-api.sayl.cloud/web3/nft/650b0e245c7e2c1e94070224

where the ID 650b0e245c7e2c1e94070224 will need to be replaced with any ID that was in the response of the /nfts call.

Mint a NFT for the retreived NFT

Do a POST call to https://dev-public-api.sayl.cloud/web3/nft/mint

where the body contains the unique reference of the NFT.
{
"reference": "cappilary-first-nft",
"quantity": 1
}

The answer should be a 200 HTTP status. Any other status is not right.

Note that creating NFTs and minting NFTs take some time, as these are actions on the blockchain. Please go in the admin, in the detail of the NFT and then in the tab "tokens" to refresh the tokens list. It should show extra tokens based on the number of NFTs you minted.

Updated on: 22/09/2023