# Retrieve User Phone Numbers

div
div
Client SDK
div
Backend API
div
Mobile approve
div
SSO
div
Sub-journey
> Retrieves all known phone numbers from the user's profile in Transmit


## Description

This step is used to retrieve all the phone numbers stored for a user in Mosaic. Phone numbers are added to user profiles using the [Register Phone](/guides/orchestration/journeys/register_phone) step and can be removed from the user using the [Deregister a Phone](/guides/orchestration/journeys/deregister_phone) step. The user's profile can also be viewed from the Admin Portal (from **B2C Identity** > **Users**), where the registered phone numbers are listed as secondary phone numbers for the user.

Maintaining a list of a user's known phone numbers can facilitate SMS-based authentication flows. For example, before sending an SMS OTP, the journey can look up a user's phone number based on username or validate that a phone number provided by the user is a known phone number for that user.

The user context for the step may be provided implicitly by the journey if the user is already authenticated; otherwise, a user identifier must be specified in the step configuration. Once triggered, the step retrieves the phone numbers and stores them in the configured output variable so they'll be available for subsequent steps. The phone numbers are stored in the variable in a parameter named `list` as an array of strings, where each phone number is specified in E.164 format (e.g., `["+14155552671", "+14155557999"]`).

If the step is successfully completed, the journey returns the phone numbers from the user's profile and continues to the next step. If it fails, the journey proceeds to an step failed branch (if one is specified); otherwise, the journey is aborted and an error is sent to the client.

## Configuration

div
| Field | Description |
|  --- | --- |
| **User auth state** | Indicates if the user has authenticated in this journey. If the user is authenticated (default), the user context is provided implicitly by the journey. If not, a user identifier must be configured. |
| **Identifiers** | Only configured if the journey doesn't authenticate the user before invoking this step. Can be an external user ID, email, phone number, username, or a [custom identifier](/guides/user/manage_user_schema), if configured for B2C users in your tenant. |
| **Output Variable** | Name of the variable that stores the user's phone numbers. The phone number list is available in the `list` parameter as an array of strings, where each number is specified in E.164 format (e.g., `["+14155552671", "+14155557999"]`) |
| **Error Output Variable** | Name of the variable that stores any errors returned by step |
| **Failure Behavior** | Determines the behavior in case of failure, which either aborts the journey or proceeds to a failure branch of the control flow (default). |


## Example

Here are some examples of using this step:

- [Example 1: Get phone numbers](#example-1-get-phone-numbers)
- [Example 2: Validate phone number is known](#example-2-validate-phone-number-is-known)


### Example 1: Get phone numbers

Suppose a user has the following known phone number (added using the [Register Phone](/guides/orchestration/journeys/register_phone) step): `+14155552671`. This step is configured to store the phone numbers in an output variable named `userPhones`. A subsequent step can then retrieve the list using `userPhones.list`, which would return `["+14155552671"]` in our example.

![](/assets/get_phones_ex1.f9864a75baea0d0e6d3e623bc52762c4486009855be7c1c2a4973fdca039b85c.6f9096f8.png)

### Example 2: Validate phone number is known

Building on the first example, suppose that we want to check if an phone number provided by the user is a known phone number for this user (assuming the phone number is different than the username). In our example, the username and phone number provided by the user are stored in variables named `providedUsername` and `providedPhone`, respectively. This step is configured to retrieve the phone numbers for `providedUsername` and store them in `userPhones`.

![](/assets/get_phones_ex2.a2cd94bfb20bc7fbeacce12ed2d2cd48a4cb5ea3b1c61624d30acef5c290e51c.6f9096f8.png)

In our example, the next step is a [Condition](/guides/orchestration/journeys/condition) that checks if the provided phone number is contained in the list of known phone numbers using the following expression: `@std.contains(userPhones.list, providedPhone)`:

![](/assets/get_phones_ex2b.5ff947861ec705ed215927c7190a9a67071bde87c684d279f8e6fa72a2ea7262.6f9096f8.png)