Safe retries and rate limits
Make event delivery retry-safe and respect credential rate limits.
Use a stable idempotency key for one real-world occurrence. The same key and
body replay the original response for 24 hours; the same key with another body
returns 409 Conflict. Keys are scoped to the API key that sent them.
const result = await client.events.create(
{ channelName: 'deployments', title: 'Production deployed' },
{ idempotencyKey: 'deploy-01JABC' },
);
console.log(result.wasReplayed);
Each API key can make up to 100 requests in a 60-second window, which starts
again 60 seconds after the key’s last accepted request. The SDK exposes the
response’s rate-limit values on result.rateLimit and remembers the last
values it saw on client.rateLimit.