# How to Request Signature by Email and SMS

BoldSign allows you to send a document from template and notify signer via Email and SMS using the API. If you want to send the same set of documents repeatedly, you can create a template with the document and use the template to send out for signature.

## Create a template in BoldSign's web app

1. Create a template in BoldSign's web app. See [How to Create a Template in the BoldSign Web App](https://support.boldsign.com/en-US/kb/article/31/create-template) for instructions.
2. The default delivery option will be `Email`. You can set the delivery option to Email & SMS while creating the template.
   
Alternatively, if you do not set Email & SMS as the delivery option while creating the template, you can configure this using the API when sending the document using the template.

## Send document to the signer via Email
Below are example codes for sending a document using a template to the signer via Email and SMS:

## Code snippet

{% codetab id="codetab1"  %}

cURL

```shell 
curl -X 'POST' \
  'https://api.boldsign.com/v1/template/send?templateId=8fbed3d0-yyyy-xxxx -21f041809b72' \
  -H 'accept: application/json' \
  -H 'X-API-KEY: {Your API Key}' \
  -H 'Content-Type: application/json' \
  -d '{
  "title": "Testing",
  "message": "msg",
  "roles": [
    {
      "roleIndex": 1,
      "signerName": "Alex",
      "signerEmail": "alexgayle@cubeflakes.com",      
      "phoneNumber": {
        "countryCode": "{Signer's Country Code}",
        "number": "{Signer's Phone Number}"
      },
      "deliveryMode": "EmailAndSMS",
      "signerType": "Signer",
      "signerRole": "HR"
    }
  ],
  "sendViaSMS": true
 }'

```
C#

```csharp
var apiClient = new ApiClient("https://api.boldsign.com", "{Your API Key}");
var templateClient = new TemplateClient(apiClient);

var templateRole = new Roles()
{
    SignerName = "Alex",
    SignerEmail = "alexgayle@cubeflakes.com",
    SignerRole = "HR",
    SignerType = SignerType.Signer,
    RoleIndex = 1,
    DeliveryMode = DeliveryMode.EmailAndSMS,
    PhoneNumber = new PhoneNumber() { CountryCode="{Signer's Country Code}",Number = "{Signer's Phone Number}"},
};

var roles = new List<Roles>
  {
    templateRole,
  };

var sendForSignFromTemplate = new SendForSignFromTemplate()
{
    TemplateId = "8fbed3d0-yyyy-xxxx-21f041809b72",
    Roles = roles
};

var documentCreated = templateClient.SendUsingTemplate(sendForSignFromTemplate);

```

Python

```python
import requests
import json

url = "https://api.boldsign.com/v1/template/send?templateId=8fbed3d0-yyyy-xxxx -21f041809b72"
payload = {
    "title": "Testing",
    "message": "msg",
    "roles": [
        {
            "roleIndex": 1,
            "signerName": "Alex",
            "signerEmail": "alexgayle@cubeflakes.com",
            "phoneNumber": {
                "countryCode": "{Signer's Country Code}",
                "number": "{Signer's Phone Number}"
            },
            "deliveryMode": "EmailAndSMS",
            "signerType": "Signer",
            "signerRole": "HR"
        }
    ],
    "sendViaSMS": True
}
headers = {
    'accept': 'application/json',
    'X-API-KEY': '{Your API Key}',
    'Content-Type': 'application/json'
}

response = requests.post(url, headers=headers, data=json.dumps(payload))
print(response.text)

```

NodeJS

```js
const axios = require('axios');

const data = JSON.stringify({
  "title": "Testing",
  "message": "msg",
  "roles": [
    {
      "roleIndex": 1,
      "signerName": "Alex",
      "signerEmail": "alexgayle@cubeflakes.com",
      "phoneNumber": {
        "countryCode": "{Signer's Country Code}",
        "number": "{Signer's Phone Number}"
      },
      "deliveryMode": "EmailAndSMS",
      "signerType": "Signer",
      "signerRole": "HR"
    }
  ],
  "sendViaSMS": true
});

const config = {
  method: 'post',
  url: 'https://api.boldsign.com/v1/template/send?templateId=8fbed3d0-yyyy-xxxx -21f041809b72',
  headers: {
    'accept': 'application/json',
    'X-API-KEY': '{Your API Key}',
    'Content-Type': 'application/json'
  },
  data : data
};

axios(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});

```

{% /codetab %}

In the above example, update the `templateId` with the ID of the template you created earlier. Update the `deliveryMode` as `EmailAndSMS`. Then, update the `SignerEmail` and `SignerName` properties with the email and name of the signer you want to send the document to.

After executing the above code, the document will be created, and an email and sms will be sent to the signer. Now, the signer can sign the document by clicking the link in the email or in the text message.
