Skip to navigation

Quickstart

View as Markdown

Welcome to the new Quickstart guide! Looking for the original Quickstart repo? Check out the Docusign code example launchers for setup instructions.

Make your first API call with Docusign

Authenticate with Docusign, create your first envelope, and send an agreement for remote signing via email in a single API call.

In this quickstart, you will obtain an OAuth access token, create an envelope containing a document and a signature field, and send it to your recipient’s email inbox. Choose Bash, C#, Java, Node.js, PHP, PowerShell, Python, or Ruby. Code examples for some languages use Docusign SDKs. The workflow uses OAuth 2.0 JWT Grant (Service Integration) in the developer environment.

An envelope contains the documents, recipients, and fields for a signature transaction.

Prerequisites

Create a developer account

Create a free Docusign developer account at https://www.docusign.com/developers/sandbox. Use this account to build and test in the developer environment.

Create and configure an integration key

An integration key, also called a client ID, identifies your application.

  1. Sign in to your developer account and open Apps and Keys.
  2. Select Add App and Integration Key, name your app, and create it.
  3. Copy the integration key.
  4. Under User Application, select + Add RSA Keypair. Download and save the private key as private.key.
  5. Under Additional settings, add a Redirect URI: https://developers.docusign.com and save your changes.

Grant one-time consent:

Open this URL in your browser once to authorize your integration key (replace {INTEGRATION_KEY} with your key):

https://account-d.docusign.com/oauth/auth?response_type=code&scope=signature%20impersonation&client_id={INTEGRATION_KEY}&redirect_uri=https://developers.docusign.com

Obtain your OAuth access token

To make the API call shown in this Quickstart, you need a valid OAuth access token. Docusign recommends three OAuth grant types: Public Authorization Code Grant, Confidential Authorization Code Grant, and JSON Web Token (JWT) Grant. Choose the grant type appropriate for your application and follow the authentication instructions to obtain a token. The SDK examples in this Quickstart use JWT Grant.

Install your language dependencies

Find your language below and complete its setup.

Use Bash with cURL 7.76 or later, jq, and base64. This example calls the REST API directly; no Docusign SDK is required. Save the authentication and API blocks in quickstart.sh.

Call the Docusign API: Send an envelope via email

Remote signing is Docusign’s core workflow: your application creates an envelope containing your document and signature fields, and Docusign delivers an email invitation to the recipient and guides them through signing.

Create and send the envelope in a single API call:

POST /v2.1/accounts/{accountId}/envelopes

Set status to sent in the request body to send the signing invitation. Select a language tab below to view its code example.

curl -s -X POST \
"https://demo.docusign.net/restapi/v2.1/accounts/{accountId}/envelopes" \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"emailSubject": "Please sign this document from Docusign Quickstart",
"status": "sent",
"documents": [
{
"documentBase64": "<BASE64_DOCUMENT_BYTES>",
"name": "Welcome Agreement",
"fileExtension": "txt",
"documentId": "1"
}
],
"recipients": {
"signers": [
{
"email": "alex.developer@example.com",
"name": "Alex Developer",
"recipientId": "1",
"routingOrder": "1",
"tabs": {
"signHereTabs": [
{
"documentId": "1",
"pageNumber": "1",
"recipientId": "1",
"xPosition": "150",
"yPosition": "150"
}
]
}
}
]
}
}'

Display the signing experience

Run your example

Run the script from your project directory:

bash quickstart.sh

Expected output

Output varies by language. A successful request returns an envelope ID and confirms that the envelope was sent. For example:

Success! Envelope sent. Envelope ID: e81b2f90-1c34-4b48-91ec-29b114d64293
An email invitation has been sent to alex.developer@example.com.

Review and sign

  1. Open the email inbox for your recipient.
  2. Open the email from Docusign (“Please sign this document from Docusign Quickstart”) and select Review Document.
  3. Complete the signature field and select Finish.
  4. In your Docusign Developer Account, go to Manage > Completed to view the completed agreement.

Troubleshoot common issues

  • consent_required error: You must grant consent once before your first JWT API call. Open the consent URL from the Prerequisites section in your browser, log in, and select Accept.
  • Private key not found: Verify that private.key is saved in your project folder and matches the RSA keypair generated in your Docusign Developer Account under Apps and Keys.
  • Invalid User ID or Account ID: In your developer account, navigate to Settings > Apps and Keys and confirm that your User ID (GUID) and API Account ID match the values in your script.
  • Email not received: Check your spam/junk folder. In the developer demo environment, emails are sent from dse_demo@docusign.net.

Next steps

  • Add Embedded (In-App) Signing: If your application requires users to sign directly inside your web app rather than via email, add a call to EnvelopeViews: createRecipient with a clientUserId. See the Embedded Signing Guide.
  • Set Up Webhooks (Docusign Connect): Configure webhooks to listen for real-time envelope status changes (e.g., completed, declined) on your server instead of relying solely on client-side browser events. Explore setup options in the Connect Webhooks guide.
  • Explore Full API Capabilities: Review the eSignature REST API Documentation to learn about additional features like bulk sending, templates, and supplemental documents.
  • Prepare for Production Deployment: Complete the Go-Live Process to promote your integration key from the sandbox environment to production, updating your redirect URIs and base URLs accordingly.