---
title: UserId Mapping
sidebar:
  order: 2
---

UserId Mapping allows you to map existing userIds (from your old auth provider) to the SuperTokens userIds. This prevents you from having to update the existing `userIDs` in your application's table.

As an example, if after creating the user in SuperTokens, their userId is `fa7a0841-b533-4478-95533-0fde890c3483` and the existing userId for that user is `customUserId`, then you can map these user IDs by calling the following API:

```bash
curl --location --request POST '<CORE_API_ENDPOINT>/recipe/userid/map' \
--header 'api-key: <YOUR_API_KEY>' \
--header 'Content-Type: application/json; charset=utf-8' \
--data-raw '{
  "superTokensUserId": "fa7a0841-b533-4478-95533-0fde890c3483",
  "externalUserId": "customUserId"
}'
```

Now whenever this user signs in, or if you fetch information about this user from SuperTokens, their userID will be `customUserId`.

:::info[Note]
The maximum allowed size of the `externalUserId` is 128 characters.
:::
