Skip to navigation

Single-page applications and CORS

View as Markdown
eSignature REST API 2.1 only

Developers can build Docusign integrations as single-page applications (SPAs) that run in a web browser. Because SPA integrations launch API requests from scripts that run on a web page, the requests are subject to browser security restrictions. To address this, Docusign supports Cross-Origin Resource Sharing (CORS), which enables SPAs to meet browser security requirements and send requests directly to Docusign.

By enabling SPAs to communicate directly with Docusign, CORS support makes SPAs easier and less costly to build, as no web server or proxy server is needed for routing API calls. Eliminating these components also improves SPA performance. CORS can be used with SPAs running scripts written in JavaScript and in any framework, including React, Vue.js, Angular, and jQuery.

CORS support is included with all demo and production accounts that have eSignature REST API access. CORS is not supported with FedRAMP or IL4 accounts.

Supported API, version, and endpoints

The eSignature REST API v2.1 supports CORS. You can use CORS with all eSignature endpoints that have an account ID in the path. The following eSignature categories, resources, and endpoints do not include the account ID, and as a result, do not support CORS:

Requirements for an app to use CORS

To use CORS, an app must meet the following requirements:

Configure apps for CORS

CORS configuration settings appear at two levels in the eSignature web app. Your role determines the settings to which you have access:

Docusign checks the settings at both levels when determining whether to accept a CORS request.

You may have access to both the account-level settings and the app-level CORS configuration parameters. If you do not, keep the following in mind:

  • Application owners, partners, and ISVs: To use your app, your users must grant consent to it, and their account administrator must enable CORS. If a user’s account administrator has not enabled CORS and your app makes CORS requests while authenticated as that user, Docusign will return an error. Your user’s account administrator can enable CORS for all apps or for just your app.
  • Account administrators: If you choose not to enable CORS by default, Docusign will reject CORS requests from apps that have authenticated as a user in your account. If you want Docusign to accept CORS requests under your account from specific apps, update the account-level settings.

With CORS enabled, both CORS and non-CORS requests can be made under an app’s integration key. For example, an SPA can send CORS requests and a client-server integration can send non-CORS requests using the same integration key. If CORS requests are disabled, an app can still make non-CORS requests under that integration key.

Include required scopes during authentication

To send CORS API requests to Docusign, an app must first authenticate using one of these supported OAuth methods:

  1. Authenticating the user on whose behalf the app will make API requests. During this step, the app directs a user’s browser to an authorization URI. This URI must include one or more authentication scopes that specify permitted sets of actions. For an eSignature REST API integration that uses CORS, include the following in the scope parameter of the authorization URI:

    • signature: The basic scope for most eSignature endpoints

    • cors: The scope required to send CORS requests

      As part of the OAuth flow, Docusign will show the user a consent screen if that user has not previously granted consent for the application and its scopes.

      Note: This step does not use CORS for Implicit Grant authentication. It does use CORS for authentication via Public Authorization Code Grant.

  2. Calling the UserInfo endpoint to obtain account information. This endpoint supports CORS.

The result of the authentication process is an access token that the SPA will use to make eSignature API calls. For details about this process, see How to get an access token using Public Authorization Code Grant or How to get an access token with Implicit Grant.

Error responses

Docusign returns a 403 Forbidden error or a 400 Bad Request error in response to CORS requests that cannot be completed. See CORS error responses for more information.

Next steps

For more information about how to implement CORS with an SPA, see:

For information about enabling and configuring CORS, see:

For information about authentication and consent, see:

For information about CORS errors and troubleshooting, see CORS error responses.