Tangocrypto
Search
⌃K

NFT webhooks

This section requires you to be familiarized with how the webhooks work. To learn how to create webhooks and the fields in the event payload go to Using Webhooks

Create an NFT webhook

To create an NFT webhook just make a POST to the webhook API with the following parameters:
  • type: nft_api
  • name: Webhook name
  • network: mainnet | testnet
  • description: Webhook description
  • callback_url: The URL where your server is listening. We send a POST to this URL with the webhook event.
Webhook creation reques/response example:
NFT Webhook request
NFT Webhook response
Trigger the webhook when the sale is completed
curl --location --request POST 'https://cardano-testnet.tangocrypto.com/<app-id>/v1/webhooks' \
--header 'content-type: application/json' \
--header 'x-api-key: <x-api-key>' \
--data-raw '{
"type": "nft_api",
"name": "NFT Webhook",
"network": "testnet",
"description": "Triggers when a sale is competed and the NFT is in the buyer's wallet",
"callback_url": "https://webhook.site/90edfa13-4d03-4252-8d51-176cdd259554"
}'
{
"name": "webhook-nft",
"network": "testnet",
"description": "NFT Webhook",
"callback_url": "https://webhook.site/25f33bc2-b947-4304-ab02-0998e6d77d0e",
"rules": [],
"create_date": "2022-07-04T19:23:02.381Z",
"update_date": "2022-07-04T19:23:02.381Z",
"available": "true",
"confirmations": 0,
"id": "52f6a4aa2d46412f97672068e71d2c73",
"type": "nft_api"
}

Events

There are two events triggered during the sale process, the MINTING event and the COMPLETED event:
NFT Webhooks
MINTING Event
The MINTING event contains data about the tokens being minted on the blockchain. Here you can identify the token by the assetname and verify they were actually minted by pasting the tx_id on any block explorer.
{
"id": "b8891253-a934-404b-a2d1-f63f4c829c1f",
"data": {
"status": "MINTING",
"tokens": [
{
"image": "ipfs://QmP8CpUvrsRkP4KvuUdPhoMcfTnCDKiH6CpW9Nq22ZVRmL",
"tx_id": "91ace45dde767299ac16b7bba647d7865d9c6f0343ede77a87823ecb72fbb668",
"asset_name": "FACE#17"
},
{
"image": "ipfs://QmTiMrLrMor8DjUsA4ZyCS54qH81X4h4psFCpi7tBTj9yW",
"tx_id": "91ace45dde767299ac16b7bba647d7865d9c6f0343ede77a87823ecb72fbb668",
"asset_name": "FACE#20"
}
],
"sale_id": "01g7ajat3qc6hdbh0q0pa8s9nw",
"account_id": "ce0c3a8918284beab267c433d966385a",
"collection_id": "01g769vse0awscejghcx1p4f9e"
},
"type": "nft",
"object": "event",
"webhook_id": "52f6a4aa2d46412f97672068e71d2c73",
"api_version": "1.0",
"create_date": 1657138507383,
"idempotency_key": "2c9ee105-9ae0-4daf-ac2c-695dd0e0fee252f6a4aa2d46412f97672068e71d2c73",
"network": "testnet"
}
COMPLETED event
The COMPLETED event contains the same data as the MINTING event.
{
"id": "42fb9e92-ae5a-4cf3-bee1-b2848d65e4de",
"data": {
"status": "COMPLETED",
"tokens": [
{
"image": "ipfs://QmP8CpUvrsRkP4KvuUdPhoMcfTnCDKiH6CpW9Nq22ZVRmL",
"tx_id": "91ace45dde767299ac16b7bba647d7865d9c6f0343ede77a87823ecb72fbb668",
"asset_name": "FACE#17"
},
{
"image": "ipfs://QmTiMrLrMor8DjUsA4ZyCS54qH81X4h4psFCpi7tBTj9yW",
"tx_id": "91ace45dde767299ac16b7bba647d7865d9c6f0343ede77a87823ecb72fbb668",
"asset_name": "FACE#20"
}
],
"sale_id": "01g7ajat3qc6hdbh0q0pa8s9nw",
"account_id": "ce0c3a8918284beab267c433d966385a",
"collection_id": "01g769vse0awscejghcx1p4f9e"
},
"type": "nft",
"object": "event",
"webhook_id": "52f6a4aa2d46412f97672068e71d2c73",
"api_version": "1.0",
"create_date": 1657138569064,
"idempotency_key": "6064306e-78e1-453a-8f2e-34e082269bc152f6a4aa2d46412f97672068e71d2c73",
"network": "testnet"
}

Errors

There can be errors in the process and we also send events for when something wrong happened, it the error message and the sale_id, with that you can use the API to obtain more info about the error.
There are several error webhooks in correspondence with the Token sale flow
  • RESERVED_FAILED
  • PROCESSING_FAILED
  • UNRESOLVED_SUBMITTING_FAILED
  • UNRESOLVED_MINTING_MISSING
  • UNRESOLVED_OVERPAID
  • UNRESOLVED_UNDERPAID
Here you have an example of the RESERVED_EVENT failed
{
"id": "a49ff8c4-94e8-4db5-87d1-fd718f2ad1c8",
"data": {
"error": [{
"name": "OutsideOfValidityIntervalError",
"message": {
"interval": {
"invalidBefore": 0,
"invalidHereafter": 1
},
"currentSlot": 62677113
}
}],
"status": "RESERVED_FAILED",
"tokens": [{
"image": "ipfs://QmZ497C2sd8nLBqAvD8jd1dDh2snPuzaSYRKQQAV8iJCXR",
"tx_id": "8c5a9929a2829b649deef6c9212073af926d7eb1e08cae60df04bbde01cd2f5e",
"asset_name": "FACE#0007"
}],
"sale_id": "01g77tgdwta2sxc07zndpq2xfw",
"account_id": "8120536a5efc478b92809f8f1987a76e",
"collection_id": "01g6s9wsjb3mrzgtfsy8btwy3f"
},
"type": "nft",
"object": "event",
"webhook_id": "4499e247084d473ea189f58633f8eed0",
"api_version": "1.0",
"create_date": 1657046364880,
"idempotency_key": "42de6d72-9d38-447e-8e08-5c601b0ffd454499e247084d473ea189f58633f8eed0",
"network": "testnet"
}