The core pattern: use the step ID as your idempotency key
Every step invocation has a stablestepId that stays the same across retries. Use it as the idempotency key when calling third-party APIs.
- Stable across retries:
stepIddoes not change between attempts. - Globally unique per step: Fulfills the uniqueness requirement for an idempotency key.
Best practices
- Always provide idempotency keys to external side effects that are not idempotent inside steps (payments, emails, SMS, queues).
- Prefer
stepIdas your key; it is stable across retries and unique per step. - Keep keys deterministic; avoid including timestamps or attempt counters.
- Handle 409/conflict responses gracefully; treat them as success if the prior attempt completed.
Related docs
- Learn about retries in Errors & Retrying
- API reference:
getStepMetadata