# setAppMetadata not working in post user signup Action or rule

**URL:** <https://community.auth0.com/t/setappmetadata-not-working-in-post-user-signup-action-or-rule/102183>\
**Category:** Get Help\
**Tags:** other, missing-category\
**Created:** [March 9, 2023, 4:44pm UTC](https://community.auth0.com/t/setappmetadata-not-working-in-post-user-signup-action-or-rule/102183 "2023-03-09T16:44:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![questsin](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/questsin/32/45080_2.png) [@questsin](https://community.auth0.com/u/questsin)\
**Post date:** [March 9, 2023, 4:44pm UTC](https://community.auth0.com/t/setappmetadata-not-working-in-post-user-signup-action-or-rule/102183/1 "2023-03-09T16:44:36Z")

</div>

```auto
exports.onExecutePostUserRegistration = async (event, api) => {
    api.user.setAppMetadata('test', 'ok');
    }

```

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [March 10, 2023, 12:01am UTC](https://community.auth0.com/t/setappmetadata-not-working-in-post-user-signup-action-or-rule/102183/3 "2023-03-10T00:01:17Z")

</div>

Hey there @questsin!

There’s no `api` object in a post user registration Action which is why you’re unable to set the app metadata - Instead you’ll want to move this code to a [pre user registration action](https://auth0.com/docs/customize/actions/flows-and-triggers/pre-user-registration-flow). A post login Action would work as well.

Hope this helps!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [March 24, 2023, 12:01am UTC](https://community.auth0.com/t/setappmetadata-not-working-in-post-user-signup-action-or-rule/102183/4 "2023-03-24T00:01:36Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
