Authentication

In order to communicate with the Webhooks API you will need to provide the token you configured on your node through the Authorization header. Authenticating with an invalid token will return 401 Unauthorized.

Headers

Name Type Description Required
Authorization string The webhook token defined in the node configuration.

List all webhooks

Endpoint

GET /api/webhooks

Query Parameters

Name Type Description Required
page int The number of the page that will be returned.
limit int The number of resources per page.

Response

{
    "meta": {
        "count": 29,
        "pageCount": 1,
        "totalCount": 29,
        "next": null,
        "previous": null,
        "self": "/api/v2/webhooks?page=1&limit=100",
        "first": "/api/v2/webhooks?page=1&limit=100",
        "last": "/api/v2/webhooks?page=1&limit=100"
    },
    "data": [
        {
            "id": 1,
            "event": "block.forged",
            "target": "https://httpbin.org/post",
            "enabled": true,
            "conditions": [
                {
                    "key": "generatorPublicKey",
                    "condition": "eq",
                    "value": "032fcfd19f0e095bf46bd3ada87e283720c405249b1be1a70bad1d5f20095a8515"
                }
            ]
        }
    ]
}

Retrieve a webhook

Endpoint

GET /api/webhooks/{id}

Path Parameters

Name Type Description Required
id string The identifier of the webhook to be retrieved.

Response

{
    "data": {
        "id": 1,
        "event": "block.forged",
        "target": "https://httpbin.org/post",
        "enabled": true,
        "conditions": [
            {
                "key": "generatorPublicKey",
                "condition": "eq",
                "value": "032fcfd19f0e095bf46bd3ada87e283720c405249b1be1a70bad1d5f20095a8515"
            }
        ]
    }
}

Create a webhook

Endpoint

POST /api/webhooks

Body Parameters

Name Type Description Required
event string The name of the event to be listened for.
target string The target url for the HTTP payload.
enabled string The value to enable or disable the webhook.
conditions array The list of conditions required to trigger the webhook.

Response

{
    "data": {
        "id": 1,
        "event": "block.forged",
        "target": "https://httpbin.org/post",
        "token": "7e66949f67b36c34a05eeb3a866957b3f1b6f8947fb215500b78e5091d4e484a",
        "enabled": true,
        "conditions": [
            {
                "key": "generatorPublicKey",
                "condition": "eq",
                "value": "032fcfd19f0e095bf46bd3ada87e283720c405249b1be1a70bad1d5f20095a8515"
            }
        ]
    }
}

Update a webhook

Endpoint

PUT /api/webhooks/{id}

Path Parameters

Name Type Description Required
id string The identifier of the webhook to be updated.

Body Parameters

Name Type Description Required
event string The name of the event to be listened for.
target string The target url for the HTTP payload.
enabled string The value to enable or disable the webhook.
conditions array The list of conditions required to trigger the webhook.

Response

{}

Delete a webhook

Endpoint

DELETE /api/webhooks/{id}

Path Parameters

Name Type Description Required
id string The identifier of the webhook to be deleted.

Response

{}
Last Updated: 11/6/2018, 12:18:34 PM