Skip to main content
Blog
Home/

Trending Topics: Latest from our forums (March 2023)

Author Inbar Gazit
Inbar GazitSr. Manager, Developer Content and Advocacy
Summary3 min read

See how our most popular recent threads on Stack Overflow can help you solve your own development issues.

    • Additional resources

    Table of contents

    Here are some of the latest popular questions that the Docusign developers community asked on Stack Overflow in the month of March 2023. You too can ask questions by using the tag docusignapi in Stack Overflow.

    Thread: Why do all my Docusign calls return "Invalid UserId."?

    https://stackoverflow.com/questions/75678154/

    Summary: The developer is using the Docusign eSignature C# SDK and is getting an “Invalid UserId” error when trying to make API calls. They’re using JWT for authentication. 

    Answer: When using JWT, you must make sure that the userId (GUID) that you provide in the process of obtaining an access token (that user will be impersonated by the API) is correct. That means that this user is a member of the same account that you will later use to make API calls, and that the accountId (GUID) is for the account for which this user is a member. Also, be careful to not confuse the developer and production accounts, which have separate account and user numbers. After you authenticate, you can obtain the account number for the authenticated user using the code below (note that this code assumes the user is a member of a single account; if they are a member of multiple accounts, you would have to choose the one you want):

    string clientId = "**your-client-id**";
    string userId = "**your-user-id**";
    // demo site auth url: account-d.docusign.com
    // prod site auth url: account.docusign.com
    string oAuthBasePath = "account-d.docusign.com";                             
    DocuSignClient authClient = new DocuSignClient();
    
    var accessToken = authClient.RequestJWTUserToken(
         clientId,
         userId, 
         oAuthBasePath,
         System.IO.File.ReadAllBytes("privateKey.txt"),
         expiresInHours: 1,
         new List<string> { "signature", "impersonation" });
    
    // Use received access token to get user info and account            
    var userInfo = authClient.GetUserInfo(accessToken.access_token);
    var account = userInfo.Accounts.FirstOrDefault();

    Thread: Docusign C# SDK No API Response

    https://stackoverflow.com/questions/75688288/

    Summary: This developer is also using the C# SDK and JWT and is unable to complete API calls successfully. This is the code they wrote:

    var _apiClient = new DocuSignClient("https://demo.docusign.net/restapi");
    var privateKeyBytes = GetPrivateKeyBytes();
    var authToken = _apiClient.RequestJWTUserToken("integration_key", "user_id", "account-d.docusign.com", privateKeyBytes: privateKeyBytes, 1, new List<string> { "impersonation", "signature" });
    // authToken object returns correctly with access_token, calling _apiClient.GetUserInfo(authToken.access_token) will return a valid object as well.
    var envelopesAPI = new EnvelopesApi(_apiClient);
    // never gets past this line, constantly loads.
    Envelope env = envelopesAPI.GetEnvelope("api_account_id", "envelope_id");
    </string>
    

    Answer: The developer is missing the line that sets the HTTP header with the access token they received when they obtained it using the JWT authentication call. They need to add these two lines to their code:

    string access_token = authToken.access_token;
    apiClient.Configuration.DefaultHeader.Add("Authorization", "Bearer " + accessToken);
    
    

    Thread: Creating templates by using generated URL

    https://stackoverflow.com/questions/75665659/

    Summary: The developer wants the end users of their application to be able to author Docusign templates directly from their integration. They want the end users to be able to update documents and fields in the template, but not by doing it directly from the Docusign web app.

    Answer: Just as you can use embedded sending for envelopes, you can build an application that integrates the Docusign functionality that enables users to compose a template. This process requires three steps in your integration:

    1. Create a new template

    2. Generate and embed the template author view in your application

    3. Create an envelope from the template and send it

    Steps 1 and 3 above have detailed instructions and code examples in eight languages. Step 2 is similar to embedded signing, but requires a different endpoint to generate a template view. 

    Additional resources

    Author Inbar Gazit
    Inbar GazitSr. Manager, Developer Content and Advocacy

    Inbar Gazit has been with Docusign since 2013 in various engineering roles. Since 2019 he has focused on developer content and advocacy. Inbar works on code examples including the launchers, available on GitHub in eight languages, and helps build sample apps showcasing the various Docusign APIs. He is also active on Docusign Community and StackOverflow, answering your questions. Inbar can be reached at inbar.gazit@docusign.com.

    More posts from this author

    Related posts

    • Developers

      How to call the Navigator API from Agentforce for smarter agreements

      Author Paige Rossi
      Paige Rossi
      How to call the Navigator API from Agentforce for smarter agreements
    • Configuring Salesforce for scalable and secure Docusign integrations

      Author Achille Jean Axel Nisengwe
      Achille Jean Axel Nisengwe
      Configuring Salesforce for scalable and secure Docusign integrations
    • 2025 Developer Release 1: Build faster, agree smarter

      Author Amina Atlaf
      Amina Atlaf
      2025 Developer Release 1: Build faster, agree smarter

    How to call the Navigator API from Agentforce for smarter agreements

    Author Paige Rossi
    Paige Rossi
    How to call the Navigator API from Agentforce for smarter agreements

    Configuring Salesforce for scalable and secure Docusign integrations

    Author Achille Jean Axel Nisengwe
    Achille Jean Axel Nisengwe
    Configuring Salesforce for scalable and secure Docusign integrations

    2025 Developer Release 1: Build faster, agree smarter

    Author Amina Atlaf
    Amina Atlaf
    2025 Developer Release 1: Build faster, agree smarter

    Discover what's new with Docusign IAM or start with eSignature for free

    Explore Docusign IAMTry eSignature for Free
    Person smiling while presenting