authentication failure when sending envelope - docusignapi

I'm working on a DocuSign implementation that sends envelopes based on templates. For this I have to manually write my requests since our framework is incompatible with the provided Java SDK. Unfortunately, I am running into an error when actually attempting to send the envelope.
Our application impersonates another user since it will run on a server, the entire authentication flow seems to work (I got it working to the point where I have a JWT for the API)
In order to create a new envelope I use the following request body:
POST /v2.1/accounts/<accountId>/envelopes/ HTTP/1.1
Host: https://demo.docusign.net/restapi
Authentication: Bearer eyJ0e.....
Content-Type: application/json
{
"recipients": {
"signers": [
{
"email": "user#example.com",
"name": "John Doe",
"roleName": "Representative 1",
"tabs": {
"textTabs": [
{
"tabLabel": "testLabel",
"value": "this is a pre-filled label"
}
]
}
}
]
},
"status": "created",
"templateId": "ba0ddc8e-648e-41f7-b4e5-56abf0073c8a"
}
I think this request is valid and complies with what I've found in the documentation. However, after sending it, I receive the following response:
{
"errorCode": "PARTNER_AUTHENTICATION_FAILED",
"message": "The specified Integrator Key was not found or is disabled. An Integrator key was not specified."
}
This makes me believe that I am using an incorrect integrator key, but I triple checked and the integrator key I am using matches the one I can see in the DocuSign admin panel.
What can I do to make this request work?
Thanks.

If you're getting "An integrator key was not specified", then the issue is likely that DocuSign isn't seeing your Authorization header, or it's not able to interpret it correctly.
In looking at the headers of your call, it looks like you're incorrectly using Authentication when you should be using Authorization

Related

Docusign send documents to sign to our clients via our plateform

I studied the different authentication methods and i found that the JWT grant method is the best suited for our plateform. We need to send envelope to our clients which will subscribe to our website with any email from any domain. We purchase the plan : basic api plan, Site: NA3-EU1.
example 1:
our domain is for example : domain-a.com
sender : hello#domain-a.com
receiver : martin#gmail.com
example 2 :
sender: hello#domain-a.com
receiver:jean#domain-b.us
our goal is to be able to send automatically, when registering our client "martin#gmail.com" in our platform an email to sign documents. Once signed by martin#gmail.com ... we download the signed document.
Is the JWT grant flow is the best method for our case ? Please if possible provide an example.
You are correct. It sounds like you don't need to have individual users authenticate themselves, so JWT grant flow is the right way to go.
After reviewing this authentication guide on JWT, you should check out the language-specific code examples linked on that page.
Now, on to your use case... It looks to me like your clients will receive a very similar template. With Docusign, you can create a template of documents, roles, and tabs and send that template to each new client.
Here's an example that demonstrates how to create and send an envelope that contains a template. The template is set up to expect two recipients, one signer and one carbon copy. There is also a "note" tab assigned to the signer, which I've prepopulated with his physicalAddress
POST /envelopes
{
"status": "sent",
"templateId": "00df08bf-xxxx-xxxx-xxxx-ecaa2360c121",
"templateRoles": [
{
"email": "test#test.com",
"name": "Test User",
"roleName": "signer",
"routingOrder": "1",
"tabs": {
"note": [
{
"tabLabel": "physicalAddress",
"value": "221 Main St. San Francisco, CA"
}
]
}
},
{
"email": "test2#test.com",
"name": "Another user",
"roleName": "cc",
"routingOrder": "2"
}
]
}

DocuSign API - Retrieve Envelope JSON for Envelope Sent via Admin Page

I'm using the Envelopes: create API in the sandbox to send signing requests successfully. I'm now working on one that involves DocuSign Templates and two template roles, so that each recipient should only complete their own fields for name, date and signature.
This is working fine when using the DocuSign Admin webpage to send these, but with my API request, the first recipient/role can fill in all fields for both recipients.
I'm obviously doing something wrong here and was wondering if I can somehow view/retrieve the JSON data for the envelopes that are not sent via the API but using the DocuSign admin webpage.
For example I'm after the following data so I can compare this to my request:
{
"accountId": "301424",
"emailSubject": "API Example - Populating Data in Templates",
"templateId": "44D9E888-3D86-4186-8EE9-7071BC87A0DA",
"templateRoles": [{
"email": "john.doe#email.com",
"name": "John Doe",
"roleName": "Customer",
"tabs": {
"textTabs": [{
"tabLabel": "CustomerAddress",
"value": "123 Main St. San Francisco, CA 94105"
},
{
"tabLabel": "CustomerSSN",
"value": "12-345-6789"
}]
}
}],
"status": "sent"
}
Is it possible, knowing the Envelope ID, to retrieve the JSON that was used to generate the Envelope/signing request?
You can see the requests that the DocuSign web tool made to create your envelope by using the API request logging feature. However, the web tool often uses multiple API calls to create an envelope. You can do the same, or coalesce the multiple calls into one.
If you ask a new question and supply the JSON that you're using, we may be able to spot your mistake directly.
For example, are you using two different email addresses for your two template roles in your test?
Do you have the tabs/fields set so they can only be modified by the specific recipient?
Are you creating the template programmatically or are you using the DocuSign web tool to create the template?

User Authentication Failed on CreateEnvelope

I encountered a new issue today when I tried to send a request with my new production account and the integrator key, newly promoted to Live status.
The API login succeeded, and it returns my AccountID.
However, when I try to create an envelope with envelopesApi.CreateEnvelope API call, I received the following error.
I tested the code with my demo account and key, couple of days ago. It was working fine. I think it is related to the key, because the login request was succeed.
DocuSign.eSign.Client.ApiException: 'Error calling CreateEnvelope: {
"errorCode": "USER_AUTHENTICATION_FAILED",
"message": "One or both of Username and Password are invalid."
}
Please let me know if there is anything else I need to do.
Often when the USER_AUTHENTICATION_FAILED error is received and you are positive the correct user/pwd combo is being provided it's because of the wrong account endpoint being accessed.
You need to parse sub-domain of the baseUrl that is returned from the Login API (property is called base_uri if using OAuth2) and configure your api client with that sub-domain.
When testing in demo it's ok if you miss this step since all accounts are under the demo.docusign.net sub-domain, however in production there are multiple sub-domains (ie. www, na2, eu, etc) so you need to re-configure once right after authentication.
Example:
The response to the Authentication: login API looks like:
{
"loginAccounts": [
{
"accountId": "123456",
"baseUrl": "https://na2.docusign.net/restapi/v2/accounts/123456",
"email": "jdoe#example.com",
"isDefault": "true",
"name": "LoanCo",
"siteDescription": "",
"userId": "abcdff66-f92e-4e8e-ab81-8c46f140",
"userName": "John Doe"
}
]
}
Then instantiate a new API client using the sub-domain that was returned in the login response:
ApiClient apiClient = new ApiClient("https://na2.docusign.net");

How to map each DocuSign request to envelopeId

I am trying to implement a DocuSign API app to send documents to our clients for e-signature. In my application, I need to send one document to each client for e-signature. For example, an agreement doc where user will sign and agree to our terms and conditions.
So I will be sending the same document to each client and I assume I will be receiving a unique envelopeId for each individual request.
So how do you keep track of which envelopeId is associated with which user?
Can you send a custom tag in the request and receive it back in response to track it?
Most DocuSign users build a fully functional integration.
Integration such as Salesforce, CRM and other products that integrate DocuSign into their system track it either through an Envelope Custom Field (with their internal application record information) or they document the envelopeId responses and store them in their application.
Either way will work out just the same, it's all on how you want your integration to work.
Here is a quick sample call on how to create an envelope from a template with a text custom field
{
"emailSubject": "Just a test envelope",
"status": "sent",
"customFields": {
"textCustomFields": [
{
"name": "InternalToolNumber",
"required": true,
"show": false,
"value": 123456789
}
]
},
"templateId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"templateRoles": [
{
"email": "john.doe#emaildomain.com",
"name": "John Doe",
"roleName": "Signer 1"
}
]
}

Using the docusign api c# access code for authentication of signer

Using the sample C# send document API call, how can I send a data element located in my system, such as zip code or last 4 of ssn, to be enable this as an access code to view the document? This way I know that the person signing has another level of authentication tat ties back to the signer.
Have you read through the DocuSign API documentation yet? Just add the accessCode property to your signer JSON object and give it a value. Basically, something like this:
"recipients":
{
"signers": [
{
"email": "test_1#email.com",
"name": "Name 1",
"accessCode": "1234",
...
Description from API docs:
"This Optional element specifies the access code a recipient has to enter to validate their identity. This can be a maximum of 50 characters."

Resources