# Is a system generated activity id suitable to use as an idempotency key?

**URL:** <https://community.temporal.io/t/is-a-system-generated-activity-id-suitable-to-use-as-an-idempotency-key/13181>\
**Category:** Community Support\
**Created:** [August 16, 2024, 4:28am UTC](https://community.temporal.io/t/is-a-system-generated-activity-id-suitable-to-use-as-an-idempotency-key/13181 "2024-08-16T04:28:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![awwx](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/awwx/32/8185_2.png) [@awwx](https://community.temporal.io/u/awwx)\
**Post date:** [August 16, 2024, 4:28am UTC](https://community.temporal.io/t/is-a-system-generated-activity-id-suitable-to-use-as-an-idempotency-key/13181/1 "2024-08-16T04:28:23Z")

</div>

Suppose I’m writing a workflow which uses an activity to call an API. The API accepts an idempotency key.

The workflow could call `randomUUID()` to generate a safe, replayable UUID.

The activity execution also has access to its own activity id. If the activity id is unique, perhaps we could save a step and use it as our idempotency key?

However, [What is a Temporal Activity? | Temporal Documentation](https://docs.temporal.io/activities#activity-id) says that a Workflow Run “may” reuse an Activity Id. The paragraph also says that the activity id “can be generated by the system, or it can be provided by the Workflow code that spawns the Activity Execution”. I was unclear here whether “a workflow run may reuse an activity id” applied to system generated activity ids, or only to activity ids provided by the workflow code.

---

<div class="post-metadata">

**Author:** ![maxim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxim/32/8_2.png) [@maxim](https://community.temporal.io/u/maxim)\
**Post date:** [August 17, 2024, 9:38pm UTC](https://community.temporal.io/t/is-a-system-generated-activity-id-suitable-to-use-as-an-idempotency-key/13181/2 "2024-08-17T21:38:17Z")

</div>

The duplicated activity IDs are possible only if they are provided by the application code.
