> 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 send an envelope to an In Person Signer

> In Person Signing allows a host to facilitate a Docusign session for a signer who is physically in the same location as them.

This topic demonstrates how to host an [In Person Signing](https://support.docusign.com/s/document-item?rsc_301\&bundleId=gav1643676262430\&topicId=hak1578456316043.html) session. In Person Signing allows a host to facilitate a Docusign session for a signer who is physically in the same location as them.

## Prerequisites

1. Install the [Docusign eSignature for Salesforce](/docs/salesforce/how-to/apex-toolkit-install)  managed package.
2. Create a subdomain for your Salesforce organization by enabling "My Domain."
3. Select the **Docusign Setup** tab and complete the login step.
4. Create a template in your Docusign account. The template should have one In Person Signer with the role “Customer.” Add a document. See the image below.

   ![A screenshot of the template configuration for the example](/_fern-files/_img/5a1aeafa46fef481f182536014abf7b1c0c54f4a14bdc4b4b9fcac95db3f1dde.webp)

## Required data

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

| Data element              | Description                                                                                                                                                                                                                                                                                              |
| ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| \{HOST_EMAIL}             | A string value for the email address associated with the account which will host an In Person Signer. This value must exactly match (case-sensitive) the value shown in the host’s [account profile](https://admindemo.docusign.com/authenticate?goTo=accountProfile).                                   |
| \{HOST_NAME}              | A string value for the name associated with the account which will host an In Person Signer. This value must exactly match (case-sensitive) the value shown in the host’s [account profile](https://admindemo.docusign.com/authenticate?goTo=accountProfile).                                            |
| \{IN_PERSON_SIGNER_EMAIL} | A string value for the email address of the [In Person Signer](https://support.docusign.com/s/document-item?rsc_301\&bundleId=gav1643676262430\&topicId=hak1578456316043.html).                                                                                                                          |
| \{IN_PERSON_SIGNER_NAME}  | A string value for the name of the [In Person Signer](https://support.docusign.com/s/document-item?rsc_301\&bundleId=gav1643676262430\&topicId=hak1578456316043.html).                                                                                                                                   |
| \{OPPORTUNITY_NAME}       | The name of the Opportunity that will be used as the source object for the envelope. Set the name to “My Opportunity” for this example.                                                                                                                                                                  |
| \{TEMPLATE_ID}            | A [GUID](http://guid.one/) value that identifies a Docusign [template](/docs/esign-rest-api/esign101/concepts/templates) that is used to create a Docusign [envelope](/docs/esign-rest-api/esign101/concepts/envelopes). This value is automatically generated by Docusign when the template is created. |
| \{TEMPLATE_NAME}          | The template name should be set to "Example In Person Signer template" for this example.                                                                                                                                                                                                                 |

## Step 1. Define your class and method

Create the class and method that will contain the code in this example. You can skip this step if you are adding this code to an existing class.

**`Apex`**

```java title="Apex"
public class InPersonSigningController {
     public static Id sendWithInPerson(){
    }
}
```

## Step 2. Create an envelope

First, get the ID of an Opportunity in your Salesforce org. Then create an empty [dfsle.Envelope](/docs/salesforce/apex-toolkit-reference/envelope.html) object using this Opportunity ID as the source ID.

**`Apex`**

```java title="Apex"
//Get the Salesforce account ID
Opportunity myOpportunity = [SELECT Id FROM Opportunity WHERE Name = 'My Opportunity' LIMIT 1];
// Create an empty envelope with Opportunity Id as the source Id
dfsle.Envelope myEnvelope = dfsle.EnvelopeService.getEmptyEnvelope(new dfsle.Entity(myOpportunity.Id));
```

## Step 3. Create an In Person Signer recipient

Create a new [dfsle.Recipient](/docs/salesforce/apex-toolkit-reference/recipient.html) object for the In Person Signer. Set the recipient’s type to `inPersonSigner`.

Make sure that the role for the signer matches the role in your template. In this case the template has one recipient: an In Person Signer with the role `Customer`. Add the recipient to the envelope with the [withRecipients](/docs/salesforce/apex-toolkit-reference/envelope.html) method.

**`Apex`**

```java title="Apex"
dfsle.Recipient InPerson = new dfsle.Recipient(
    null, //Source Id
    'inPersonSigner',//Type of recipient
    1, //Sequence
    2, //routing order
    new dfsle.Recipient.Role('Customer',null), //role -used to match role
    //on template if using a template
    'InPerson Signer', //inPerson Recipient name
    'example@example.com', //inPerson Recipient Email
    null, //signing group
    null, //phone
    //Don't need recipient auth for embedded in SF cause you have SF auth
    //new dfsle.Recipient.Authentication(null, true, new List<String>{'147852369'}),//Authentication - may need to adjust this - can be null
    null,//no Authentication
    null, //note
    null, //EmailSettings
    'Host Name', //host name This is the name of the host for InPerson
    'host@example.com', //host email email of host
    true, //sign now
    null, //source
    false, //read only
    false); //required
    // add Recipient to the Envelope
    myEnvelope = myEnvelope.withRecipients(new List<dfsle.Recipient> { InPerson });
```

## Step 4. Create a document from a template

Create a `Document` object using the [dfsle.Document.fromTemplate](/docs/salesforce/apex-toolkit-reference/document.html) method. Pass the ID of a template in your Docusign account. Then use the [dfsle.Envelope.withDocuments](/docs/salesforce/apex-toolkit-reference/envelope.html) method to add the document to your envelope.

**`Apex`**

```java title="Apex"
// myTemplateId contains the DocuSign Id of the DocuSign Template
dfsle.UUID myTemplateId = dfsle.UUID.parse('801c741b-xxxx-xxxx-xxxx-23a050e0dd51');
// Create a new document for the Envelope
dfsle.Document myDocument = dfsle.Document.fromTemplate(
    myTemplateId, // templateId in dfsle.UUID format
    'myTemplate'); // Name of the template

myEnvelope = myEnvelope.withDocuments(new List<dfsle.Document> { myDocument });
```

## Step 5. Send the envelope

Use the [dfsle.EnvelopeService.sendEnvelope](/docs/salesforce/apex-toolkit-reference/envelopeservice.html) method to send the envelope.

**`Apex`**

```java title="Apex"
// Send the envelope
myEnvelope = dfsle.EnvelopeService.sendEnvelope(
    myEnvelope, // The envelope to send
    true); // Send or Draft

System.debug(myEnvelope.Id);
return myEnvelope.Id;
```

## Step 6. Execute your method

To execute your code, go to the [Developer Console](https://help.salesforce.com/s/articleView?language=en_US\&id=sf.code_dev_console.htm\&type=5) in Salesforce, open the **Debug** menu, then select **Open Execute Anonymous Window**. Type the accompanying code in the window and select **Execute**.

> **Note**
>
> View the source code for this how-to on GitHub: [Apex](https://github.com/docusign/code-examples-apex/blob/master/force-app/main/default/classes/InPersonSigningController.cls)

**`Apex`**

```java title="Apex"
InPersonSigningController.sendWithInPerson();
```

## Expected response

If your API call is successful, the envelope will be sent to the host’s email with a message asking them to host the In-Person Signing session. The email will direct them to the screen shown.

After choosing **Start**, they can hand the device to the In Person Signer to sign the document. Then the host can complete the signing session per the listed steps.

![Instructions for in person signing](/_fern-files/_img/8fb93108f15e539cbab9d25141556843ba818b866979232110b744e026c824e2.webp)

## Next steps

* See all available Apex Toolkit [How-to guides](/docs/salesforce/how-to).
* Learn [How to send an envelope with tabs](/docs/salesforce/how-to/send-envelope-with-tabs).
* See [How to perform unit testing](/docs/salesforce/how-to/unit-testing) to ensure that you have adequate code coverage.