> You are reading the Docusign Developer Documentation. For clean Markdown of any page, append .md to the page URL.
>
> Documentation indexes by section:
> - APIs and SDKs: https://docusign.docs.buildwithfern.com/docs/llms.txt
> - Platform 101: https://docusign.docs.buildwithfern.com/platform/llms.txt
> - Extension Apps: https://docusign.docs.buildwithfern.com/extension-apps/llms.txt
> - Docusign CLI: https://docusign.docs.buildwithfern.com/docusign-cli/llms.txt
>
> Authentication (OAuth, JWT Grant, M2M): https://docusign.docs.buildwithfern.com/platform/auth
> Webhooks and Connect: https://docusign.docs.buildwithfern.com/platform/webhooks
>
> OpenAPI specifications: https://docusign.docs.buildwithfern.com/openapi.json
> MCP server: https://docusign.docs.buildwithfern.com/_mcp/server

# How to request a signature through your app (embedded signing) with a CFR Part 11 account

> Demonstrates how to create an envelope and request a signature using embedded signing in your app or website.

This topic demonstrates how to request a signature through your app with  [CFR Part 11 accounts](/docs/esign-rest-api/esign101/concepts/cfr-part-11-accounts). To use [Embedded signing](/docs/esign-rest-api/esign101/concepts/embedding/embedded-signing) with a CFR Part 11 account, you need to require recipient authentication for your signers using the workflow with the `defaultName` of "SMS for access & signatures." This topic also demonstrates how to use [Auto-place (anchor tagging)](/docs/esign-rest-api/esign101/concepts/tabs/auto-place) to automatically position tabs in a document with a specified string.

## Prerequisites

* Running this example requires that you have a [CFR Part 11 account](/docs/esign-rest-api/esign101/concepts/cfr-part-11-accounts) with the "SMS for access & signatures" authentication method enabled.
* To run this example from our launchers, you will need to log in with your CFR Part 11 account before you can view the example. After logging in the example will appear in place of the general embedded signing example.

> **Note**
>
> Run this code example from our [Quickstart](/docs/esign-rest-api/quickstart) or launcher projects: [Bash](https://github.com/docusign/code-examples-bash), [C#](https://github.com/docusign/code-examples-csharp), [Java](https://github.com/docusign/code-examples-java), [Node.js](https://github.com/docusign/code-examples-node), [PHP](https://github.com/docusign/code-examples-php), [PowerShell](https://github.com/docusign/code-examples-powershell), [Python](https://github.com/docusign/code-examples-python), or [Ruby](https://github.com/docusign/code-examples-ruby).

## Required data

Running the code in this how-to requires this data:

| Data element                 | Description                                                                                                                                                                                                                                                                                                            |
| ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| \{API_ACCOUNT_ID}            | A [GUID](http://guid.one/) value that identifies your account. This value is automatically generated by Docusign for any account you create. Copy the value from the **API Account ID** field on the [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=appsAndKeys) page.                               |
| \{BASE_PATH}                 | A string value that forms the root of the URL required to make API calls. The base path value in the example code is set to target the developer environment at https\://\<domain>/restapi Where \<domain> is demo.docusign.net for the developer environment and is the result of the GetUserInfo call in production. |
| \{CLIENT_USER_ID}            | A string value that serves as an identifier of an individual signer throughout the signing process. The combination of this value, the signer's name, and the signer's email is used to uniquely identify them.                                                                                                        |
| \{COUNTRY_CODE}              | The country code corresponding to the PHONE_NUMBER.                                                                                                                                                                                                                                                                    |
| \{DOCUMENT_ID}               | A document identifier such as a name or ID. You can get a [list of envelope documents](/docs/esign-rest-api/how-to/list-envelope-documents) to obtain this information.                                                                                                                                                |
| Document to be signed        | You must provide at least one document to be signed. Document used in this how-to:- [PDF file](https://github.com/docusign/code-examples-java/blob/master/src/main/resources/World_Wide_Corp_lorem.pdf)                                                                                                                |
| \{PHONE_NUMBER}              | The phone number of the signer where the authentication message will be sent.                                                                                                                                                                                                                                          |
| Return URL                   | A URL to which the user will be forwarded after signing is complete.                                                                                                                                                                                                                                                   |
| \{SIGNER_EMAIL}              | A string value for the email address where the signer will receive a notification of the signing request.                                                                                                                                                                                                              |
| \{SIGNER_NAME}               | A string value for the full name of the signer.                                                                                                                                                                                                                                                                        |
| SignHere or InitialHere tabs | It is required that each signer in the workflow has a minimum of one tab to be assigned to them.                                                                                                                                                                                                                       |
| \{WORKFLOW_ID}               | A GUID value that identifies the ID verification workflow assigned to your account when SMS authentication for CFR Part 11 is enabled.                                                                                                                                                                                 |

## Step 1. Obtain your OAuth token

To make the API calls shown in this how-to, you need a valid OAuth access token. Docusign supports access tokens for three different recommended OAuth grant types: Public Authorization Code Grant, Confidential Authorization Code Grant, and JSON Web Token (JWT) Grant. Choose the OAuth grant type appropriate for your scenario.

> **Note**
>
> See [Confidential Authorization Code Grant](/platform/auth/authcode#confidential-authorization-code-grant) for guidance on your options to get an Confidential Authorization Code Grant  OAuth token.

![Three icons that represent the three methods a user can use to obtain an OAuth token: JSON Web Token (JWT), Public Authorization Code Grant (ACG), and Confidential Authorization Code grant](/_fern-files/_img/64f473773042ee439449a096bf7673292b1585b86a4ccc55f82ba0dda41f61a1.webp)

## Step 2. Obtain your workflow ID

Make a request to the [IdentityVerifications:list](/docs/esign-rest-api/reference/accounts/identityverifications/list) endpoint of the eSignature REST API using your `{API_ACCOUNT_ID}` to retrieve the workflow ID. The response will include an array of workflow IDs. Different workflow IDs can be specified per recipient. To use embedded signing with a CFR Part 11 account, you need to use the workflow ID with the name `"SMS for access & signatures"`. If you do not have SMS authentication for CFR Part 11 configured for your account, the [IdentityVerifications:list](/docs/esign-rest-api/reference/accounts/identityverifications/list) call will not return a workflow ID with that name. Omitting a workflow ID or providing an invalid workflow ID will cause your request to fail.

**Note**: It is recommended to store the `workflowId` value obtained in this step and re-use it in the future instead of making this API call again.

**`Bash`**

```bash title="Bash"
curl --header "Authorization: Bearer ${ACCESS_TOKEN}" \
     --header "Content-Type: application/json" \
     --data-binary @${request_data} \
     --request GET ${base_path}/v2.1/accounts/${ACCOUNT_ID}/identity_verification \
     --output ${response}

#If the Status code returned is greater than 201 (OK / Accepted), display an error message along with the API response.
if [[ "$Status" -gt "201" ]] ; then
    echo ""
	echo "Unable to retrieve your account's workflow ID."
	echo ""
	cat $response
	exit 0
fi

# Retrieve the workflow IDs from the API response and put them in an array.
workflowIds=`cat $response | grep -o -P '(?<=workflowId\":\").*?(?=\")'`
arrWorkflowIds=($workflowIds)

# Get the index of the Phone auth workflow based on name and use that index for workflowId.
# Workflow name of phone auth is 'Phone Authentication'
workflowNames=`cat $response | grep -o -P '(?<=defaultName\":).*?(?=,)'`
element="SMS for access & signatures"

workflowId=$(GetWorkflowId "$workflowNames" "$element" "$workflowIds")
```

**`C#`**

```csharp title="C#"
var docuSignClient = new DocuSignClient(basePath);
docuSignClient.Configuration.DefaultHeader.Add("Authorization", "Bearer " + accessToken);

var accountsApi = new AccountsApi(docuSignClient);
var response = accountsApi.GetAccountIdentityVerificationWithHttpInfo(accountId);
response.Headers.TryGetValue("X-RateLimit-Remaining", out string remaining);
response.Headers.TryGetValue("X-RateLimit-Reset", out string reset);

if (reset != null && remaining != null)
{
    DateTime resetDate = DateTimeOffset.FromUnixTimeSeconds(long.Parse(reset)).UtcDateTime;
    Console.WriteLine("API calls remaining: " + remaining);
    Console.WriteLine("Next Reset: " + resetDate);
}

var phoneAuthWorkflow = response.Data.IdentityVerification.FirstOrDefault(x => x.DefaultName == "SMS for access & signatures");
```

**`Java`**

```java title="Java"
ApiClient apiClient = createApiClient(session.getBasePath(), user.getAccessToken());

AccountsApi workflowDetails = new AccountsApi(apiClient);
var workflowRes = workflowDetails.getAccountIdentityVerificationWithHttpInfo(session.getAccountId(), workflowDetails.new GetAccountIdentityVerificationOptions());
Map<String, List<String>> headers = workflowRes.getHeaders();
java.util.List<String> remaining = headers.get("X-RateLimit-Remaining");
List<String> reset = headers.get("X-RateLimit-Reset");

if (remaining != null & reset != null) {
    Instant resetInstant = Instant.ofEpochSecond(Long.parseLong(reset.get(0)));
    System.out.println("API calls remaining: " + remaining);
    System.out.println("Next Reset: " + resetInstant);
}
List<AccountIdentityVerificationWorkflow> identityVerification = workflowRes.getData().getIdentityVerification();
String workflowId = "";
for (int i = 0; i < identityVerification.size(); i++) {
    if (identityVerification.get(i).getDefaultName().equals("SMS for access & signatures")) {
        workflowId = identityVerification.get(i).getWorkflowId();
    }
}
```

**`Node.js`**

```javascript title="Node.js"
let dsApiClient = new docusign.ApiClient();
dsApiClient.setBasePath(args.basePath);
dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken);

// Obtain your workflowId
let accountsApi = new docusign.AccountsApi(dsApiClient);
let workflowId = null;

let workflowResults = await accountsApi.getAccountIdentityVerification(
  args.accountId, (error, data, response) => {
    const headers = response?.headers;

    const remaining = headers?.['x-ratelimit-remaining'];
    const reset = headers?.['x-ratelimit-reset'];

    if (remaining && reset) {
      const resetInstant = new Date(Number(reset) * 1000);

      console.log(`API calls remaining: ${remaining}`);
      console.log(`Next Reset: ${resetInstant.toISOString()}`);
    }
});

// Find the workflow ID corresponding to the name "Phone Authentication"
workflowResults.data.identityVerification.forEach(workflow => {
  if (workflow.defaultName === 'SMS for access & signatures') {
    workflowId = workflow.workflowId;
  }
});
```

**`PHP`**

```php title="PHP"
$accounts_api = $clientService->getAccountsApi();
$accounts_response = $accounts_api->getAccountIdentityVerificationWithHttpInfo(
    $_SESSION['ds_account_id']
);

$remaining = $accounts_response[2]['X-RateLimit-Remaining'] ?? null;
$reset = $accounts_response[2]['X-RateLimit-Reset'] ?? null;

if ($remaining !== null && $reset !== null) {
    $resetInstant = (new DateTime())->setTimestamp((int)$reset);
    error_log("API calls remaining: $remaining");
    error_log("Next Reset: " . $resetInstant->format(\DateTime::ATOM));
}

$workflows_data = $accounts_response[0]->getIdentityVerification();
foreach ($workflows_data as $workflow) {
    if ($workflow['default_name'] == 'SMS for access & signatures') {
        $args['envelope_args']['workflow_id'] = $workflow['workflow_id'];
    }
};

if (!isset($args['envelope_args']['workflow_id'])) {
    $clientService->showErrorTemplate(new ApiException("IDENTITY_WORKFLOW_INVALID_ID"));
}
```

**`PowerShell`**

```text title="PowerShell"
$uri = "https://demo.docusign.net/restapi/v2.1/accounts/$APIAccountId/identity_verification"
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.add("Authorization", "Bearer $oAuthAccessToken")
$headers.add("Accept", "application/json")
$headers.add("Content-Type", "application/json")
Write-Output "Attempting to retrieve your account's workflow ID"

$result = Invoke-RestMethod -uri $uri -headers $headers -method GET
$result.content
#Obtain the workflow ID from the API response
$workflowId = [System.Linq.Enumerable]::FirstOrDefault($result.identityVerification, [func[object, bool]] { param($x) $x.defaultName -eq "SMS for Access & Signatures"}).workflowId
```

**`Python`**

```python title="Python"
@staticmethod
def get_workflow(args):
    """Retrieve the workflow id"""
    try:
        api_client = create_api_client(base_path=args["base_path"], access_token=args["access_token"])

        workflow_details = AccountsApi(api_client)
        (workflow_response, status, headers) = workflow_details.get_account_identity_verification_with_http_info(account_id=args["account_id"])

        remaining = headers.get("X-RateLimit-Remaining")
        reset = headers.get("X-RateLimit-Reset")

        if remaining is not None and reset is not None:
            reset_date = dt.fromtimestamp(int(reset), tz=timezone.utc)
            print(f"API calls remaining: {remaining}")
            print(f"Next Reset: {reset_date}")

        # Check that idv authentication is enabled
        # Find the workflow ID corresponding to the name "Phone Authentication"
        if workflow_response.identity_verification:
            for workflow in workflow_response.identity_verification:
                if workflow.default_name == "SMS for access & signatures":
                    session['workflow_id'] = workflow.workflow_id

            return session['workflow_id']

        else:
            return None

    except ApiException as err:
        return process_error(err)
```

**`Ruby`**

```ruby title="Ruby"
accounts_api = create_account_api(args)

# Obtain your workflow_id
workflow_results, _status, headers = accounts_api.get_account_identity_verification_with_http_info(args[:account_id])

remaining = headers['X-RateLimit-Remaining']
reset = headers['X-RateLimit-Reset']

if remaining && reset
  reset_date = Time.at(reset.to_i).utc
  puts "API calls remaining: #{remaining}"
  puts "Next Reset: #{reset_date}"
end

if workflow_results.identity_verification
  workflow = workflow_results.identity_verification.find { |item| item.default_name == 'SMS for access & signatures' }
  workflow_id = workflow.workflow_id if workflow
end
```

## Step 3: Create the envelope definition

Next, create the request body. Do this by creating a JSON object, or, if you are using a [Docusign SDK](/docs/esign-rest-api/sdks), you can prepare a compatible request body by creating an envelope definition using the `makeEnvelope` method defined in the code for this how-to. Follow the steps below to create a CFR Part 11 envelope for embedded signing.

1. Add a document to the definition by saving it to a variable as a binary-encoded base64 string. If you intend to attach multiple documents, specify the document order using an array. The order of the array sets the order of the documents.
2. Set the signer's data, including their name, email address, and a client user ID (any alphanumeric value is suitable). Including a client user ID automatically specifies the signer as embedded (using your app). If there are multiple signers, you must create a signer recipient for each one.

   **Note:** If the client user ID is set and either `SignerMustHaveAccount` or `SignerMustLoginToSign` property of the account settings is set to `true`, the system throws an error.
3. Set the `identityVerification` property to the workflow ID obtained in the previous step to specify the SMS authentication workflow. Replace `{COUNTRY_CODE}`, and `{PHONE_NUMBER}` with your recipient's data in the JSON request body.
4. Create and assign signable fields (also known as tabs) for a specific signer within the document using [AutoPlace](/docs/esign-rest-api/esign101/concepts/tabs/auto-place). This how-to uses anchor tabs to generate tabs automatically in your document by searching for each occurrence of a specific string of characters in the document and adding tabs at those locations. This example uses the string "/sn1/" for autotagging.

   To configure the anchor tabs, specify the number of units from the anchor text to offset the tab, as well as the string to search for and replace with a `signHere` tab within your document. You can create multiple `signHere` tabs for different locations and offsets, if needed.

   After creating the tabs, assign them to the signer created in the previous step.
5. Set the envelope's `status` property. To save the envelope as a draft, set `status` to `created`. To configure the envelope to be sent immediately after it is instantiated, set `status` to `sent` instead.

**`Bash`**

```bash title="Bash"
# Concatenate the different parts of the request
printf \
'{
    "emailSubject": "Part 11 Example Consent Form",
	"emailBlurb": "Please let us know if you have any questions.",
    "documents": [
        {
            "documentBase64": "' > $request_data
            cat $doc1_base64 >> $request_data
            printf '",
            "name": "Lorem Ipsum",
            "fileExtension": "pdf",
            "documentId": "1"
        }
    ],
    "recipients": {
        "signers": [
            {
                "email": "'"${SIGNER_EMAIL}"'",
                "name": "'"${SIGNER_NAME}"'",
                "recipientId": "1",
                "routingOrder": "1",
                "clientUserId": "1000",
                "tabs": {
                    "signHereTabs": [
                        {
                            "anchorString": "/sn1/",
                            "anchorUnits": "pixels",
                            "anchorXOffset": "20",
                            "anchorYOffset": "-30"
                        }
                    ]
                },
				"identityVerification":{
					"workflowId": "'"${workflowId}"'",
					"inputOptions": [{
						"name": "phone_number_list",
						"valueType": "PhoneNumberList",
						"phoneNumberList": [{
							"Number": "'"${SIGNER_PHONE_NUMBER}"'",
							"CountryCode": "'"${SIGNER_PHONE_COUNTRY}"'"
                    }]
                }]
            }
			}
        ]
    },
    "status": "sent"
}' >> $request_data
```

**`C#`**

```csharp title="C#"
EnvelopeDefinition env = new EnvelopeDefinition()
{
    EnvelopeIdStamping = "true",
    EmailSubject = "Please Sign",
    EmailBlurb = "Sample text for email body",
    Status = "Sent",
};

byte[] buffer = System.IO.File.ReadAllBytes(docPdf);

// Add a document
Document doc1 = new Document()
{
    DocumentId = "1",
    FileExtension = "pdf",
    Name = "Lorem",
    DocumentBase64 = Convert.ToBase64String(buffer),
};

// Create your signature tab
env.Documents = new List<Document> { doc1 };
SignHere signHere1 = new SignHere
{
    AnchorString = "/sn1/",
    AnchorUnits = "pixels",
    AnchorXOffset = "20",
    AnchorYOffset = "-30",
};

// Tabs are set per recipient/signer
Tabs signer1Tabs = new Tabs
{
    SignHereTabs = new List<SignHere> { signHere1 },
};

RecipientIdentityVerification workflow = new RecipientIdentityVerification()
{
    WorkflowId = workflowId,
    InputOptions = new List<RecipientIdentityInputOption>
    {
        new RecipientIdentityInputOption
        {
            Name = "phone_number_list",
            ValueType = "PhoneNumberList",
            PhoneNumberList = new List<RecipientIdentityPhoneNumber>
            {
                new RecipientIdentityPhoneNumber
                {
                    Number = phoneNumber,
                    CountryCode = countryAreaCode,
                },
            },
        },
    },
};

Signer signer1 = new Signer()
{
    Name = signerName,
    Email = signerEmail,
    RoutingOrder = "1",
    Status = "Created",
    DeliveryMethod = "Email",
    RecipientId = "1", // represents your {RECIPIENT_ID},
    Tabs = signer1Tabs,
    IdentityVerification = workflow,
    ClientUserId = ClientUserId,
};

Recipients recipients = new Recipients();
recipients.Signers = new List<Signer> { signer1 };
env.Recipients = recipients;
```

**`Java`**

```java title="Java"
public static EnvelopeDefinition makeEnvelope(
        String signerName,
        String signerEmail,
        String countryCode,
        String number,
        String workflowId,
        String signerClientId,
        Integer anchorOffsetY,
        Integer anchorOffsetX,
        String documentFileName,
        String documentName) throws IOException {
    // Create a signer recipient to sign the document, identified by name and email
    // We set the clientUserId to enable embedded signing for the recipient
    RecipientIdentityPhoneNumber phoneNumber = new RecipientIdentityPhoneNumber();
    phoneNumber.setCountryCode(countryCode);
    phoneNumber.setNumber(number);

    RecipientIdentityInputOption inputOption = new RecipientIdentityInputOption();
    inputOption.setName("phone_number_list");
    inputOption.setValueType("PhoneNumberList");
    inputOption.setPhoneNumberList(List.of(phoneNumber));

    RecipientIdentityVerification identityVerifcation = new RecipientIdentityVerification();

    identityVerifcation.setWorkflowId(workflowId);
    identityVerifcation.setInputOptions(List.of(inputOption));

    Signer signer = new Signer();
    signer.setEmail(signerEmail);
    signer.setName(signerName);
    signer.clientUserId(signerClientId);
    signer.recipientId("1");
    signer.setTabs(EnvelopeHelpers.createSingleSignerTab("/sn1/", anchorOffsetY, anchorOffsetX));
    signer.setIdentityVerification(identityVerifcation);

    // Add the recipient to the envelope object
    Recipients recipients = new Recipients();
    recipients.setSigners(Collections.singletonList(signer));

    EnvelopeDefinition envelopeDefinition = new EnvelopeDefinition();
    envelopeDefinition.setEmailSubject("Please sign this document");
    envelopeDefinition.setRecipients(recipients);
    Document doc = EnvelopeHelpers.createDocumentFromFile(documentFileName, documentName, "3");
    envelopeDefinition.setDocuments(Collections.singletonList(doc));
    // Request that the envelope be sent by setting |status| to "sent".
    // To request that the envelope be created as a draft, set to "created"
    envelopeDefinition.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT);

    return envelopeDefinition;
}
```

**`Node.js`**

```javascript title="Node.js"
function makeEnvelope(args) {
  // Data for this method
  // args.signerEmail
  // args.signerName
  // args.signerClientId
  // docFile

  // document 1 (pdf) has tag /sn1/
  //
  // The envelope has one recipients.
  // recipient 1 - signer

  let docPdfBytes;
  // read file from a local directory
  // The read could raise an exception if the file is not available!
  docPdfBytes = fs.readFileSync(args.docFile);

  // create the envelope definition
  let env = new docusign.EnvelopeDefinition();
  env.emailSubject = 'Please sign this document';

  // add the documents
  let doc1 = new docusign.Document();
    let doc1b64 = Buffer.from(docPdfBytes).toString('base64');
  doc1.documentBase64 = doc1b64;
  doc1.name = 'Lorem Ipsum'; // can be different from actual file name
  doc1.fileExtension = 'pdf';
  doc1.documentId = '3';

  // The order in the docs array determines the order in the envelope
  env.documents = [doc1];

  // Create a signer recipient to sign the document, identified by name and email
  // We set the clientUserId to enable embedded signing for the recipient
  // We're setting the parameters via the object creation
  let signer1 = docusign.Signer.constructFromObject({
    email: args.signerEmail,
    name: args.signerName,
    clientUserId: args.signerClientId,
    recipientId: 1,
    identityVerification: { workflowId: args.workflowId, steps: null, inputOptions: [{name: 'phone_number_list', valueType: 'PhoneNumberList', phoneNumberList: [{countryCode: args.countryCode, code: '1', number: args.phoneNumber}]}], idCheckConfigurationName: ''}
  });

  // Create signHere fields (also known as tabs) on the documents,
  // We're using anchor (autoPlace) positioning
  //
  // The DocuSign platform seaches throughout your envelope's
  // documents for matching anchor strings.
  let signHere1 = docusign.SignHere.constructFromObject({
    anchorString: '/sn1/',
    anchorYOffset: '-30',
    anchorUnits: 'pixels',
    anchorXOffset: '20',
  });
  // Tabs are set per recipient / signer
  let signer1Tabs = docusign.Tabs.constructFromObject({
    signHereTabs: [signHere1],
  });
  signer1.tabs = signer1Tabs;

  // Add the recipient to the envelope object
  let recipients = docusign.Recipients.constructFromObject({
    signers: [signer1],
  });
  env.recipients = recipients;

  // Request that the envelope be sent by setting |status| to "sent".
  // To request that the envelope be created as a draft, set to "created"
  env.status = 'sent';

  return env;
}
```

**`PHP`**

```php title="PHP"
private static function makeEnvelope(array $args, string $demoPath): EnvelopeDefinition
{
    # document 1 (pdf) has tag /sn1/
    #
    # The envelope has one recipient.
    # recipient 1 - signer
    #
    # Read the file
    $content_bytes = file_get_contents($demoPath . $GLOBALS['DS_CONFIG']['doc_pdf']);
    $base64_file_content = base64_encode($content_bytes);

    # Create the document model
    $document = new Document(
        [ # create the DocuSign document object
            'document_base64' => $base64_file_content,
            'name' => 'Example document', # can be different from actual file name
            'file_extension' => 'pdf', # many different document types are accepted
            'document_id' => 1 # a label used to reference the doc
        ]
    );

    $phoneNumber = new RecipientIdentityPhoneNumber();
    $phoneNumber->setCountryCode($args['country_code']);
    $phoneNumber->setNumber($args['phone_number']);

    $inputOption = new RecipientIdentityInputOption();
    $inputOption->setName('phone_number_list');
    $inputOption->setValueType('PhoneNumberList');
    $inputOption->setPhoneNumberList(array($phoneNumber));

    $identityVerification = new RecipientIdentityVerification();
    $identityVerification->setWorkflowId($args['workflow_id']);
    $identityVerification->setInputOptions(array($inputOption));

    # Create the signer recipient model
    $signer = new Signer(
        [ # The signer
            'email' => $args['signer_email'],
            'name' => $args['signer_name'],
            'recipient_id' => "1",
            'routing_order' => "1",
            # Setting the client_user_id marks the signer as embedded
            'client_user_id' => $args['signer_client_id'],

        ]
    );

    $signer->setIdentityVerification($identityVerification);

    # Create a sign_here tab (field on the document)
    $sign_here = new SignHere(
        [ # DocuSign SignHere field/tab
            'anchor_string' => '/sn1/',
            'anchor_units' => 'pixels',
            'anchor_y_offset' => '-30',
            'anchor_x_offset' => '20'
        ]
    );

    # Add the tabs model (including the sign_here tab) to the signer
    # The Tabs object wants arrays of the different field/tab types
    $signer->settabs(new Tabs(['sign_here_tabs' => [$sign_here]]));

    # Next, create the top level envelope definition and populate it.
    $envelope_definition = new EnvelopeDefinition(
        [
            'email_subject' => "Please sign this document sent from the PHP SDK",
            'documents' => [$document],
            # The Recipients object wants arrays for each recipient type
            'recipients' => new Recipients(['signers' => [$signer]]),
            'status' => "sent" # requests that the envelope be created and sent.
        ]
    );

    return $envelope_definition;
}
```

**`PowerShell`**

```text title="PowerShell"
$body = @"
{
	"documents": [{
		"documentBase64": "$(Get-Content $doc1Base64)",
		"documentId": "1",
		"fileExtension": "pdf",
		"name": "Lorem"
	}],
	"emailBlurb": "Please let us know if you have any questions.",
	"emailSubject": "Part 11 Example Consent Form",
	"envelopeIdStamping": "true",
	"recipients": {
		"signers": [{
			"name": "$SIGNER_NAME",
			"email": "$SIGNER_EMAIL",
			"roleName": "",
			"note": "",
			"routingOrder": 2,
			"clientUserID": 1000,
			"status": "created",
			"tabs": {
				"signHereTabs": [{
					"documentId": "1",
					"name": "SignHereTab",
					"pageNumber": "1",
					"recipientId": "1",
					"tabLabel": "SignHereTab",
					"xPosition": "200",
					"yPosition": "150"
				}]
			},
			"templateAccessCodeRequired": null,
			"deliveryMethod": "email",
			"recipientId": "1",
			"identityVerification":{
				"workflowId":"$workflowId",
				"steps":null,"inputOptions":[
					{"name":"phone_number_list",
					"valueType":"PhoneNumberList",
					"phoneNumberList":[
						{
							"countryCode":"$SIGNER_COUNTRY_CODE",
							"number":"$SIGNER_PHONE_NUMBER"
						}
						]
					}]
				}
			}]
		},
	"status": "Sent"
}
"@
```

**`Python`**

```python title="Python"
@classmethod
def make_envelope(cls, args):
    """
    Creates envelope
    args -- parameters for the envelope:
    signer_email, signer_name, signer_client_id
    returns an envelope definition
    """

    # document 1 (pdf) has tag /sn1/
    #
    # The envelope has one recipient.
    # recipient 1 - signer
    with open(path.join(demo_docs_path, DS_CONFIG["doc_pdf"]), "rb") as file:
        content_bytes = file.read()
    base64_file_content = base64.b64encode(content_bytes).decode("ascii")

    # Create the document model
    document = Document(  # create the DocuSign document object
        document_base64=base64_file_content,
        name="Example document",  # can be different from actual file name
        file_extension="pdf",  # many different document types are accepted
        document_id=1  # a label used to reference the doc
    )

    # Create the signer recipient model
    signer = Signer(
        # The signer
        email=args["signer_email"],
        name=args["signer_name"],
        recipient_id="1",
        routing_order="1",
        identity_verification={ "workflowId": session['workflow_id'], "steps": "null", "inputOptions":[{"name":"phone_number_list","valueType":"PhoneNumberList","phoneNumberList":[{"countryCode":args["country_code"],"code":"1","number":args["phone_number"]}]}], "idCheckConfigurationName":""},
        # Setting the client_user_id marks the signer as embedded
        client_user_id=args["signer_client_id"]
    )

    # Create a sign_here tab (field on the document)
    sign_here = SignHere(
        # DocuSign SignHere field/tab
        anchor_string="/sn1/",
        anchor_units="pixels",
        anchor_y_offset="-30",
        anchor_x_offset="20"
    )

    # Add the tabs model (including the sign_here tab) to the signer
    # The Tabs object wants arrays of the different field/tab types
    signer.tabs = Tabs(sign_here_tabs=[sign_here])

    # Next, create the top level envelope definition and populate it.
    envelope_definition = EnvelopeDefinition(
        email_subject="Please sign this document sent from the Python SDK",
        documents=[document],
        # The Recipients object wants arrays for each recipient type
        recipients=Recipients(signers=[signer]),
        status="sent"  # requests that the envelope be created and sent.
    )

    return envelope_definition
```

**`Ruby`**

```ruby title="Ruby"
def make_envelope(args, workflow_id)
  envelope_definition = DocuSign_eSign::EnvelopeDefinition.new
  envelope_definition.email_subject = 'Please sign this document sent from Ruby SDK'

  doc1 = DocuSign_eSign::Document.new
  doc1.document_base64 = Base64.encode64(File.binread(args[:pdf_filename]))
  doc1.name = 'Lorem Ipsum'
  doc1.file_extension = 'pdf'
  doc1.document_id = '1'

  # The order in the docs array determines the order in the envelope
  envelope_definition.documents = [doc1]

  phone_number = DocuSign_eSign::RecipientIdentityPhoneNumber.new
  phone_number.country_code = args[:country_code]
  phone_number.number = args[:phone_number]

  input_option = DocuSign_eSign::RecipientIdentityInputOption.new
  input_option.name = 'phone_number_list'
  input_option.value_type = 'PhoneNumberList'
  input_option.phone_number_list = [phone_number]

  identity_verification = DocuSign_eSign::RecipientIdentityVerification.new

  identity_verification.workflow_id = workflow_id
  identity_verification.input_options = [input_option]

  # Create a signer recipient to sign the document, identified by name and email
  # We're setting the parameters via the object creation
  signer1 = DocuSign_eSign::Signer.new({
                                         email: args[:signer_email],
                                         name: args[:signer_name],
                                         clientUserId: args[:signer_client_id],
                                         recipientId: 1,
                                         identityVerification: identity_verification
                                       })
  # The Docusign platform searches throughout your envelope's documents for matching
  # anchor strings. So the sign_here_2 tab will be used in both document 2 and 3
  # since they use the same anchor string for their "signer 1" tabs.
  sign_here = DocuSign_eSign::SignHere.new
  sign_here.anchor_string = '/sn1/'
  sign_here.anchor_units = 'pixels'
  sign_here.anchor_x_offset = '20'
  sign_here.anchor_y_offset = '-30'
  # Tabs are set per recipient/signer
  tabs = DocuSign_eSign::Tabs.new
  tabs.sign_here_tabs = [sign_here]
  signer1.tabs = tabs
  # Add the recipients to the envelope object
  recipients = DocuSign_eSign::Recipients.new
  recipients.signers = [signer1]

  envelope_definition.recipients = recipients
  # Request that the envelope be sent by setting status to "sent".
  # To request that the envelope be created as a draft, set status to "created"
  envelope_definition.status = 'sent'
  envelope_definition
end
```

## Step 4: Create the envelope

With the envelope definition and the attributes defined for the signer, document, and custom fields, you can now use the [Envelopes:create](/docs/esign-rest-api/reference/envelopes/envelopes/create) endpoint to create an envelope for the transaction.

* First, instantiate a new instance of the API client (if you're using a Docusign SDK).
* Set the following default request header to add your access token to all API calls.
  `"Authorization: Bearer ${ACCESS_TOKEN}"`
* Initialize the Envelopes API.
* Using your Docusign integration key and the prepared envelope definition, generate and retrieve an envelope ID using the [Envelopes:create](/docs/esign-rest-api/reference/envelopes/envelopes/create) endpoint.

**`Bash`**

```bash title="Bash"
curl --header "Authorization: Bearer ${ACCESS_TOKEN}" \
     --header "Content-Type: application/json" \
     --data-binary @${request_data} \
     --request POST ${base_path}/v2.1/accounts/${ACCOUNT_ID}/envelopes \
     --output ${response}

echo ""
echo "Response:" `cat $response`
echo ""

# Pull out the envelopeId
envelope_id=`cat $response | grep envelopeId | sed 's/.*\"envelopeId\":\"//' | sed 's/\",.*//'`
```

**`C#`**

```csharp title="C#"
EnvelopesApi envelopesApi = new EnvelopesApi(docuSignClient);
EnvelopeSummary results = envelopesApi.CreateEnvelope(accountId, env);
```

**`Java`**

```java title="Java"
EnvelopeDefinition envelope = CfrEmbeddedSigningService.makeEnvelope(
        signerName,
        signerEmail,
        countryCode,
        phoneNumber,
        workflowId,
        signerClientId,
        ANCHOR_OFFSET_Y,
        ANCHOR_OFFSET_X,
        DOCUMENT_FILE_NAME,
        DOCUMENT_NAME);

// Call DocuSign to create the envelope
EnvelopesApi envelopesApi = new EnvelopesApi(apiClient);
var envelopeSummary = envelopesApi.createEnvelopeWithHttpInfo(accountId, envelope, envelopesApi.new CreateEnvelopeOptions());
headers = envelopeSummary.getHeaders();
remaining = headers.get("X-RateLimit-Remaining");
reset = headers.get("X-RateLimit-Reset");

if (remaining != null & reset != null) {
    Instant resetInstant = Instant.ofEpochSecond(Long.parseLong(reset.get(0)));
    System.out.println("API calls remaining: " + remaining);
    System.out.println("Next Reset: " + resetInstant);
}
String envelopeId = envelopeSummary.getData().getEnvelopeId();
```

**`Node.js`**

```javascript title="Node.js"
let envelope = makeEnvelope(args.envelopeArgs);

// call Envelopes::create API method
// Exceptions will be caught by the calling function
results = await envelopesApi.createEnvelope(args.accountId, {
  envelopeDefinition: envelope,
}, (error, data, response) => {
    const headers = response?.headers;

    const remaining = headers?.['x-ratelimit-remaining'];
    const reset = headers?.['x-ratelimit-reset'];

    if (remaining && reset) {
      const resetInstant = new Date(Number(reset) * 1000);

      console.log(`API calls remaining: ${remaining}`);
      console.log(`Next Reset: ${resetInstant.toISOString()}`);
    }
});

let envelopeId = results.data.envelopeId;
```

**`PHP`**

```php title="PHP"
$envelope_definition = CFREmbeddedSigningService::makeEnvelope($args['envelope_args'], $demoPath);

$envelope_api = $clientService->getEnvelopeApi();

# Call Envelopes::create API method
# Exceptions will be caught by the calling function

// var_dump($envelope_definition);
//die;

try {
    $envelopeSummary = $envelope_api->createEnvelopeWithHttpInfo(
        $args['account_id'],
        $envelope_definition
    );

    $remaining = $envelopeSummary[2]['X-RateLimit-Remaining'] ?? null;
    $reset = $envelopeSummary[2]['X-RateLimit-Reset'] ?? null;

    if ($remaining !== null && $reset !== null) {
        $resetInstant = (new DateTime())->setTimestamp((int)$reset);
        error_log("API calls remaining: $remaining");
        error_log("Next Reset: " . $resetInstant->format(\DateTime::ATOM));
    }
} catch (ApiException $e) {
    $clientService->showErrorTemplate($e);
    exit;
}
$envelope_id = $envelopeSummary[0]->getEnvelopeId();
```

**`PowerShell`**

```text title="PowerShell"
$uri = "${apiUri}/v2.1/accounts/$APIAccountId/envelopes"
$result = Invoke-WebRequest -uri $uri -headers $headers -body $body -method POST -UseBasicParsing -OutFile $response
$result.content

# pull out the envelopeId
$envelopeId = $(Get-Content $response | ConvertFrom-Json).envelopeId
```

**`Python`**

```python title="Python"
api_client = create_api_client(base_path=args["base_path"], access_token=args["access_token"])

envelope_api = EnvelopesApi(api_client)
(results, status, headers) = envelope_api.create_envelope_with_http_info(account_id=args["account_id"], envelope_definition=envelope_definition)

remaining = headers.get("X-RateLimit-Remaining")
reset = headers.get("X-RateLimit-Reset")

if remaining is not None and reset is not None:
    reset_date = dt.fromtimestamp(int(reset), tz=timezone.utc)
    print(f"API calls remaining: {remaining}")
    print(f"Next Reset: {reset_date}")

envelope_id = results.envelope_id
```

**`Ruby`**

```ruby title="Ruby"
envelope_api = create_envelope_api(args)
envelope_definition = make_envelope(args[:envelope_args], workflow_id)

envelope, _status, headers = envelope_api.create_envelope_with_http_info(args[:account_id], envelope_definition)

remaining = headers['X-RateLimit-Remaining']
reset = headers['X-RateLimit-Reset']

if remaining && reset
  reset_date = Time.at(reset.to_i).utc
  puts "API calls remaining: #{remaining}"
  puts "Next Reset: #{reset_date}"
end

envelope_id = envelope.envelope_id
```

## Step 5: Create the recipient view definition

The recipient view is the screen that Docusign generates and displays in your app to enable your signers to sign documents. To create the definition, you must add the signer's information and the return URL.

* Set the return URL to which the user will be forwarded after signing is complete.
* Add the recipient information to the view, including the signer's `email`, `name`, and `clientUserID` that were set for the recipient who will sign the envelope.

**`Bash`**

```bash title="Bash"
printf \
'{
    "returnUrl": "http://httpbin.org/get",
    "authenticationMethod": "none",
    "email": "'"${SIGNER_EMAIL}"'",
    "userName": "'"${SIGNER_NAME}"'",
    "clientUserId": 1000,
}' >> $request_data
```

**`C#`**

```csharp title="C#"
RecipientViewRequest viewRequest = MakeRecipientViewRequest(signerEmail, signerName, redirectUrl, ClientUserId);
        private static RecipientViewRequest MakeRecipientViewRequest(string signerEmail, string signerName, string returnUrl, string signerClientId, string pingUrl = null)
        {
// Data for this method
// signerEmail
// signerName
// dsPingUrl -- class global
// signerClientId -- class global
// dsReturnUrl -- class global
RecipientViewRequest viewRequest = new RecipientViewRequest();

// Set the url where you want the recipient to go once they are done signing
// should typically be a callback route somewhere in your app.
// The query parameter is included as an example of how
// to save/recover state information during the redirect to
// the DocuSign signing ceremony. It's usually better to use
// the session mechanism of your web framework. Query parameters
// can be changed/spoofed very easily.
viewRequest.ReturnUrl = returnUrl + "?state=123";

// How has your app authenticated the user? In addition to your app's
// authentication, you can include authenticate steps from DocuSign.
// Eg, SMS authentication
viewRequest.AuthenticationMethod = "none";

// Recipient information must match embedded recipient info
// we used to create the envelope.
viewRequest.Email = signerEmail;
viewRequest.UserName = signerName;
viewRequest.ClientUserId = signerClientId;

// DocuSign recommends that you redirect to DocuSign for the
// Signing Ceremony. There are multiple ways to save state.
// To maintain your application's session, use the pingUrl
// parameter. It causes the DocuSign Signing Ceremony web page
// (not the DocuSign server) to send pings via AJAX to your
// app,
// NOTE: The pings will only be sent if the pingUrl is an https address
if (pingUrl != null)
{
    viewRequest.PingFrequency = "600"; // seconds
    viewRequest.PingUrl = pingUrl; // optional setting
}

return viewRequest;
        }
```

**`Java`**

```java title="Java"
RecipientViewRequest viewRequest = CfrEmbeddedSigningService.makeRecipientViewRequest(
        signerEmail,
        signerName,
        config,
        signerClientId);

    public static RecipientViewRequest makeRecipientViewRequest(
    String signerEmail,
    String signerName,
    DSConfiguration config,
    String clientUserId) {
RecipientViewRequest viewRequest = new RecipientViewRequest();
// Set the url where you want the recipient to go once they are done signing
// should typically be a callback route somewhere in your app.
// The query parameter is included as an example of how
// to save/recover state information during the redirect to
// the DocuSign signing. It's usually better to use
// the session mechanism of your web framework. Query parameters
// can be changed/spoofed very easily.
String stateValue = "?state=123";
viewRequest.setReturnUrl(config.getDsReturnUrl() + stateValue);

// How has your app authenticated the user? In addition to your app's
// authentication, you can include authenticate steps from DocuSign.
// Eg, SMS authentication
String authenticationMethod = "none";
viewRequest.setAuthenticationMethod(authenticationMethod);

// Recipient information must match embedded recipient info
// we used to create the envelope.
viewRequest.setEmail(signerEmail);
viewRequest.setUserName(signerName);
viewRequest.setClientUserId(clientUserId);

// DocuSign recommends that you redirect to DocuSign for the
// embedded signing. There are multiple ways to save state.
// To maintain your application's session, use the pingUrl
// parameter. It causes the DocuSign signing web page
// (not the DocuSign server) to send pings via AJAX to your app.
// NOTE: The pings will only be sent if the pingUrl is an https address
String pingFrequency = "600";
viewRequest.setPingFrequency(pingFrequency); // seconds
viewRequest.setPingUrl(config.getDsPingUrl());

return viewRequest;
    }
```

**`Node.js`**

```javascript title="Node.js"
function makeRecipientViewRequest(args) {
  // Data for this method
  // args.dsReturnUrl
  // args.signerEmail
  // args.signerName
  // args.signerClientId
  // args.dsPingUrl

  let viewRequest = new docusign.RecipientViewRequest();

  // Set the url where you want the recipient to go once they are done signing
  // should typically be a callback route somewhere in your app.
  // The query parameter is included as an example of how
  // to save/recover state information during the redirect to
  // the DocuSign signing. It's usually better to use
  // the session mechanism of your web framework. Query parameters
  // can be changed/spoofed very easily.
  viewRequest.returnUrl = args.dsReturnUrl + '?state=123';

  // How has your app authenticated the user? In addition to your app's
  // authentication, you can include authenticate steps from DocuSign.
  // Eg, SMS authentication
  viewRequest.authenticationMethod = 'none';

  // Recipient information must match embedded recipient info
  // we used to create the envelope.
  viewRequest.email = args.signerEmail;
  viewRequest.userName = args.signerName;
  viewRequest.clientUserId = args.signerClientId;

  // DocuSign recommends that you redirect to DocuSign for the
  // embedded signing. There are multiple ways to save state.
  // To maintain your application's session, use the pingUrl
  // parameter. It causes the DocuSign signing web page
  // (not the DocuSign server) to send pings via AJAX to your
  // app,
  viewRequest.pingFrequency = 600; // seconds
  // NOTE: The pings will only be sent if the pingUrl is an https address
  viewRequest.pingUrl = args.dsPingUrl; // optional setting

  return viewRequest;
}
```

**`PHP`**

```php title="PHP"
$recipient_view_request = $clientService->getRecipientViewRequest(
    $authentication_method,
    $args["envelope_args"]
);
```

**`PowerShell`**

```text title="PowerShell"
$json = [ordered]@{
    'returnUrl'            = 'http://httpbin.org/get';
    'authenticationMethod' = 'none';
    'email'                = $variables.SIGNER_EMAIL;
    'userName'             = $variables.SIGNER_NAME;
    'clientUserId'         = 1000
} | ConvertTo-Json -Compress
```

**`Python`**

```python title="Python"
recipient_view_request = RecipientViewRequest(
    authentication_method=authentication_method,
    client_user_id=envelope_args["signer_client_id"],
    recipient_id="1",
    return_url=envelope_args["ds_return_url"],
    user_name=envelope_args["signer_name"],
    email=envelope_args["signer_email"]
)
```

**`Ruby`**

```ruby title="Ruby"
view_request = DocuSign_eSign::RecipientViewRequest.new({
                                                          returnUrl: "#{envelope_args[:ds_return_url]}?state=123",
                                                          authenticationMethod: 'none',
                                                          email: envelope_args[:signer_email],
                                                          userName: envelope_args[:signer_name],
                                                          clientUserId: envelope_args[:signer_client_id],
                                                          pingFrequency: 600,
                                                          pingUrl: envelope_args[:ds_ping_url]
                                                        })
```

## Step 6. Create the recipient view and initiate embedded signing

Next, create the recipient view. Use the [EnvelopeViews:createRecipient](/docs/esign-rest-api/reference/envelopes/envelopeviews/createrecipient) method, passing in your API account ID and the `envelopeId` and `viewRequest` objects generated in previous steps.

Finally, extract the URL for embedded signing, which is the value of the URL key from the JSON response. You can redirect your app's internal browser to this URL to begin signing.

> **Note**
>
> View the source code for this how-to on GitHub: [Bash](https://github.com/docusign/code-examples-bash/blob/master/examples/eSignature/eg041EmbeddedSigningCFR.sh), [C#](https://github.com/docusign/code-examples-csharp/blob/master/launcher-csharp/eSignature/Examples/CFRPart11EmbeddedSending.cs), [Java](https://github.com/docusign/code-examples-java/blob/master/src/main/java/com/docusign/controller/eSignature/services/CfrEmbeddedSigningService.java), [Node.js](https://github.com/docusign/code-examples-node/blob/master/lib/eSignature/examples/embeddedSigningCFR.js), [PHP](https://github.com/docusign/code-examples-php/blob/master/src/Services/Examples/eSignature/CFREmbeddedSigningService.php), [PowerShell](https://github.com/docusign/code-examples-powershell/blob/master/examples/eSignature/eg041EmbeddedSigningCFR.ps1), [Python](https://github.com/docusign/code-examples-python/blob/master/app/eSignature/examples/eg041_cfr_embedded_signing.py), or [Ruby](https://github.com/docusign/code-examples-ruby/blob/master/app/services/e_sign/eg041_cfr_embedded_signing_service.rb).

**`Bash`**

```bash title="Bash"
Status=$(curl --header "Authorization: Bearer ${ACCESS_TOKEN}" \
     --header "Content-Type: application/json" \
     --data-binary @${request_data} \
     --request POST ${base_path}/v2.1/accounts/${ACCOUNT_ID}/envelopes/${envelope_id}/views/recipient \
     --output ${response})

if [[ "$Status" -gt "201" ]] ; then
    echo ""
	echo "Signing request failed."
	echo ""
	cat $response
	exit 0
fi

signing_url=`cat $response | grep url | sed 's/.*\"url\":\"//' | sed 's/\".*//'`
```

**`C#`**

```csharp title="C#"
var results1 = envelopesApi.CreateRecipientViewWithHttpInfo(accountId, results.EnvelopeId, viewRequest);

results1.Headers.TryGetValue("X-RateLimit-Remaining", out string remainingTime);
results1.Headers.TryGetValue("X-RateLimit-Reset", out string resetTime);

if (reset != null && remaining != null)
{
    DateTime resetDateTime = DateTimeOffset.FromUnixTimeSeconds(long.Parse(resetTime)).UtcDateTime;
    Console.WriteLine("API calls remaining: " + remaining);
    Console.WriteLine("Next Reset: " + resetDateTime);
}
```

**`Java`**

```java title="Java"
ViewUrl viewUrl = CfrEmbeddedSigningService.embeddedSigning(
        envelopesApi,
        accountId,
        envelopeId,
        viewRequest
);
    public static ViewUrl embeddedSigning(
    EnvelopesApi envelopesApi,
    String accountId,
    String envelopeId,
    RecipientViewRequest viewRequest) throws ApiException {
var recipientViewResponse = envelopesApi.createRecipientViewWithHttpInfo(accountId, envelopeId, viewRequest);
Map<String, List<String>> headers = recipientViewResponse.getHeaders();
java.util.List<String> remaining = headers.get("X-RateLimit-Remaining");
List<String> reset = headers.get("X-RateLimit-Reset");

if (remaining != null & reset != null) {
    Instant resetInstant = Instant.ofEpochSecond(Long.parseLong(reset.get(0)));
    System.out.println("API calls remaining: " + remaining);
    System.out.println("Next Reset: " + resetInstant);
}
return recipientViewResponse.getData();
    }
```

**`Node.js`**

```javascript title="Node.js"
let viewRequest = makeRecipientViewRequest(args.envelopeArgs);

// Call the CreateRecipientView API
// Exceptions will be caught by the calling function
results = await envelopesApi.createRecipientView(args.accountId, envelopeId, {
  recipientViewRequest: viewRequest,
}, (error, data, response) => {
    const headers = response?.headers;

    const remaining = headers?.['x-ratelimit-remaining'];
    const reset = headers?.['x-ratelimit-reset'];

    if (remaining && reset) {
      const resetInstant = new Date(Number(reset) * 1000);

      console.log(`API calls remaining: ${remaining}`);
      console.log(`Next Reset: ${resetInstant.toISOString()}`);
    }
});
```

**`PHP`**

```php title="PHP"
$viewUrl = $clientService->getRecipientView($args['account_id'], $envelope_id, $recipient_view_request);
```

**`PowerShell`**

```text title="PowerShell"
Invoke-RestMethod `
    -Uri "${apiUri}/v2.1/accounts/${accountId}/envelopes/${envelopeId}/views/recipient" `
    -Method 'POST' `
    -Headers @{
    'Authorization' = "Bearer $oAuthAccessToken";
    'Content-Type'  = "application/json";
} `
    -Body $json `
    -OutFile $response

Write-Output "Response: $(Get-Content -Raw $response)"
$signingUrl = $(Get-Content $response | ConvertFrom-Json).url
```

**`Python`**

```python title="Python"
(results, status, headers) = envelope_api.create_recipient_view_with_http_info(
    account_id=args["account_id"],
    envelope_id=envelope_id,
    recipient_view_request=recipient_view_request
)

remaining = headers.get("X-RateLimit-Remaining")
reset = headers.get("X-RateLimit-Reset")

if remaining is not None and reset is not None:
    reset_date = dt.fromtimestamp(int(reset), tz=timezone.utc)
    print(f"API calls remaining: {remaining}")
    print(f"Next Reset: {reset_date}")
```

**`Ruby`**

```ruby title="Ruby"
results, _status, headers = envelope_api.create_recipient_view_with_http_info(args[:account_id], envelope_id, view_request)

remaining = headers['X-RateLimit-Remaining']
reset = headers['X-RateLimit-Reset']

if remaining && reset
  reset_date = Time.at(reset.to_i).utc
  puts "API calls remaining: #{remaining}"
  puts "Next Reset: #{reset_date}"
end

results.url
```

## Expected response

Use the return URL in the JSON response to start the embedded signing session in your browser. You will need to authenticate via SMS to sign the document and to view it when signing is complete.

## Next steps

* Run this code example from our [Quickstart](/docs/esign-rest-api/quickstart) or launcher projects:    [Bash](https://github.com/docusign/code-examples-bash), [C#](https://github.com/docusign/code-examples-csharp), [Java](https://github.com/docusign/code-examples-java), [Node.js](https://github.com/docusign/code-examples-node), [PHP](https://github.com/docusign/code-examples-php), [PowerShell](https://github.com/docusign/code-examples-powershell), [Python](https://github.com/docusign/code-examples-python), or [Ruby](https://github.com/docusign/code-examples-ruby).
* Learn more about [CFR Part 11 accounts](/docs/esign-rest-api/esign101/concepts/cfr-part-11-accounts).
* See how to [Go-Live](/docs/esign-rest-api/go-live) with a completed app and find the base path for API calls in the production environment.