Webhooks

How can I subscribe to notifications?

Some of the REST API operations have an asynchronous nature, for example, uploading a file to Akord's permanent storage.

The REST API gives a direct, synchronous response informing you about the file, being successfully uploaded with a payload containing a fixed transaction ID of thecorresponding Arweave blockchain transaction.

The problem with that transaction ID: it is unusable for the next few minutes, until the transaction is confirmed on the Arweave blockchain. To know when your transaction is confirmed, you can poll the REST API's status endpoint. That's one, simple solution, that could generate some network traffic.

Webhooks to the rescue! Webhooks allow your applications to receive events as they occur in your Akord accounts, so that your back-end systems can execute actions accordingly.

To enable webhook events, you need to register webhook endpoints. Registering can be done on the frontend app or directly using the REST API. After you register them, Akord will push real-time event data to your application’s webhook endpoint when events happen in your Akord account. Webhook uses HTTPS to send events to your app with a JSON payload that includes an event object.

Supported events

  • transaction.commited

Event object:

{
    "event": "transaction.commited", 
    "id": "a2a48bc6-7e9f-48c6-abc7-9e641390680b",
    "mimeType": "image/png",
    "sizeInBytes": 437432,
    "cloud": {
        "uri": "a2a48bc6-7e9f-48c6-abc7-9e641390680b",
        "url": "https://api.akord.com/files/a2a48bc6-7e9f-48c6-abc7-9e641390680b"
    },
    "tx": {
        "id": "ewR2EcQJOSAN-dH0GZVswOG_g_kjtFh_dUSrjpbd_Lo",
        "status": "committed",
        "tags": [
            {
                "name": "file-category",
                "value": "photo"
            },
            {
                "name": "file-description",
                "value": "wedding 2024"
            }
        ],
        "statusUrl": "https://api.akord.com/files/a2a48bc6-7e9f-48c6-abc7-9e641390680b/status",
        "gatewayUrls": [
            "https://akrd.net/ewR2EcQJOSAN-dH0GZVswOG_g_kjtFh_dUSrjpbd_Lo",
            "https://arweave.net/ewR2EcQJOSAN-dH0GZVswOG_g_kjtFh_dUSrjpbd_Lo"
        ],
        "viewblockUrl": "https://viewblock.io/arweave/tx/ewR2EcQJOSAN-dH0GZVswOG_g_kjtFh_dUSrjpbd_Lo",
        "info": "Transaction is visible on the blockchain indexers when in the \"committed\" status.",
        "infoUrl": "https://docs.akord.com/api-and-dev-tools/build/akord-api/files"
    }
}

By adding a webhook url, you will receive the events from single supported event type.

Future releases of the API will bring more events with subscribe filter option

Last updated