# How add customId to token

**URL:** <https://community.auth0.com/t/how-add-customid-to-token/75409>\
**Category:** Get Help\
**Created:** [December 23, 2021, 3:31pm UTC](https://community.auth0.com/t/how-add-customid-to-token/75409 "2021-12-23T15:31:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![amek-96](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/amek-96/32/33994_2.png) [@amek-96](https://community.auth0.com/u/amek-96)\
**Post date:** [December 23, 2021, 3:31pm UTC](https://community.auth0.com/t/how-add-customid-to-token/75409/1 "2021-12-23T15:31:01Z")

</div>

Hello, Its possible to add UserId to token? I want to send data to API but I don’t want send userId in body. On every rest token should be regenareted with new UserId. I read about hooks and rules, but I think it wont work in this case

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [December 23, 2021, 4:32pm UTC](https://community.auth0.com/t/how-add-customid-to-token/75409/3 "2021-12-23T16:32:01Z")

</div>

Hi @amek-96,

Welcome to the Auth0 Community!

You can find the user ID created by Auth0 in the token as the `sub` claim. For example:

```plaintext
{
  "iss": "http://YOUR_DOMAIN/",
  "sub": "auth0|123456", //This is the user's ID
  "aud": "YOUR_CLIENT_ID",
  "exp": 1311281970,
  "iat": 1311280970,
  "name": "Jane Doe",
  "given_name": "Jane",
  "family_name": "Doe",
  "gender": "female",
  "birthdate": "0000-10-31",
  "email": "janedoe@example.com",
  "picture": "http://example.com/janedoe/me.jpg"
}

```

Otherwise, you can add any claim you would like to the token by using custom claims in an action. Here is an example where the action adds a role to the token. You can easily swap this for an ID:

> **[Login Flow](https://auth0.com/docs/customize/actions/flows-and-triggers/login-flow)**
>
> Learn about the Actions Login Flow and the post-login Action trigger, which is executed after a user logs in and when a Refresh Token is requested.

---

<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:** [January 7, 2022, 4:32pm UTC](https://community.auth0.com/t/how-add-customid-to-token/75409/4 "2022-01-07T16:32:49Z")

</div>

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