---
title: Get OTP API
slug: api-marketplace/get-otp-api
description: Learn how to request a One Time Password (OTP) through an API for user authentication. This document explains the necessary steps, including a POST request to a designated URL and providing the mobile number in the request body. Discover the response elem
createdAt: 2023-04-07T08:40:25.000Z
---

# Description

This API is used to request a One Time Password (OTP) that will be sent to the mobile number associated with the given UAN (Universal Account Number). This OTP can be used to authenticate the user in subsequent API calls.

# Request

- **Method**: POST
- **URL**:&#x20;
  - Preproduction - https\://api-preproduction.signzy.app/api/v3/underwriting/get-passbook-otp
  - Production - https\://api.signzy.app/api/v3/underwriting/get-passbook-otp
- **Headers**:
  - Authorization: The API key is required to authenticate the request. Please use the key that you will receive from our sales, csm, or support team.
  - Content-Type: application/json
- **Body**:

:::CodeblockTabs
Body

```json
{
  "phoneNumber": "<Mobile Number>",
  "callbackUrl": ""
}
```
:::

- **Request Parameters:**

| **Key**     | **Description**                                                                                              | **Mandatory/Optional** | **Type** |
| ----------- | ------------------------------------------------------------------------------------------------------------ | ---------------------- | -------- |
| phoneNumber | The mobile number associated with the UAN for which OTP is being requested                                   | Mandatory              | String   |
| callbackUrl | The URL where the complete data of the EPFO Passbook will be posted once the EPFO Passbook Pull is completed | Optional               | String   |

## Sample Request

:::CodeblockTabs
Preproduction

```curl
curl --location 'https://api-preproduction.signzy.app/api/v3/underwriting/get-passbook-otp' \
--header 'Content-Type: application/json' \
--header 'Authorization: <Auth-token> \
--data '{
    "phoneNumber": "XXXXXXXXXX",
    "callbackUrl": "<callbackUrl>"
}'
```

Production

```curl
curl --location 'https://api.signzy.app/api/v3/underwriting/get-passbook-otp' \
--header 'Content-Type: application/json' \
--header 'Authorization: <Auth-token> \
--data '{
    "phoneNumber": "XXXXXXXXXX",
    "callbackUrl": "<callbackUrl>"
}'
```
:::

# Response

- **Headers**:
  - Content-Type: application/json
- **Body**:

```json
{
    "httpResponseCode": 200,
    "message": "An OTP has been sent to your mobile number XXXXXXXXXX",
    "resultCode": 101,
    "clientRefNum": "<clientRefNumId>",
    "txnId": "<txnId>"
}
```

- **Response Parameters:**

| **Key**          | **Description**                                            | **Type** |
| ---------------- | ---------------------------------------------------------- | -------- |
| httpResponseCode | The http status Code of request                            | Number   |
| message          | The messge giving the description about the OTP generation | String   |
| resultCode       | The resultCode of the request                              | String   |
| clientRefNum     | The clientRefNum received                                  | Number   |
| txnId            | The txnId received                                         | String   |

## Sample Responses

:::CodeblockTabs
OTP Is Sent

```json
{
    "httpResponseCode": 200,
    "message": "An OTP has been sent to your mobile number 89XXXXXX58",
    "resultCode": 101,
    "clientRefNum": "9cfd15b7-3968-466c-87f8-146f3e6b7b7f",
    "txnId": "02dece70-5967-4949-9fea-f5ce7e6a5a53"
}
```

In-valid Mobile Number

```json
{
    "error": {
        "reason": "ERROR",
        "status": 400,
        "message": "One or more parameters format is wrong",
        "type": "Bad Request",
        "statusCode": 400,
        "name": "error"
    }
}
```
:::

# Error Codes

| **Error Code** | **Description**                                  |
| -------------- | ------------------------------------------------ |
| 400            | Bad Request (Mobile number entered is not valid) |
| 409            | Upstream is down                                 |
| 500            | Internal Server Error                            |

## Sample Error Responses

:::CodeblockTabs
400

```json
{
    "error": {
        "reason": "ERROR",
        "status": 400,
        "message": "One or more parameters format is wrong",
        "type": "Bad Request",
        "statusCode": 400,
        "name": "error"
    }
}
```

409

```json
{
    "error": {
        "reason": "ERROR",
        "status": 409,
        "message": "Upstream is down",
        "type": "Bad Request",
        "statusCode": 409,
        "name": "error"
    }
}
```
:::

