> 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 with recipient information

> This topic demonstrates how to create an envelope in a workspace with the Workspaces API and send it with recipient information using the eSignature REST API.

This topic demonstrates how to create an envelope in a workspace with the [Workspaces API](/docs/workspaces-api) and send it with recipient information using the [eSignature REST API](/docs/esign-rest-api).

> **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), [PowerShell](https://github.com/docusign/code-examples-powershell).

## 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.                                                        |
| \{DOCUMENT_ID}          | A GUID value that identifies a document within a workspace. To return a list of your workspace document IDs, use the [WorkspaceDocuments: getWorkspaceDocuments](/docs/workspaces-api/reference/workspaces/workspacedocuments/getworkspacedocuments) method.                                                                                    |
| \{ESIGN_BASE_PATH}      | A string value that forms the root of the URL required to make calls to the eSignature REST API. 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. |
| \{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.                                                                                                                                                                                                                                                                                                 |
| \{WORKSPACES_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>` Where `<domain>` is `https://api-d.docusign.com/v1` for the developer environment and `https://api.docusign.com/v1` for production.                          |
| \{WORKSPACE_ID}         | A GUID value that identifies your workspace. To return a list of your workspace IDs, use the [Workspaces: getWorkspaces](/docs/workspaces-api/reference/workspaces/workspaces/getworkspaces) method.                                                                                                                                            |

## 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.

Wondering which grant type suits your integration? See [Authenticate](/platform/auth) for guidance on your options to get an OAuth token.

Workspaces OAuth access tokens are the same ones used for our eSignature REST API, although you must request the `signature` scope and one or more Workspaces scopes to call the Workspaces API.

> **Note**
>
> See [Workspaces authentication](/docs/workspaces-api/auth) for details and the full list of Workspaces scopes.

![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. Construct your API headers

After you have a valid OAuth access token, you are ready to construct the API headers. These same headers will be used for both API calls shown below. Construct your headers like this, but make sure to substitute your valid OAuth access token for \{ACCESS_TOKEN}.

> **Note**
>
> Although this how-to uses two different APIs, both accept the same access token and headers because the `signature` scope required by the eSignature REST API also applies to the Workspaces API.

**`Bash`**

```bash title="Bash"
declare -a Headers=('--header' "Authorization: Bearer ${ACCESS_TOKEN}" \
    '--header' "Accept: application/json" \
    '--header' "Content-Type: application/json")
```

**`C#`**

```csharp title="C#"
var client = CreateAuthenticatedClient(accessToken);
```

**`Java`**

```java title="Java"
private static IamClient createIamClient(String accessToken) {
    return IamClient.builder().accessToken(accessToken).build();
}
```

**`Node.js`**

```javascript title="Node.js"
const client = new iam.IamClient({ accessToken: args.accessToken });
```

**`PowerShell`**

```text title="PowerShell"
$headers = @{
    'Authorization' = "Bearer $accessToken";
    'Accept'        = 'application/json';
    'Content-Type'  = "application/json";
}
```

## Step 3. Construct the request body for a workspace envelope draft

Next, construct a request body for a workspace envelope draft. Set an `envelope_name` and insert the appropriate workspace document ID for \{DOCUMENT_ID}.

**`Bash`**

```bash title="Bash"
printf \
'{
    "envelope_name": "Example Workspace Envelope",
    "document_ids": ["'"${document_id}"'"]
}' >> $request_data
```

**`C#`**

```csharp title="C#"
var workspaceEnvelopeForCreate = new WorkspaceEnvelopeForCreate
{
    EnvelopeName = "Example Workspace Envelope",
    DocumentIds = new List<string> { documentId },
};
```

**`Java`**

```java title="Java"
var workspaceEnvelopeForCreate = new WorkspaceEnvelopeForCreate();
workspaceEnvelopeForCreate.withEnvelopeName(ENVELOPE_NAME);
workspaceEnvelopeForCreate.withDocumentIds(Arrays.asList(documentId));
```

**`Node.js`**

```javascript title="Node.js"
const workspaceEnvelopeForCreate = {
  envelopeName: 'Example Workspace Envelope',
  documentIds: [args.documentId],
};
```

**`PowerShell`**

```text title="PowerShell"
$body = @{
    "envelope_name" = "Example Workspace Envelope";
    "document_ids"  = @("${documentId}")
} | ConvertTo-Json
```

## Step 4. Call the Workspaces API

Now that you have constructed your API headers and request body, make a `POST` request to the [Workspaces: createWorkspaceEnvelope](/docs/workspaces-api/reference/workspaces/workspaces/createworkspaceenvelope) endpoint and include the request body to create a workspace envelope draft. Here’s how you make the call, but make sure to substitute your API account ID for `{API_ACCOUNT_ID}`, your workspaces base path for `{WORKSPACES_BASE_PATH}`, and the desired workspace ID for `{WORKSPACE_ID}`.

Save the `envelope_id` from the response; you’ll need it in Step 6 to update and send the envelope.

**`Bash`**

```bash title="Bash"
Status=$(curl -s -w "%{http_code}\n" -i \
     --request POST ${workspaces_base_path}/accounts/${account_id}/workspaces/${workspace_id}/envelopes \
    "${Headers[@]}" \
    --data-binary @${request_data} \
    --output ${response})
```

**`C#`**

```csharp title="C#"
return await client.Workspaces.Workspaces.CreateWorkspaceEnvelopeAsync(
    accountId,
    workspaceId,
    workspaceEnvelopeForCreate);
```

**`Java`**

```java title="Java"
return createIamClient(accessToken)
    .workspaces()
    .workspaces()
    .createWorkspaceEnvelope()
    .accountId(accountId)
    .workspaceId(workspaceId)
    .workspaceEnvelopeForCreate(workspaceEnvelopeForCreate)
    .call();
```

**`Node.js`**

```javascript title="Node.js"
return await client.workspaces1.workspaces.createWorkspaceEnvelope({
  accountId: args.accountId,
  workspaceId: args.workspaceId,
  workspaceEnvelopeForCreate
});
```

**`PowerShell`**

```text title="PowerShell"
$response = $(Invoke-WebRequest `
    -Uri "${apiUri}/accounts/${accountId}/workspaces/${workspaceId}/envelopes" `
    -Method 'POST' `
    -headers $headers `
    -body $body)
```

## Step 5. Construct the request body to update and send the envelope

Now that you have created an envelope that is associated with a workspace, use the eSignature REST API to update the envelope with tabs and recipient information. Set the [status](/docs/esign-rest-api/reference/envelopes/envelopes/liststatus) to `sent` to send the envelope.

**`Bash`**

```bash title="Bash"
printf \
'{
    "emailSubject": "Please sign this document",
    "recipients": {
        "signers": [
            {
                "email": "'"${SIGNER_EMAIL}"'",
                "name": "'"${SIGNER_NAME}"'",
                "recipientId": "1",
                "routingOrder": "1",
                "tabs": {
                    "signHereTabs": [
                        {
                            "anchorString": "/sn1/",
                            "anchorUnits": "pixels",
                            "anchorXOffset": "20",
                            "anchorYOffset": "10"
                        }
                    ]
                }
            }
        ]
    },
    "status": "sent"
}' >> $request_data
```

**`C#`**

```csharp title="C#"
private static EnvelopeDefinition MakeEnvelope(string signerEmail, string signerName)
{
    var signHere = new SignHere
    {
        AnchorString = "/sn1/",
        AnchorUnits = "pixels",
        AnchorXOffset = "20",
        AnchorYOffset = "10",
    };

    var tabs = new Tabs
    {
        SignHereTabs = new List<SignHere> { signHere },
    };

    var signer = new Signer
    {
        Email = signerEmail,
        Name = signerName,
        RecipientId = "1",
        RoutingOrder = "1",
        Tabs = tabs,
    };

    var recipients = new Recipients
    {
        Signers = new List<Signer> { signer },
    };

    var envelopeDefinition = new EnvelopeDefinition
    {
        EmailSubject = "Please sign this document",
        Recipients = recipients,
        Status = "sent",
    };

    return envelopeDefinition;
}
```

**`Java`**

```java title="Java"
private static Envelope makeEnvelope(
    String signerEmail,
    String signerName
) {
    var signerTabs = EnvelopeHelpers.createSignerTabs(EnvelopeHelpers.createSignHere(ANCHOR_STRING, ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X));

    var signer = new Signer();
    signer.setEmail(signerEmail);
    signer.setName(signerName);
    signer.setRecipientId("1");
    signer.setRoutingOrder("1");
    signer.setTabs(signerTabs);

    var envelope = new Envelope();
    envelope.setRecipients(EnvelopeHelpers.createSingleRecipient(signer));
    envelope.setEmailSubject(EMAIL_SUBJECT);
    envelope.setStatus("sent");

    return envelope;
}
```

**`Node.js`**

```javascript title="Node.js"
const signHereTab = docusign.SignHere.constructFromObject({
  anchorString: '/sn1/',
  anchorUnits: 'pixels',
  anchorXOffset: '20',
  anchorYOffset: '10'
});

const tabs = docusign.Tabs.constructFromObject({
  signHereTabs: [signHereTab]
});

const signer = docusign.Signer.constructFromObject({
  email: args.signerEmail,
  name: args.signerName,
  recipientId: '1',
  routingOrder: '1',
  tabs,
});

const recipients = docusign.Recipients.constructFromObject({
  signers: [signer]
});

const envelopeDefinition = docusign.EnvelopeDefinition.constructFromObject({
  emailSubject: 'Please sign this document',
  recipients,
  status: 'sent',
});

return envelopeDefinition;
```

**`PowerShell`**

```text title="PowerShell"
$body = @{
    emailSubject = "Please sign this document";
    recipients   = @{
        signers  = @(
            @{
                email        = $variables.SIGNER_EMAIL;
                name         = $variables.SIGNER_NAME;
                recipientId  = "1";
                routingOrder = "1";
                tabs         = @{
                    signHereTabs = @(
                        @{
                            anchorString  = "/sn1/";
                            anchorUnits   = "pixels";
                            anchorXOffset = "20";
                            anchorYOffset = "10";
                        };
                    );
                };
            };
        );
    };
    status = "sent";
} | ConvertTo-Json -Depth 32
```

## Step 6. Call the eSignature REST API

Make a `PUT` request to the [Envelopes:update](/docs/esign-rest-api/reference/envelopes/envelopes/update) endpoint and include the request body to send the workspace envelope with recipient information. Here’s how you make the call, but make sure to substitute your API account ID for `{API_ACCOUNT_ID}`, your eSignature base path for `{ESIGN_BASE_PATH}`, and the envelope ID saved from step 4 for the `{envelope_id}`.

> **Note**
>
> View the source code for this how-to on GitHub: [Bash](https://github.com/docusign/code-examples-bash/blob/master/examples/Workspaces/eg003SendEnvelopeWithRecipientInfo.sh), [C#](https://github.com/docusign/code-examples-csharp/blob/master/launcher-csharp/Workspaces/Examples/SendEnvelopeWithRecipientInfo.cs), [Java](https://github.com/docusign/code-examples-java/blob/master/src/main/java/com/docusign/controller/workspaces/examples/Work003SendEnvelopeWithRecipientController.java), [Node.js](https://github.com/docusign/code-examples-node/blob/master/lib/workspaces/examples/sendEnvelopeWithRecipientInfo.js), [PowerShell](https://github.com/docusign/code-examples-powershell/blob/master/examples/Workspaces/eg003SendEnvelopeWithRecipientInfo.ps1)

**`Bash`**

```bash title="Bash"
Status=$(curl -s -o "${response}" -w "%{http_code}" \
  --request PUT "${esign_base_path}/v2.1/accounts/${account_id}/envelopes/${envelope_id}" \
  "${Headers[@]}" \
  --data-binary @"${request_data}")
```

**`C#`**

```csharp title="C#"
public static async Task<EnvelopeUpdateSummary> SendEnvelopeAsync(
    string basePath,
    string accessToken,
    string accountId,
    string envelopeId,
    string signerEmail,
    string signerName)
{
    var apiClient = new eSign.Client.DocuSignClient(basePath);
    apiClient.Configuration.DefaultHeader.Add("Authorization", "Bearer " + accessToken);

    var envelopesApi = new EnvelopesApi(apiClient);
    var envelope = MakeEnvelope(signerEmail, signerName);

    return await envelopesApi.UpdateAsync(
        accountId,
        envelopeId,
        new Envelope
        {
            EnvelopeId = envelopeId,
            Status = envelope.Status,
            Recipients = envelope.Recipients,
        });
}
```

**`Java`**

```java title="Java"
public static EnvelopeUpdateSummary sendEnvelope(
    String accessToken,
    String basePath,
    String accountId,
    String envelopeId,
    String signerEmail,
    String signerName
) throws ApiException {
    var client = new ApiClient(basePath);
    client.addDefaultHeader(HttpHeaders.AUTHORIZATION, "Bearer " + accessToken);
    var envelopesApi = new EnvelopesApi(client);

    var envelope = makeEnvelope(signerEmail, signerName);

    return envelopesApi.update(accountId, envelopeId, envelope);
}
```

**`Node.js`**

```javascript title="Node.js"
return await envelopesApi.update(args.accountId, args.envelopeId, { envelope });
```

**`PowerShell`**

```text title="PowerShell"
$response = $(Invoke-WebRequest `
    -Uri "${apiUri}/v2.1/accounts/${accountId}/envelopes/${envelopeId}" `
    -Method 'PUT' `
    -headers $headers `
    -body $body)
```

## Expected response

If you run this code example from our Quickstart or launcher projects, you should see a JSON response similar to the code shown.

In addition, envelope recipients are automatically granted [Participate](/docs/workspaces-api/reference/workspaces/workspaces/createworkspaceenvelope) access to the workspace and will receive consolidated email updates from Docusign Workspaces.

**`Sample response`**

```json title="Sample response"
{
  "envelopeId": "6a1ded37-xxxx-xxxx-xxxx-f081d428807d",
  "recipientUpdateResults": [
    {
      "recipientId": "1"
    }
  ],
  "tabUpdateResults": {
    "signHereTabs": [
      {
        "isSealSignTab": "false",
        "scaleValue": "0",
        "optional": "false",
        "documentId": "2xxxx1",
        "recipientId": "1",
        "pageNumber": "1",
        "xPosition": "205",
        "yPosition": "175",
        "width": "0",
        "height": "0",
        "anchorString": "/sn1/",
        "anchorXOffset": "20",
        "anchorYOffset": "10",
        "anchorUnits": "pixels",
        "anchorCaseSensitive": "false",
        "anchorMatchWholeWord": "true",
        "anchorHorizontalAlignment": "left",
        "anchorTabProcessorVersion": "v1_3",
        "tabId": "c8f72abd-xxxx-xxxx-xxxx-9d525531ad4a",
        "tabType": "signhere"
      }
    ]
  }
}
```

## 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), [PowerShell](https://github.com/docusign/code-examples-powershell).
* Learn [How to create a workspace](/docs/workspaces-api/how-to/create-workspace).
* Learn [How to add a document to workspace](/docs/workspaces-api/how-to/add-a-document).
* See how to [Go-Live](/docs/workspaces-api/go-live) with a completed app.