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.
Run this code example from our Quickstart or launcher projects: Bash, C#, Java, Node.js, PowerShell.
Required data
Running the code in this how-to requires this data:
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 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.
See Workspaces authentication for details and the full list of Workspaces scopes.
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}.
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.
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}.
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 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.
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 to sent to send the envelope.
Step 6. Call the eSignature REST API
Make a PUT request to the 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}.
View the source code for this how-to on GitHub: Bash, C#, Java, Node.js, PowerShell
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 access to the workspace and will receive consolidated email updates from Docusign Workspaces.
Next steps
- Run this code example from our Quickstart or launcher projects: Bash, PowerShell.
- Learn How to create a workspace.
- Learn How to add a document to workspace.
- See how to Go-Live with a completed app.