# Docusign

### Important connection properties <a href="#important-connection-properties" id="important-connection-properties"></a>

UseSandbox\
UseSandbox indicates whether the current user account is sandbox or not. This is false by default. Set to true if you are using a sandbox account. All the OAuth flows documented below assume that you have set UseSandbox beforehand.

AccountId\
AccountId is an optional connection property. It sets automatically after the authentication succeeds. As an alternative, you can manually set it in the connection string if you have access to multiple Account Ids.&#x20;

### Authenticating to DocuSign <a href="#authenticating-to-docusign" id="authenticating-to-docusign"></a>

DocuSign uses the OAuth authentication standard. To authenticate using OAuth, you must create a custom app to obtain the OAuthClientId, OAuthClientSecret, and CallbackURL connection properties.

#### Create a Custom OAuth App

Register your DocuSign application on Admin panel > Integrations > API and Keys to obtain the following connection properties:

* OAuthClientId: Set this to the Integrator Key assigned when you registered your application.
* OAuthClientSecret: Set this to the Secret Key assigned when you registered your application.
* Setting the Redirect URI:
  * For desktop applications, set Redirect URI to [http://localhost:portnumber](https://docs.appstrategy.com/apprules-r-documentation/platform/platform-features/system-settings/data-sources/connection-settings/electronic-signature/http:/localhost:portnumber) and set the CallbackURL property to match. You can specify any port available.
  * For web applications, set the Redirect URI to a page on your website where you would like the user to be returned after the user grants permissions to your application.
  * For headless machines, set the Redirect URI to [http://localhost:portnumber](https://docs.appstrategy.com/apprules-r-documentation/platform/platform-features/system-settings/data-sources/connection-settings/electronic-signature/http:/localhost:portnumber). You can use any available port.

After setting the following, you are ready to connect:

* OAuthClientId: Set this to the Integrator Key assigned when you registered your app.
* OAuthClientSecret: Set this to the Secret Key assigned when you registered your app.
* CallbackURL: Set this to the redirect URI defined when you registered your app.
* InitiateOAuth: Set this to GETANDREFRESH. You can use InitiateOAuth to avoid repeating the OAuth exchange and manually setting the OAuthAccessToken.

When you connect the provider opens the OAuth endpoint in your default browser. Log in and grant permissions to the application. The provider then completes the OAuth process:

1. Extracts the access token from the callback URL and authenticates requests.
2. Refreshes the access token when it expires.
3. Saves OAuth values in OAuthSettingsLocation to be persisted across connections.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.appstrategy.com/apprules-r-documentation/platform/platform-features/system-settings/data-sources/connection-settings/electronic-signature/docusign.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
