> ## Documentation Index
> Fetch the complete documentation index at: https://docs.leapfinancial.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get user token

> Resolves and returns a RaaS user ID from a raw phone number.`



## OpenAPI

````yaml /raas/swagger-partner.json post /auth/get-user-token-v2
openapi: 3.0.0
info:
  title: ''
  version: 0.0.1
servers:
  - url: https://raas-partner-cv.nomas.cash/v1
security: []
paths:
  /auth/get-user-token-v2:
    post:
      tags:
        - Users
      summary: Get user token
      description: Resolves and returns a RaaS user ID from a raw phone number.`
      operationId: getUserTokenV2
      parameters: []
      requestBody:
        description: User alias (phone with country code).
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GetUserTokenParams'
            example:
              phoneNumber: '+5215521206703'
              countryCode: MX
      responses:
        '200':
          description: >-
            **200 — OK.** User resolved; optional CIP fields depend on tenant.


            **Scenarios for this response** (keep in sync with
            `testing-sandbox.mdx`):


            | Scenario | How to reproduce | Typical `code` / body |

            |------------|------------------|------------------------|

            | Known user by phone or email | E.164 `phoneNumber` (with `+`) or
            `email` that already exists for the tenant; align `countryCode` with
            the number when you send it. | Success JSON: `userId` (and optional
            `status` / `statusDetail`). |


            See also [Full scenario
            matrix](/raas/guides/testing-sandbox#getusertokenv2-%E2%80%94-scenario-matrix).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserTokenResponse'
              example:
                userId: OSZwErXgt1MGPHwkYJVqz3LTN0R2
        '400':
          description: >-
            **400 — Bad request.** Invalid tenant, missing alias, invalid email,
            or phone validation.


            **Scenarios for this response** (keep in sync with
            `testing-sandbox.mdx`):


            | Scenario | How to reproduce | Typical `code` / body |

            |------------|------------------|------------------------|

            | Tenant could not be loaded | First `tenantService.getById` returns
            no tenant for the resolved `request.tenant.id`
            (environment-specific). | `ERROR_INVALID_TENANT` |

            | Missing alias | Empty JSON `{}` or omit both `phoneNumber` and
            `email`. | `ERROR_INVALID_SCHEMA` |

            | Invalid email shape | String that fails the server-side email
            check, e.g. `"no-es-un-email"`, or an email containing a null byte.
            | `ERROR_INVALID_EMAIL_FORMAT` |

            | Phone not E.164 | `phoneNumber` without a leading `+` (e.g.
            national digits only). | `INVALID_PHONE_NUMBER` |

            | Country mismatch | Valid E.164 for one country with `countryCode`
            that does not match **platform phone validation** (e.g. MX mobile
            with `countryCode` forced to `US`). | `ERROR_COUNTRY_NOT_SUPPORTED`
            |


            See also [Full scenario
            matrix](/raas/guides/testing-sandbox#getusertokenv2-%E2%80%94-scenario-matrix).
          content:
            application/json:
              schema:
                properties:
                  reason:
                    type: string
                required:
                  - reason
                type: object
              example:
                reason: Missing or invalid phone number in request body.
        '401':
          description: >-
            **401 — Unauthorized.**


            **Scenarios for this response** (keep in sync with
            `testing-sandbox.mdx`):


            | Scenario | How to reproduce | Typical `code` / body |

            |------------|------------------|------------------------|

            | Missing / bad API key | Omit `api_key` or send an invalid/expired
            partner key (enforcement may still occur at the gateway before the
            handler). | OpenAPI documents `@Response<ErrorResponse>(401,
            "Missing or invalid API key")`; body shape may match `ErrorResponse`
            or your gateway. |


            See also [Full scenario
            matrix](/raas/guides/testing-sandbox#getusertokenv2-%E2%80%94-scenario-matrix).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                reason: Missing or invalid API key
        '404':
          description: >-
            **404 — Not found.** No user for the given phone or email.


            **Scenarios for this response** (keep in sync with
            `testing-sandbox.mdx`):


            | Scenario | How to reproduce | Typical `code` / body |

            |------------|------------------|------------------------|

            | User not found | `email` or `phoneNumber` that is syntactically
            valid but **not registered** in that environment / tenant. |
            `ERROR_USER_NOT_FOUND` |


            See also [Full scenario
            matrix](/raas/guides/testing-sandbox#getusertokenv2-%E2%80%94-scenario-matrix).
          content:
            application/json:
              schema:
                properties:
                  reason:
                    type: string
                required:
                  - reason
                type: object
              example:
                reason: User not found for the given alias.
        '500':
          description: >-
            **500 — Internal server error.** Generic internal payload.


            **Scenarios for this response** (keep in sync with
            `testing-sandbox.mdx`):


            | Scenario | How to reproduce | Typical `code` / body |

            |------------|------------------|------------------------|

            | Internal / downstream failure | Not reliably simulated from a
            static HTTP file; may appear on datastore, CIP, tenant, TPE, or any
            unexpected exception after **`NumiBadRequestError`** is ruled out. |
            `ERROR_INTERNAL_SERVER_ERROR` (generic handler payload) |


            See also [Full scenario
            matrix](/raas/guides/testing-sandbox#getusertokenv2-%E2%80%94-scenario-matrix).
          content:
            application/json:
              schema:
                properties:
                  reason:
                    type: string
                required:
                  - reason
                type: object
              example:
                reason: An unhandled error has occurred
      security:
        - api_key:
            - partner
components:
  schemas:
    GetUserTokenParams:
      description: >-
        Resolve an existing user by **phone** or **email** for partner “get user
        token” style calls.


        If both `email` and `phoneNumber` fields are sent in the same request,
        `email` takes precedence and `phoneNumber` will be ignored.
      properties:
        phoneNumber:
          type: string
          description: >-
            <span style="color:red">required</span>.


            Mobile phone number with country code. Must be a valid mobile phone
            number.

            Example: `+5215521206703` for MX.
        email:
          type: string
          description: Email address.
        countryCode:
          type: string
          description: |-
            Country code.
            ISO 3166-1 alpha-2.
      type: object
      additionalProperties: false
    UserTokenResponse:
      description: >-
        Successful user resolution for partner token endpoints (id + optional
        CIP snapshot).
      properties:
        userId:
          type: string
          description: User ID
        status:
          type: string
          description: >-
            Status of the user's CIP process


            Available options: `Completed`, `UpgradePending`,
            `UpgradeInProgress`, `UpgradeFailed`, `UpgradeSoftFailed`,
            `AccountUpgradeInProgress`
        statusDetail:
          $ref: '#/components/schemas/PlatLevelStatusDetail'
          description: Status detail of the user's CIP process
      required:
        - userId
      type: object
      additionalProperties: false
    ErrorResponse:
      properties:
        detail:
          type: string
        code:
          type: string
        reason:
          type: string
      required:
        - code
        - reason
      type: object
    PlatLevelStatusDetail:
      enum:
        - None
        - InvalidAddress
        - InvalidEMail
        - UnreadableDoc
        - ProvideAdditionalInfo
        - InvalidPersonalData
        - OtpPrivacyMissing
        - OtpContractMissing
        - Compliance
        - ComplianceBlocked
        - OfacFailed
      type: string
  securitySchemes:
    api_key:
      type: apiKey
      name: api_key
      in: header

````