docusignapi

‘Object reference not set to an instance of an object’ Docusign create envelope REST API


I am working on creating an envelope using API explorer in developers.docusign.com.

I am able to send the document if I am not attaching any tabs to the document.

However I am getting the below error if I am attaching tabs to the document. I have updated the url and body of my API call.

Error message

{
  "message": "Bad Request",
  "response": {
    "errorCode": "UNSPECIFIED_ERROR",
    "message": "Object reference not set to an instance of an object."
  }
}

URL:

/restapi/v2.1/accounts/<accountId>/envelopes

Body:

{
  "documents": [
    {
      "documentBase64": "<base64ForTheDocument>",
      "documentId": "1",
      "fileExtension": "pdf",
      "name": "document",
      "tabs": {
        "signHereTabs": [
          {
            "anchorString": "Signature:",
            "documentId": "1",
            "anchorXOffset": "1",
            "anchorYOffset": "0",
            "anchorIgnoreIfNotPresent": "True",
            "anchorUnits": "inches"
          }
        ]
      }
    }
  ],
  "recipients": {
    "signers": [
      {
        "email": "<email>",
        "name": "Kapil",
        "recipientId": "1"
      }
    ]
  },
  "status": "sent",
  "emailSubject": "Docusign developer account"
}

Solution

  • The tabs object is set incorrectly. It needs to reside under the recipient. Take a look at the example here.