Webhook APIs
Callback Request
Parameter transmitted when making a request to the created webhook callback
Body Parameters
Parameter | Type | Description |
---|---|---|
webhook_id | int | Webhook unique id |
event | string | Type of event that occurred (confirmed,unconfirmed) |
address | string | This is the cryptocurrency address that detected the event. |
symbol | string | Asset symbol on which the event occurred |
tx_hash | string | The transaction hash where the event occurred |
api_token | string | api_token encrypted with md5 |
Create webhook
curl -X POST \
https://api.blocksdk.com/v2/hooks \
-H 'Content-Type: application/json' \
-H 'X-API-Token: my-api-token' \
-d '{
"callback_url" : "https://blocksdk.com",
"address" : "1LHkxNymfxadePvhg8pkjCqQzq1ktP2hZN",
"symbol" : "btc"
}'
$hook = $webhookClient->create([
"callback_url" => "https://blocksdk.com",
"symbol" => "btc",
"address" => "1LHkxNymfxadePvhg8pkjCqQzq1ktP2hZN"
]);
var hook = webhookClient.create({
"callback_url" : "https://blocksdk.com",
"symbol" : "btc",
"address" : "1LHkxNymfxadePvhg8pkjCqQzq1ktP2hZN"
})
hook = webhookClient.create({
"callback_url" => "https://blocksdk.com",
"symbol" => "btc",
"address" => "1LHkxNymfxadePvhg8pkjCqQzq1ktP2hZN"
})
hook = webhookClient.create({
"callback_url" : "https://blocksdk.com",
"symbol" : "btc",
"address" : "1LHkxNymfxadePvhg8pkjCqQzq1ktP2hZN"
})
hook := webhookClient.Create(map[string]interface{}{
"callback_url" : "https://blocksdk.com",
"symbol" : "btc",
"address" : "1LHkxNymfxadePvhg8pkjCqQzq1ktP2hZN"
})
Response Body
{
"payload": {
"id": 2151,
"symbol": "btc",
"address": "1LHkxNymfxadePvhg8pkjCqQzq1ktP2hZN",
"callback_url": "https://blocksdk.com"
},
"state": {
"code": 201,
"success": true
}
}
Info
Create a hook to receive blockchain event callbacks.
HTTP Request
POST https://api.blocksdk.com/v2/hooks
Body Parameters
Parameter | Type | Description |
---|---|---|
callback_url* | string | Callback URL to be called when an event occurs. |
symbol* | string | Cryptocurrency symbol. (btc,bch,ltc,dash,eth,dash) |
address* | string | This is the cryptocurrency address to detect the event. |
Response
Variable | Type | Description |
---|---|---|
id | int | Webhook unique id |
symbol | string | Cryptocurrency symbol. |
address | string | This is the cryptocurrency address to detect the event. |
callback_url | string | Callback URL to be called when an event occurs. |
Webhook list
curl -X GET ' https://api.blocksdk.com/v2/hooks' \
-H 'Content-Type: application/json' \
-H 'X-API-Token: my-api-token'
$webhooks = $webhookClient->getWebhooks([
"offset" => 0,
"limit" => 10
]);
var webhooks = webhookClient.getWebhooks({
"offset" : 0,
"limit" : 10
})
webhooks = webhookClient.getWebhooks({
"offset" => 0,
"limit" => 10
})
webhooks = webhookClient.getWebhooks({
"offset" : 0,
"limit" : 10
})
webhooks := webhookClient.GetWebhooks(map[string]interface{}{
"offset" : 0,
"limit" : 10
})
Response Body
{
"payload": [
{
"id": 2151,
"symbol": "btc",
"address": "1LHkxNymfxadePvhg8pkjCqQzq1ktP2hZN",
"callback_url": "https://blocksdk.com",
"callback_error_count": 0,
"datetime": "2021-01-12T02:31:16+00:00",
"timestamp": 1610418676
},
...
],
"state": {
"code": 200,
"success": true
}
}
Info
Get a list of all active webhooks.
HTTP Request
GET https://api.blocksdk.com/v2/hooks
Query Parameters
Parameter | Type | Default | Description |
---|---|---|---|
offset | int | 0 | Sequential index number at the beginning of the list of items for a given criterion |
limit | int | 10 | Limit number of item lists for a given criterion |
Response
Variable | Type | Description |
---|---|---|
id | int | Webhook unique id |
symbol | string | Cryptocurrency symbol |
address | string | Cryptocurrency address to detect the event. |
callback_url | string | Callback URL to be called when an event occurs. |
callback_error_count | int | The number of errors in the callback call. If the response code is answered with a code other than 200,201, it increases by 1 |
datetime | string | Webhook creation date and time. |
timestamp | int | Webhook creation date and time. |
Callback response list
curl -X GET 'https://api.blocksdk.com/v2/hooks/responses' \
-H 'Content-Type: application/json' \
-H 'X-API-Token: my-api-token'
$responses = $webhookClient->getResponses([
"offset" => 0,
"limit" => 10
]);
var responses = webhookClient.getResponses({
"offset" : 0,
"limit" : 10
})
responses = webhookClient.getResponses({
"offset" => 0,
"limit" => 10
})
responses = webhookClient.getResponses({
"offset" : 0,
"limit" : 10
})
responses := webhookClient.GetResponses(map[string]interface{}{
"offset" : 0,
"limit" : 10
})
Response Body
{
"payload": [
{
"webhook_id": 1325,
"status_code": 200,
"event": "confirmed",
"tx_hash": "0x24343ea3244e016d830a2f953ef0b18269b5c715f2dcb99e6057b83ed025f85b",
"datetime": "2020-12-16T06:41:53+00:00",
"timestamp": 1608100913
}
...
],
"state": {
"code": 200,
"success": true
}
}
Info
Get a list of webhook callback calls.
HTTP Request
GET https://api.blocksdk.com/v2/hooks/responses
Query Parameters
Parameter | Type | Default | Description |
---|---|---|---|
offset | int | 0 | Sequential index number at the beginning of the list of items for a given criterion |
limit | int | 10 | Limit number of item lists for a given criterion |
Response
Variable | Type | Description |
---|---|---|
webhook_id | int | Webhook unique id |
status_code | string | Callback response code |
event | string | Event name |
tx_hash | string | The transaction hash where the event occurred |
datetime | string | Callback call date and time |
timestamp | int | Callback call date and time |
Get webhook
curl -X GET 'https://api.blocksdk.com/v2/hooks/2151' \
-H 'Content-Type: application/json' \
-H 'X-API-Token: my-api-token'
$listWebHook = $webhookClient->get([
"hook_id" => 2151
]);
var listWebHook = webhookClient.get({
"hook_id" : 2151
})
listWebHook = webhookClient.get({
"hook_id" => 2151
})
listWebHook = webhookClient.get({
"hook_id" : 2151
})
listWebHook := webhookClient.Get(map[string]interface{}{
"hook_id" : 2151
})
Response Body
{
"payload": {
"id": 2151,
"symbol": "btc",
"address": "1LHkxNymfxadePvhg8pkjCqQzq1ktP2hZN",
"callback_url": "https://blocksdk.com",
"callback_error_count": 0,
"datetime": "2021-01-12T02:31:16+00:00",
"timestamp": 1610418676
}
,
"state": {
"code": 200,
"success": true
}
}
Info
Get information of a specific webhook.
HTTP Request
GET https://api.blocksdk.com/v2/hooks/<hook_id>
URL Parameters
Parameter | Type | Description |
---|---|---|
hook_id* | int | Webhook ID |
Query Parameters
Parameter | Type | Default | Description |
---|---|---|---|
offset | int | 0 | Sequential index number at the beginning of the list of items for a given criterion |
limit | int | 10 | Limit number of item lists for a given criterion |
Response
Variable | Type | Description |
---|---|---|
id | int | Webhook unique id |
symbol | string | Cryptocurrency symbol |
address | string | Cryptocurrency address to detect the event. |
callback_url | string | Callback URL to be called when an event occurs. |
callback_error_count | int | The number of errors in the callback call. If the response code is answered with a code other than 200,201, it increases by 1 |
datetime | string | Webhook creation date and time. |
timestamp | int | Webhook creation date and time. |
Get a list of specific webhook callbacks
curl -X GET 'https://api.blocksdk.com/v2/hooks/1325/responses' \
-H 'Content-Type: application/json' \
-H 'X-API-Token: my-api-token'
$responses = $webhookClient->getHookResponses([
"hook_id" => 1325,
"offset" => 0,
"limit" => 10
]);
var responses = webhookClient.getHookResponses({
"hook_id" : 1325,
"offset" : 0,
"limit" : 10
})
responses = webhookClient.getHookResponses({
"hook_id" => 1325,
"offset" => 0,
"limit" => 10
})
responses = webhookClient.getHookResponses({
"hook_id" : 1325,
"offset" : 0,
"limit" : 10
})
responses := webhookClient.GetHookResponses(map[string]interface{}{
"hook_id" : 1325,
"offset" : 0,
"limit" : 10
})
Response Body
{
"payload": [
{
"webhook_id": 1325,
"status_code": 200,
"event": "confirmed",
"tx_hash": "0x24343ea3244e016d830a2f953ef0b18269b5c715f2dcb99e6057b83ed025f85b",
"datetime": "2020-12-16T06:41:53+00:00",
"timestamp": 1608100913
}
...
],
"state": {
"code": 200,
"success": true
}
}
Info
Get a list of callback calls for a specific webhook.
HTTP Request
GET https://api.blocksdk.com/v2/hooks/<hook_id>/responses
URL Parameters
Parameter | Type | Description |
---|---|---|
hook_id* | int | Webhook ID |
Query Parameters
Parameter | Type | Default | Description |
---|---|---|---|
offset | int | 0 | Sequential index number at the beginning of the list of items for a given criterion |
limit | int | 10 | Limit number of item lists for a given criterion |
Response
Variable | Type | Description |
---|---|---|
webhook_id | int | Webhook unique id |
status_code | string | Callback response code |
event | string | Event name |
tx_hash | string | The transaction hash where the event occurred |
datetime | string | Callback call date and time |
timestamp | int | Callback call date and time |
Delete webhook
curl -X DELETE 'https://api.blocksdk.com/v2/hooks/2151' \
-H 'Content-Type: application/json' \
-H 'X-API-Token: my-api-token'
$hook = $webhookClient->delete([
"hook_id" => 2151
]);
var hook = webhookClient.delete({
"hook_id" : 2151
})
hook = webhookClient.delete({
"hook_id" => 2151
})
hook = webhookClient.delete({
"hook_id" : 2151
})
hook := webhookClient.Delete(map[string]interface{}{
"hook_id" : 2151
})
Response Body
{
"payload": {
"id": 2151
},
"state": {
"code": 201,
"success": true
}
}
Info
Delete the active webhook.
HTTP Request
DELETE https://api.blocksdk.com/v2/hooks/<hook_id>
URL Parameters
Parameter | Type | Description |
---|---|---|
hook_id* | int | Webhook ID |
Response
Variable | Type | Description |
---|---|---|
id | int | Webhook ID |