# Submit OTP

{% hint style="info" %}
Submit the generated OTP for user verification.
{% endhint %}

***

## Submit the Generated OTP.

<img src="/files/1tl8KAsYlsDxvW0YsEZU" alt="API: - https://matar.in.ngrok.io/api/v1/login" class="gitbook-drawing">

### Params

#### **Body Parameter ⬇️**

<table data-full-width="false"><thead><tr><th width="239.33333333333331">Body Parameter</th><th width="116">Data Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>phone_number </strong><mark style="color:red;"><strong>(required)</strong></mark></td><td>String</td><td>Phone Number for sending OTP. Add 91 before your number.</td></tr><tr><td><strong>name </strong><mark style="color:red;"><strong>(required)</strong></mark></td><td>String</td><td>Name for Account Login.</td></tr><tr><td><strong>action </strong><mark style="color:red;"><strong>(required)</strong></mark></td><td>String</td><td>Provide action name which is <strong>'send_otp'</strong></td></tr><tr><td><strong>otp </strong><mark style="color:red;"><strong>(required)</strong></mark></td><td>String</td><td>Provide the received OTP on your mobile number. This is generated from Login API endpoint.</td></tr></tbody></table>

***

**Sample Request ⬇️ (Body Parameter)**

```
curl --location 'https://matar.in.ngrok.io/api/v1/login' \
--header 'Content-Type: application/json' \
--data '{
    "phone_number": "919743256789",
    "name": "Sri",
    "action": "submit_otp",
    "otp": "48793"
}'
```

**Responses ⬇️**

Status Code: 🟢**200** (200 denotes **'ok'**)

<pre class="language-200"><code class="lang-200"><strong>{
</strong>    "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmcmVzaCI6dHJ1ZSwiaWF0IjoxNjkyNzg2Njg1LCJqdGkiOiJiMjZmNTk2ZC1kOTYwLTQ2ZWMtYmFmNi1jNzkzMGQ5MzUxMjAiLCJ0eXBlIjoiYWNjZXNzIiwic3ViIjoiMzk1MDFUIiwibmJmIjoxNjkyNzg2Njg1LCJleHAiOjE2OTM2NTA2ODV9.iGXVYlasw8UL7UTRUR69lTlznivrpRJdODyTGIza7Og",
    "refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmcmVzaCI6ZmFsc2UsImlhdCI6MTY5Mjc4NjY4NSwianRpIjoiOTE5NzcwN2YtN2NmNi00MzMzLWE1OTUtZGQ0M2EzNWMwZTVlIiwidHlwZSI6InJlZnJlc2giLCJzdWIiOiIzOTUwMVQiLCJuYmYiOjE2OTI3ODY2ODUsImV4cCI6MTY5Nzk3MDY4NX0.4xvD7-O1HcW6yoV3cBsV2cn3VY38Y56lp656kNBQpOA"
}
</code></pre>

Status Code: 🔴**400** (400 denotes **'Bad request'**)

```
{
    "message": "Invalid OTP"
}
```

**Response Parameters Description:**

The access token requests secure access to the Matar resources whereas a refresh token just helps you re-validate a user without them having to re-enter their login credentials multiple times.

Access token expiry period: 10 days.

Refresh token expiry period: 60 days.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://gramhal.gitbook.io/matar/developer-reference/api/user-login/submit-otp.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
