# Add SMS Authentication After Sending a Document

BoldSign provides the capability to add SMS authentication for signers, even after a document has been sent for signature.

To enable SMS authentication for signers using the BoldSign API, you need to set the `AuthenticationType` to `SMSOTP`. Additionally, it is essential to include the `CountryCode` and `Number` parameters for SMS authentication. This setup ensures that the signer will receive a code via text message, which they must enter to access the document.

Below are sample code snippets that illustrate how to add SMS authentication for one of a document's recipients:

## Code snippet

{% codetab id="codetab1"  %}

cURL

```shell
curl -X PATCH "https://api.boldsign.com/v1/document/addAuthentication?documentId={documentId}"
      -H -H 'X-API-KEY: {your API key}'
      -H "Content-Type: application/json"
      -d "{\"authenticationType\": \"SMSOTP\", \"emailId\": \"alexgayle@cubeflakes.com\", \"phoneNumber\": {\"countryCode\": \"{signer country code}\", \"number\": \"{signer phone number}\"}}"
```
C#

```csharp
var apiClient = new ApiClient("https://api.boldsign.com", "{apikey}");
var documentclient = new DocumentClient(apiClient);
var phoneNumber = new PhoneNumber() {
  CountryCode = "{signer country code}",
Number = "{signer phone number}"
  };
await documentclient.AddAuthenticationAsync("{documentId}", "alexgayle@cubeflakes.com", AuthenticationType.SMSOTP, null, phoneNumber: phoneNumber).ConfigureAwait(false);
```

Python

```python
import requests
import json
url = "https://api.boldsign.com/v1/document/addAuthentication?documentId={documentId}"
payload = json.dumps({
  "authenticationType": "SMSOTP",
  "emailId": "alexgayle@cubeflakes.com",
  "phoneNumber": {
    "countryCode": "{signer country code}",
    "number": "{signer phone number}"
  }
})
headers = {
  'X-API-KEY': '{your API key}',
  'Content-Type': 'application/json'
}
response = requests.request("PATCH", url, headers=headers, data=payload)
print(response.text)
```

NodeJS

```js
const axios = require('axios');
await axios.patch(  
'https://api.boldsign.com/v1/document/addAuthentication',
    {
        authenticationType: 'SMSOTP',
        emailId: 'alexgayle@cubeflakes.com',
        phoneNumber: {
            countryCode: '{signer country code}',
            number: '{signer phone number}'
        }
    },

    {
        params: { documentId: '{documentId}' },
        headers: {
            'X-API-KEY': '{Your API key}',
            'Content-Type': 'application/json'
        }
    }
);
```

PHP

```php
<?php
require_once "vendor/autoload.php";
use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Request;
$client = new Client([   'verify' => false]);
$headers = [
  'X-API-KEY' => '{your API key}',
  'Content-Type' => 'application/json'
];
$body = '{
  "authenticationType": "SMSOTP",
  "emailId": "alexgayle@cubeflakes.com",
  "phoneNumber": {
    "countryCode": "{signer country code}",
    "number": "{signer phone number}"
  }
}';
$request = new Request('PATCH', 'https://api.boldsign.com/v1/document/addAuthentication?documentId={documentId}', $headers, $body);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
```
{% /codetab %}

In the provided code examples, ensure that the `authenticationType` is set to `SMSOTP`. Additionally, replace the `documentId` placeholder with the actual ID of the document you created. Update the `SignerEmail` with the signer's correct email address and provide the `CountryCode` and `Number` in the `phoneNumber` field.

Once the code is executed, the document will be secured with SMS OTP authentication. This means that the signer will only be able to access the document by entering the correct code that will be texted to the specified number.
