# Webhook Timestamp Validation Requirement

## Overview

When integrating webhooks, it is mandatory to implement timestamp validation to prevent outdated data from overwriting newer updates. Due to the webhook retry mechanism, which attempts to resend requests in case of failures, there is a possibility that an older webhook event may be delivered after a more recent one.

## Potential Issue

If timestamp validation is not implemented, an earlier event may update the system with outdated information, leading to data inconsistency and potential operational issues.

## Recommended Implementation

To mitigate this risk, follow these steps when processing webhook events:

1. **Validate the timestamp**: When receiving a webhook request:
   * Compare the incoming event's timestamp with the most recent processed event timestamp for the given entity.
   * Reject or ignore the event if its timestamp is older than the last recorded update.
2. **Use an idempotency mechanism**: To further prevent duplicate processing, leverage an idempotency key or store processed event IDs to avoid handling the same event multiple times.

## Conclusion

Timestamp validation is essential for ensuring that only the latest webhook events are applied to the system. By implementing this check, you can prevent outdated data from being processed and maintain data integrity even in cases where webhook delivery is delayed or retried.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.elkyc.com/home/integration/webhooks/webhook-timestamp-validation-requirement.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
