---
title: Generate OTP
slug: api-marketplace/generate-otp
createdAt: 2024-08-05T12:33:20.623Z
---

## Introduction

The API generates OTP to validate consent to fetch address of the registered phone number by accepting phone number as an input parameter and creates a session for user to further process the request against the sessionId generated.

## Sample cURL

:::CodeblockTabs
Production

```curl
curl --location 'https://api.signzy.app/api/v3/phones/phone-address-generate-otp' \
--header 'Content-Type: application/json' \
--header 'Authorization: *********' \
--data '{
    "phoneNumber":"9691066329"
}'
```

Pre-Production

```curl
curl --location 'https://api-preproduction.signzy.app/api/v3/phones/phone-address-generate-otp' \
--header 'Content-Type: application/json' \
--header 'Authorization: **********' \
--data '{
    "phoneNumber": "9691066329"
}'
```
:::

## Input Parameters:

| **Parameter** | **Type** | **Description**                | **Mandatory/Optional** |
| ------------- | -------- | ------------------------------ | ---------------------- |
| phoneNumber   | String   | Phone Number of the Individual | Mandatory              |

## Sample Response:

:::CodeblockTabs
OTP generated

```json
{
    "sessionId": "44f7664b-2b83-46a4-91a2-81510917e463",
    "status": "OTP generated",
    "statusCode": 201
}
```

OTP by passed

```json
{
    "sessionId": "dcd30fb3-ea31-4737-a95b-c7aca04a5b91",
    "status": "OTP is bypassed",
    "statusCode": 200
}
```
:::

## Output Parameters:

| **Key**    | **Type** | **Description**                                             |
| ---------- | -------- | ----------------------------------------------------------- |
| sessionId  | String   | UUID generated to verify consent and fetch address details. |
| status     | String   | Status message                                              |
| statusCode | Number   | status code 201 on otp generation, 200 on otp bypass.       |

## Status Codes

:::CodeblockTabs
200 OK

```json
{
    "sessionId": "dcd30fb3-ea31-4737-a95b-c7aca04a5b91",
    "status": "OTP is bypassed",
    "statusCode": 200
}
```

404

```json
{
    "error": {
        "reason": "ERROR",
        "status": 404,
        "message": "No records found",
        "type": "Not Found",
        "statusCode": 404,
        "name": "error"
    }
}
```

400

```json
{
    "error": {
        "reason": "VALIDATION_ERROR",
        "status": 400,
        "message": "Invalid phoneNumber",
        "type": "Bad Request",
        "statusCode": 400,
        "name": "error"
    }
}
1. "\"phoneNumber\" Invalid phoneNumber"
```

401

```json
{
    "message": "Invalid authentication credentials"
}
```

500

```json
{
    "error": {
        "name": "error",
        "message": "Internal Server Error",
        "status": 500,
        "reason": "ERROR",
        "type": "Internal Server Error",
        "statusCode": 500
    }
}
```
:::

