Chilkat Online Tools

Unicode C++ / DocuSign eSignature REST API / 1. Create Envelope

Back to Collection Items

void ChilkatSample(void)
    {
    json.UpdateString(L"documents[0].documentBase64",L"{{documentBase64}}");    json.UpdateInt(L"documents[0].documentId",123);    json.UpdateString(L"documents[0].fileExtension",L"pdf");    json.UpdateString(L"documents[0].name",L"document");    json.UpdateString(L"emailSubject",L"Simple Signing Example");    json.UpdateString(L"recipients.signers[0].email",L"{{email}}");    json.UpdateString(L"recipients.signers[0].name",L"{{name}}");    json.UpdateString(L"recipients.signers[0].recipientId",L"{{recipientId}}");    json.UpdateString(L"status",L"sent");    http.put_AuthToken(L"<access_token>");
    }

Curl Command

curl -X POST
	-H "Authorization: Bearer <access_token>"
	-H "Content-Type: application/json"
	-d '{
  "documents": [
    {
      "documentBase64": {{document}},
      "documentId": {{documentId}},
      "fileExtension": "pdf",
      "name": "document"
    }
  ],
  "emailSubject": "Simple Signing Example",
  "recipients": {
    "signers": [
      {
        "email": {{user1}},
        "name": {{user1_name}},
        "recipientId": "{{recipientId}}"
      }
    ]
  },
  "status": "sent"
}'
https://domain.com/{{apiVersion}}/accounts/{{accountId}}/envelopes

Postman Collection Item JSON

{
  "name": "1. Create Envelope",
  "event": [
    {
      "listen": "test",
      "script": {
        "exec": [
          "var jsonData = JSON.parse(responseBody);",
          "var envelopeId = jsonData.envelopeId;",
          "postman.setEnvironmentVariable(\"envelopeId\", envelopeId); ",
          ""
        ],
        "type": "text/javascript"
      }
    }
  ],
  "request": {
    "auth": {
      "type": "bearer",
      "bearer": [
        {
          "key": "token",
          "value": "{{accessToken}}",
          "type": "string"
        }
      ]
    },
    "method": "POST",
    "header": [
      {
        "key": "Content-Type",
        "value": "application/json",
        "type": "text"
      }
    ],
    "body": {
      "mode": "raw",
      "raw": "{\n  \"documents\": [\n    {\n      \"documentBase64\": {{document}},\n      \"documentId\": {{documentId}},\n      \"fileExtension\": \"pdf\",\n      \"name\": \"document\"\n    }\n  ],\n  \"emailSubject\": \"Simple Signing Example\",\n  \"recipients\": {\n    \"signers\": [\n      {\n        \"email\": {{user1}},\n        \"name\": {{user1_name}},\n        \"recipientId\": \"{{recipientId}}\"\n      }\n    ]\n  },\n  \"status\": \"sent\"\n}"
    },
    "url": {
      "raw": "{{baseUrl}}/{{apiVersion}}/accounts/{{accountId}}/envelopes",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "{{apiVersion}}",
        "accounts",
        "{{accountId}}",
        "envelopes"
      ]
    },
    "description": "This example is a very basic example of creating an evenlope with a document and a single signer. This evenlope does not specify a tab."
  },
  "response": [
  ]
}