> ## Documentation Index
> Fetch the complete documentation index at: https://auth0-actions-transaction-metadata.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Metadata

> Set an existing key with a different value to update metadata.

Set an existing key with a different value to update metadata.

**Action 1**

Set transaction metadata key/value pair as `custom_tx_id` and `xyz123`.

```javascript lines theme={null}
exports.onExecutePostLogin = async (event, api) => {
  api.transaction.setMetadata('custom_tx_id', 'xyz123');
};
```

**Action 2**

Log the key as `custom_tx_id` and the value as `xyz123`. Then, set `custom_tx_id` to `abc456` to log again with the latest value for `custom_tx_id` in the transaction metadata.

```javascript lines theme={null}
exports.onExecutePostLogin = async (event, api) => {
  console.log('custom_tx_id', event.transaction?.metadata?.custom_tx_id);
  /* Outputs "custom_tx_id xyz123" */

  api.transaction.setMetadata('custom_tx_id', 'abc456');

  console.log('custom_tx_id', event.transaction?.metadata?.custom_tx_id);
  /* Outputs "custom_tx_id abc456" */
};
```

**Action 3**

Log the `abc456` value for `custom_tx_id`.

```javascript lines theme={null}
exports.onExecutePostLogin = async (event, api) => {
  console.log('custom_tx_id', event.transaction?.metadata?.custom_tx_id);
  /* Outputs "custom_tx_id abc456" */
};
```
