NFT Subscription
NFT Subscription
NFT Subcrpition is to get the notification of NFT minting, NFT trading, NFT buying, NFT selling and NFT burning.
Subscription Objects:
Account, Token, Collection, Event.
Format of Webhook Message:
Tokenview will post the transaction info to your webhook URL with JSON format. The response code must be 200, as well as the the response body must return non-empty text information, such as "ok". If Tokenview fails to post the info to your webhook successfully, it will automatically retry 3 times.
Notification information will push with json as follow
{
"address": "0x61817a240633211eda35ead95222b1cfab0ff143", // address being tracked
"amount": "1", // NFT balance changes amount
"height": "16118078", // block height of the transaction
"network": "ETH", // network
"nftid": "5", // NFT id
"time": "1670236955", // transaction time UTC
"tokenAddress": "0x5c891d76584b46bc7f1e700169a76569bb77d2db", // token address
"txType": "Receive", // transaction type
"txid": "0x0e171fd0d64733f42f7eec5d20f89eebb818d0bdd93703eb4946c2095ecba356", // transactionhash
"type": "rc1155" // token address type
}
Steps of Subscription:
- Set the webhook url;
- Add subscription objects;
- Receive Webhook Message.
Webhook signature & security
To make your webhooks secure, you can verify that they originated from Tokenview by generating a HMAC SHA-256 hash code using your unique webhook signing key.
Find your signing key
Navigate to the setting page in your dashboard. Next, Click "Get": the Signing key is displayed and can be copied for use.
Validate the signature received
Every outbound request contains a hashed authentication signature in the header. It's computed by concatenating your signing key and request body. Then generates a hash using the HMAC SHA256 hash algorithm.
To verify the signature came from Tokenview, you generate the HMAC SHA256 hash and compare it with the signature received.
Example request header
Content-Type: application/json;charset=UTF-8
X-Tokenview-Signature: your-hashed-signature
Example signature validation (python)
import hmac
import hashlib
# abcde is the content to be encrypted, which is the body of the webhook message
data=bytes('abcde','utf-8')
key=bytes('signkey string','utf-8')
# digest is signature, which is the value of X-Tokenview-Signature
digest=hmac.new(key,data,digestmod=hashlib.sha256).hexdigest()
print(digest)
Set webhook URL
POST
https://services.tokenview.io/vipapi/nftmonitor/setwebhookurl?apikey={apikey}
Parameters
- {apikey}: Get your activated apikey from the API system: https://services.tokenview.io
Request
curl --location -g 'https://services.tokenview.io/vipapi/nftmonitor/setwebhookurl?apikey={apikey}' \
--header 'content-type: text/plain' \
--data 'https://9aa90255-9cde-453e-83a6-2916cd2c3725.mock.pstmn.io/webhook'
Response
{
"code": 1,
"msg": "success",
"data": null
}
Get webhook URL
GET
https://services.tokenview.io/vipapi/nftmonitor/getwebhookurl?apikey={apikey}
Parameters
- {apikey}: Get your activated apikey from the API system: https://services.tokenview.io
Request
curl --location https://services.tokenview.io/vipapi/nftmonitor/getwebhookurl?apikey={apikey}
Response
{
"code": 1,
"msg": "success",
"data": "https://9aa90255-9cde-453e-83a6-2916cd2c3725.mock.pstmn.io/webhook"
}
Add Address
GET
https://services.tokenview.io/vipapi/nftmonitor/address/add/{lowercase-coin-abbr}/{address}?apikey={apikey}
Parameters
- {lowercase-coin-abbr}:eth
- {address}: address hash
- {apikey}: Get your activated apikey from the API system: https://services.tokenview.io
Request
curl --location https://services.tokenview.io/vipapi/nftmonitor/address/add/eth/0x21c0afc5d6110323f04b369788e78fb60bfa02b8?apikey={apikey}
Response
{
"code": 1,
"msg": "success",
"data": null
}
Delete Address
GET
https://services.tokenview.io/vipapi/nftmonitor/address/remove/{lowercase-coin-abbr}/{address}?apikey={apikey}
Parameters
- {lowercase-coin-abbr}:eth
- {address}:address hash
- {apikey}: Please obtain your own activated APIKEY in the API service system background, URL: https://services.tokenview.io
Request
curl --location https://services.tokenview.io/vipapi/nftmonitor/address/remove/eth/0x21c0afc5d6110323f04b369788e78fb60bfa02b8?apikey={apikey}
Response
{
"code": 1,
"msg": "success",
"data": null
}
Check Tracked Address List
GET
https://services.tokenview.io/vipapi/nftmonitor/address/list/{lowercase-coin-abbr}?page={page}apikey={apikey}
Parameters
- {lowercase-coin-abbr}:eth
- {page}:page
- {apikey}: Please obtain your own activated APIKEY in the API service system background, URL: https://services.tokenview.io
Remark:
Specify the lowercase-coin-abbr and page.
Request
curl --location https://services.tokenview.io/vipapi/nftmonitor/address/list/eth?page=0&apikey={apikey}
Response
{
"code": 1,
"msg": "success",
"data": {
"page": 1,
"size": 3,
"total": 3,
"list": [
"0x5a0b54d5dc17e0aadc383d2db43b0a0d3e029c4c",
"0xab5c66752a9e8167967685f1450532fb96d5d24f",
"0xea674fdde714fd979de3edf0f56aa9716b898ec8"
]
}
}
Add Token
GET
https://services.tokenview.io/vipapi/nftmonitor/address/add/{lowercase-coin-abbr}/{Collection-TokenID}?apikey={apikey}
Parameters
- {lowercase-coin-abbr}:eth
- {Collection-TokenID}:Format on the ETH chain: CollectionAddress-TokenID.
- {apikey}: Please obtain your own activated APIKEY in the API service system background, URL: https://services.tokenview.io
Request
curl --location https://services.tokenview.io/vipapi/nftmonitor/address/add/eth/0x7fda36c8daedcc55b73e964c2831d6161ef60a75-9459?apikey={apikey}
Response
{
"code": 1,
"msg": "success",
"data": null
}
Check Tracked Tokens
GET
https://services.tokenview.io/vipapi/nftmonitor/address/list/{lowercase-coin-abbr}?page={page}&apikey={apikey}
Parameters
- {lowercase-coin-abbr}:eth
- {page}:page
- {apikey}: Please obtain your own activated APIKEY in the API service system background, URL: https://services.tokenview.io
Request
curl --location https://services.tokenview.io/vipapi/nftmonitor/address/list/eth?page=1&apikey={apikey}
Response
{
"code": 1,
"msg": "success",
"data": {
"page": 1,
"size": 2,
"total": 2,
"list": [
"0x7fda36c8daedcc55b73e964c2831d6161ef60a75-9459",
"0xebf39b3ee65a7fb265918af8f94010083d14fd37-309"
]
}
}
Delete Token
GET
https://services.tokenview.io/vipapi/nftmonitor/address/remove/{lowercase-coin-abbr}/{Collection-TokenID}?apikey={apikey}
Parameters
- {lowercase-coin-abbr}:eth
- {Collection-TokenID}: Format on the ETH chain: CollectionAddress-TokenID.
- {apikey}: Please obtain your own activated APIKEY in the API service system background, URL: https://services.tokenview.io
Remark:
Specify the lowercase-coin-abbr
Request
curl --location https://services.tokenview.io/vipapi/nftmonitor/address/remove/eth/0x7fda36c8daedcc55b73e964c2831d6161ef60a75-9459?apikey={apikey}
Response
{
"code": 1,
"msg": "success",
"data": null
}
Add Collection
GET
https://services.tokenview.io/vipapi/nftmonitor/address/add/{lowercase-coin-abbr}/{Collection}?apikey={apikey}
Parameters
- {lowercase-coin-abbr}:eth
- {Collection}:CollectionAddress
- {apikey}: Please obtain your own activated APIKEY in the API service system background, URL: https://services.tokenview.io
Request
curl --location https://services.tokenview.io/vipapi/nftmonitor/address/add/eth/0xc6dca8e9c9eb5a7eb68b04a69e63352d5d98695c?apikey={apikey}
Response
{
"code": 1,
"msg": "success",
"data": null
}
Check Tracked Collections
GET
https://services.tokenview.io/vipapi/nftmonitor/address/list/{lowercase-coin-abbr}?page={page}&apikey={apikey}
Parameters
- {lowercase-coin-abbr}:eth
- {page}:page
- {apikey}: Please obtain your own activated APIKEY in the API service system background, URL: https://services.tokenview.io
Request
curl --location https://services.tokenview.io/vipapi/nftmonitor/address/list/eth?page=1&apikey={apikey}
Response
{
"code": 1,
"msg": "success",
"data": {
"page": 1,
"size": 4,
"total": 4,
"list": [
"0x253ef258563e146f685e60219da56a6b75178e19",
"0x5878940a0fd83a9c9a0f7624f874590688c970f1",
"0xc6dca8e9c9eb5a7eb68b04a69e63352d5d98695c",
"0xf19bbc0dd171256c0c0eacf27adceab0f86b36d8"
]
}
}
Delete Collection
GET
https://services.tokenview.io/vipapi/nftmonitor/address/remove/{lowercase-coin-abbr}/{Collection}?apikey={apikey}
Parameters
- {lowercase-coin-abbr}:eth
- {Collection}:CollectionAddress
- {apikey}: Please obtain your own activated APIKEY in the API service system background, URL: https://services.tokenview.io
Remark:
Specify the lowercase-coin-abbr
Request
curl --location https://services.tokenview.io/vipapi/nftmonitor/address/remove/eth/0xc6dca8e9c9eb5a7eb68b04a69e63352d5d98695c?apikey={apikey}
Response
{
"code": 1,
"msg": "success",
"data": null
}
Webhook Historical Notification
GET
https://services.tokenview.io/vipapi/nftmonitor/webhookhistory/{lowercase-coin-abbr}?page={page}apikey={apikey}
Parameters
- {lowercase-coin-abbr}:eth
- {page}:page
- {apikey}: Please obtain your own activated APIKEY in the API service system background, URL:https://services.tokenview.io
Note:
- Specify the currency name and page number.
- Return all the historical notifications for all addresses of one kind currency.
- 100 records for per page.
Request
curl --location https://services.tokenview.io/vipapi/nftmonitor/webhookhistory/eth?page=1&apikey={apikey}
Response
{
"code": 1,
"msg": "success",
"data": {
"page": 1,
"size": 2,
"total": 2,
"list": [
{
"coin": "ETH",
"height": 16118080,
"time": 1670236979,
"txid": "0x86614fbd734f5bb06fc6bf0dfeee279ff01a7c6e0cfe2523786b4499c7f914f2",
"address": "0x61817a240633211eda35ead95222b1cfab0ff143",
"tryTimes": 0,
"url": "http://51.62.146.153:3010/nftmonitor",
"statusCode": 200,
"request": "{\"address\":\"0x61817a240633211eda35ead95222b1cfab0ff143\",\"amount\":\"1\",\"height\":\"16118080\",\"network\":\"ETH\",\"nftid\":\"5\",\"time\":\"1670236979\",\"tokenAddress\":\"0x5c891d76584b46bc7f1e700169a76569bb77d2db\",\"tokenSymbol\":\"OKXFC\",\"txType\":\"Receive\",\"txid\":\"0x86614fbd734f5bb06fc6bf0dfeee279ff01a7c6e0cfe2523786b4499c7f914f2\",\"type\":\"rc1155\"}",
"response": "ok"
},
{
"coin": "ETH",
"height": 16118078,
"time": 1670236955,
"txid": "0x0e171fd0d64733f42f7eec5d20f89eebb818d0bdd93703eb4946c2095ecba356",
"address": "0x61817a240633211eda35ead95222b1cfab0ff143",
"tryTimes": 0,
"url": "http://51.62.146.153:3010/nftmonitor",
"statusCode": 200,
"request": "{\"address\":\"0x61817a240633211eda35ead95222b1cfab0ff143\",\"amount\":\"1\",\"height\":\"16118078\",\"network\":\"ETH\",\"nftid\":\"5\",\"time\":\"1670236955\",\"tokenAddress\":\"0x5c891d76584b46bc7f1e700169a76569bb77d2db\",\"txType\":\"Receive\",\"txid\":\"0x0e171fd0d64733f42f7eec5d20f89eebb818d0bdd93703eb4946c2095ecba356\",\"type\":\"rc1155\"}",
"response": "ok"
}
]
}
}
Response Description
{
"address": "0x61817a240633211eda35ead95222b1cfab0ff143", // address being tracked
"amount": "1", // NFT balance changes amount
"height": "16118078", // block height of the transaction
"network": "ETH", // network
"nftid": "5", // NFT id
"time": "1670236955", // transaction time UTC
"tokenAddress": "0x5c891d76584b46bc7f1e700169a76569bb77d2db", // token address
"txType": "Receive", // transaction type
"txid": "0x0e171fd0d64733f42f7eec5d20f89eebb818d0bdd93703eb4946c2095ecba356", // transactionhash
"type": "rc1155" // token address type
}