> For the complete documentation index, see [llms.txt](https://knowledge-base.zumrails.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://knowledge-base.zumrails.com/account-settings/hmac.md).

# HMAC

> The key used to create the HMAC is your Webhook Secret, and you verify it by running the algorithm yourself with the payload and the key to re-create the HMAC.

Your Webhook Secret can be found in the portal under your settings.

<figure><img src="/files/PmW1UQzL6sg5CejqDsyB" alt=""><figcaption></figcaption></figure>

The signature is always sent with the webhook in a header named *zumrails-signature*

You can verify the authenticity of the webhook response by using HMAC.

The HMAC verification process is as follows:

* You receive a POST request via the webhook
* Your app computes a signature based on the payload received, using your Webhook Secret
* You verify that your signature matches the zumrails-signature in the request

**Here are the steps to validate a request coming from Zum Rails**

1. Retrieve the zumrails-signature header from the webhook:

   <figure><img src="/files/ufYPmNiOH83y9DMQMB8F" alt=""><figcaption></figcaption></figure>
2. Retrieve the json body of the request. Make sure you are not adding any new spaces or formats. E.g:

   <figure><img src="/files/g7c0sNq8Xet4QdwCSx0Y" alt=""><figcaption></figcaption></figure>
3. Using HMAC SHA256 implemented in your programming language, calculate the signature on your side. The body is the payload and the secret is your Webhook Secret.

The output should be in Base64 format.

For your tests, you can use an online [HMAC generator](https://www.liavaag.org/English/SHA-Generator/HMAC/).

<figure><img src="/files/Hl15rttjKIfAtoO8NJkE" alt=""><figcaption></figcaption></figure>

4. Compare your hash with the value provided under the zumrails-signature in the request, they should match. As you can see, the Result here (hV...gys=) matches the zumrails-signature in the screenshot from step (1) above.

A few [examples](https://github.com/danharper/hmac-examples) of how to calculate HMAC in different languages
