# Send Email OTP



## <mark style="color:blue;">Send OTP</mark>

<mark style="color:green;">`POST`</mark> `https://valifystage.com/api/v1/otp/email/send/`

#### Headers

| Name          | Type   | Description            |
| ------------- | ------ | ---------------------- |
| Content-Type  | string | application/json       |
| Authorization | string | Bearer \<access-token> |

**Request Body**

| Name | Type   | Description                                                                                                                                                                                               |
| ---- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| data | object | <p>Object containing the parameters below:<br><code>{</code> <br>  <code>email: &#x3C;str>,</code><br>  <code>bundle_key: &#x3C;str>,</code><br>  <code>lang: &#x3C;str></code><br><code>}</code><br></p> |

**Status Codes**

{% tabs %}
{% tab title="✅200 Success" %}
```python
{
    "result": {
        "success": true
    },
    "transaction_id": <str>,
    "trials_remaining": <str>
}
  
```
{% endtab %}

{% tab title="400 Missing input data" %}
```python
{
    "message": "Bad Request – invalid request received (e.g. missing Bundle key, required parameters or invalid json) | Make sure all the required parameters are included"
}
```
{% endtab %}

{% tab title="401 Invalid bundle key" %}
```python
{
    "message": "Unauthorized – your Bundle key is invalid"
}
```
{% endtab %}

{% tab title="403 Access token error" %}
```python
{
    "message": "Forbidden – specified access_token could not be found"
}
```
{% endtab %}

{% tab title="422 Check Valify error codes" %}
```python
{
    "message": "<error-description>",
    "error_code": <valify-error-code>
}
```
{% endtab %}

{% tab title="500 Contact us" %}
```python
{
    "message": "Internal Server Error"
}
```
{% endtab %}
{% endtabs %}

## Code Snippets

{% tabs %}
{% tab title="🐍Python 3" %}
```python
import requests
import base64

token = '<token>' # Place your token here
data = {
    'bundle_key': '<bundle key>', # Place your bundle key here
    'email': '<email>', # Place the phone number here
    'lang': '<str>' # optional, default: en
}

r = requests.post("https://<base-url>/api/v1/otp/email/send/",
        json=data,
        headers={'Authorization': 'Bearer %s' % token}
    )
                      
print(r.json())
```
{% endtab %}
{% endtabs %}
