Skip to main content

Webhook Signatures

Verify the signature on an outbound webhook before acting on its contents. Files.com signs the request with the shared secret you configure for the sender. Use the same secret in the receiving application and verify X-Files-Signature-V2 for each delivery.

Configure a Signing Secret

SenderSigning secret
Folder WebhookThe Verification token in Advanced Settings. Files.com uses a cryptographically secure random generator each time it creates or regenerates a token.
Event Channel webhook targetThe signing secret configured for the target. All subscriptions using that target use the same secret.
Automation v2 Send Webhook actionA Token Secret selected as the signing key on the node.

Configure the receiving application with the matching secret when you set or rotate it. Removing a folder webhook's verification token disables signing for that webhook. Use V2 for both the standard Folder Webhook request formats and legacy EV1 and EV2 requests.

Signed Request Bytes

The X-Files-Signature-V2 header contains the HMAC-SHA256 digest as exactly 64 lowercase hexadecimal characters, with no sha256= prefix. Use the configured secret as the HMAC key and select the message bytes according to the request method.

For POST, verify the exact received body bytes before parsing them. This includes JSON, XML, URL-encoded forms, the complete multipart body including its boundaries, and file contents sent as the body.

EV1 and EV2 use their exact JSON body bytes. Do not decode binary data as text, extract only a multipart file or field, or parse and reserialize a body for verification. Changes to whitespace, key order, escaping, or boundaries change the signed bytes even when the resulting data looks the same.

For GET folder webhooks, verify the entire raw query string, excluding the leading ?. Include parameters already present in the destination URL as well as those added by Files.com. Preserve parameter order, duplicate parameters, and percent encoding; do not decode, sort, or rebuild the query.

For example, a received query of route=orders&tag=a+b&tag=a%20b&path=incoming%2Forder.csv must be verified exactly as written. Different destination URLs can produce different signatures for the same file action.

Receiver Verification Example

Require a valid V2 signature and compare it using your language's constant-time comparison function. A missing, malformed, or incorrect V2 signature must stop processing. Do not accept the request by falling back to an older signature header.

This Python example accepts a Flask request and the configured secret as a string. It uses Flask's raw query and body accessExternal LinkThis link leads to an external website and will open in a new tab and Python's constant-time comparisonExternal LinkThis link leads to an external website and will open in a new tab. Call it before reading request.json, request.form, or request.files. Configure any middleware or proxy in front of the receiver to preserve the original body and query bytes.

import hashlib
import hmac
import re


def verify_files_webhook(request, secret):
    signature = request.headers.get("X-Files-Signature-V2", "")
    if not secret or re.fullmatch(r"[0-9a-f]{64}", signature) is None:
        return False

    if request.method == "GET":
        message = request.query_string  # Raw bytes after "?".
    elif request.method == "POST":
        message = request.get_data(cache=True, as_text=False)
    else:
        return False

    expected = hmac.new(secret.encode("utf-8"), message, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, signature)

If this function returns False, reject the request without processing it. If it returns True, parse the body or query and handle the event.

A retry carries valid signed contents too. After verification, apply the receiver's repeated-delivery handling before running the business action again.

You can also restrict incoming connections to the published Files.com IP addresses, or your assigned addresses when the webhook uses dedicated IPs. This is an additional connection control; it does not replace message verification.

Migration and Deprecated Signatures

To migrate a receiver, keep its existing secret and payload format, then update it to verify the raw request bytes using X-Files-Signature-V2. Once it uses V2, require V2 on every delivery. The older headers and verification methods below are deprecated and remain available for backward compatibility. This deprecation applies to signature verification, not to the EV1 or EV2 payload formats.

The legacy signature reference covers the older headers available to existing receivers.

Legacy Signature Reference

Webhook TypeDeprecated HeaderVerification for Compatibility
Folder webhookX-Files-SignatureCalculate the lowercase hexadecimal MD5 digest of the verification token followed by the triggering file path, with no separator and without adding a leading slash. This verifies the path, not the complete message.
EV1 or EV2 folder webhookX-Exavault-SignatureCalculate the lowercase hexadecimal MD5 digest of the verification token followed by the exact raw request body, with no separator. Preserve the body bytes before JSON parsing. Legacy Format Webhooks explains this method.
Event Channel webhook target or Automation v2 Send WebhookX-Files-SignatureCalculate the lowercase hexadecimal HMAC-SHA256 digest of the exact raw JSON body, using the configured signing secret as the key. The value is identical to X-Files-Signature-V2.

For an existing receiver that still uses one of these methods, compare the calculated digest with the corresponding header using a constant-time comparison function. These methods are compatibility references, not alternatives to try when V2 verification fails.