---
title: Verify OTP and fetch Address
slug: api-marketplace/verify-otp-and-fetch-address
createdAt: 2024-08-05T12:48:13.378Z
---

## Introduction

This API accepts sessionId generated in [Generate OTP](https://docs.s8933.in/api-marketplace/generate-otp)  and OTP sent to phone number by [Generate OTP](https://docs.s8933.in/api-marketplace/generate-otp)  API , After successful verification of OTP provides address details for  the phone number associated with sessionId.

## Sample cURL

:::CodeblockTabs
Production

```curl
curl --location 'https://api.signzy.app/api/v3/phones/phone-address-submit-otp' \
--header 'Content-Type: application/json' \
--header 'Authorization: ********' \
--data '{
    "sessionId": "44f7664b-2b83-46a4-91a2-81510917e463",
    "otp":"8795"
}'
```

Pre-Production

```curl
curl --location 'https://api-preproduction.signzy.app/api/v3/phones/phone-address-submit-otp' \
--header 'Content-Type: application/json' \
--header 'Authorization: ********' \
--data '{
    "sessionId": "1ab00ef1-7c37-4304-bf79-77e24029f2bf",
    "otp":"0340"
}'
```
:::

## Input Parameters:

| **Parameter** | **Type** | **Description**                           | **Mandatory/Optional**                                                                         |
| ------------- | -------- | ----------------------------------------- | ---------------------------------------------------------------------------------------------- |
| sessionId     | String   | sessionId generated while generating  otp | Mandatory                                                                                      |
| otp           | String   | OTP sent on phone number                  | Mandatory- if phone number is not verified.<br />Optional- if phone number is already verified |

## Sample Response:

```json
{
    "sessionId": "1ab00ef1-7c37-4304-bf79-77e24029f2bf",
    "result": {
        "user": {
            "firstName": null,
            "lastName": null,
            "phoneNumber": "+919691066329",
            "email": null
        },
        "addresses": [
            {
                "addressType": null,
                "zip": "560068",
                "country": "India",
                "countryCode": null,
                "city": "",
                "phone": "+919691066329",
                "address2": null,
                "address1": "BTM layout 1st stage",
                "name": "Prashant  Beck",
                "state": "Karnataka",
                "type": null,
                "stateCode": null,
                "email": "prashantbeck1057@gmail.com"
            }
        ]
    },
    "status": "OTP is verified",
    "statusCode": 200
}
```

## Output Parameters:

| **Key**                          | **Type** | **Description**                                |
| -------------------------------- | -------- | ---------------------------------------------- |
| sessionId                        | String   | UUID for the session.                          |
| result                           | Object   | Contains user and address information.         |
| result.user                      | Object   | User details of phone number                   |
| result.user.firstName            | String   | first name                                     |
| result.user.lastName             | String   | last name                                      |
| result.user.phoneNumber          | String   | phone number                                   |
| result.user.email                | String   | email                                          |
| result.addresses                 | Array    | List of addresses associated with phone number |
| result.addresses\[n].addressType | String   | address type. example:- home,work etc.         |
| result.addresses\[n].zip         | String   | area pincode                                   |
| result.addresses\[n].country     | String   | country                                        |
| result.addresses\[n].countryCode | String   | country code                                   |
| result.addresses\[n].city        | String   | city                                           |
| result.addresses\[n].phone       | String   | address phone number                           |
| result.addresses\[n].address2    | String   | 2nd address                                    |
| result.addresses\[n].address1    | String   | 1st address                                    |
| result.addresses\[n].name        | String   | full name                                      |
| result.addresses\[n].state       | String   | state                                          |
| result.addresses\[n].type        | String   | type of address                                |
| result.addresses\[n].stateCode   | String   | state code                                     |
| result.addresses\[n].email       | String   | email                                          |
| status                           | String   | status message                                 |
| statusCode                       | Number   | status code                                    |

## Status Codes

:::CodeblockTabs
200 OK

```json
{
    "sessionId": "1ab00ef1-7c37-4304-bf79-77e24029f2bf",
    "result": {
        "user": {
            "firstName": null,
            "lastName": null,
            "phoneNumber": "+919691066329",
            "email": null
        },
        "addresses": [
            {
                "addressType": null,
                "zip": "560068",
                "country": "India",
                "countryCode": null,
                "city": "",
                "phone": "+919691066329",
                "address2": null,
                "address1": "BTM layout 1st stage",
                "name": "Prashant  Beck",
                "state": "Karnataka",
                "type": null,
                "stateCode": null,
                "email": "prashantbeck1057@gmail.com"
            }
        ]
    },
    "status": "OTP is verified",
    "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": "\"sessionId\" must be a valid GUID",
        "type": "Bad Request",
        "statusCode": 400,
        "name": "error"
    }
}
1."\"sessionId\" must be a valid GUID"
2."OTP must be a string of 4 digits"
```

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
    }
}
```
:::

