This topic will walk you through the process to create and send a package using the Conga Sign API.

In this example a minimum payload is used, where two signers, one document, and one signature per signer are added to the package. 

For a complete description of each field and other optional attributes, see the Request Payload Table below. 

HTTP Request

POST https://rls.congacloud.com/v1/sign/cs-packages
JS

HTTP Headers

Authorization: Bearer access_token
Accept: application/json
Content-Type: multipart/form-data
JS

Request Payload

------WebKitFormBoundary1bNO60n7FqP5WO4t Content-Disposition: form-data; name="file"; filename="testDocumentExtraction.pdf" Content-Type: application/pdf %PDF-1.5 %µµµµ 1 0 obj <>>> endobj.... ------WebKitFormBoundary1bNO60n7FqP5WO4t Content-Disposition: form-data; name="payload" { "roles":[ { "id":"Role1", "signers":[ { "email":"signer1@example.com", "firstName":"1.firstname", "lastName":"1.lastname", "company":"Conga Sign" } ] }, { "id":"Role2", "signers":[ { "email":"signer2@example.com", "firstName":"2.firstname", "lastName":"2.lastname", "company":"Conga Sign" } ] } ], "documents":[ { "approvals":[ { "role":"Role1", "fields":[ { "page":0, "top":100, "subtype":"FULLNAME", "height":50, "left":100, "width":200, "type":"SIGNATURE" } ] }, { "role":"Role2", "fields":[ { "page":0, "top":300, "subtype":"FULLNAME", "height":50, "left":100, "width":200, "type":"SIGNATURE" } ] } ], "name":"Test Document" } ], "name":"Example Package", "type":"PACKAGE", "language":"en", "emailMessage":"", "description":"New Package", "autocomplete":true, "status":"SENT" } ------WebKitFormBoundary1bNO60n7FqP5WO4t--
JS

Request Payload Table

PropertyTypeEditableRequiredDefaultSample ValuesReference
roles




Adding, Updating, Removing Signers

id

stringYesNon/aSigner1
namestringYesNon/aSigner1

emailMessage

arrayYesNon/acheck referenceCustomizing Invitation Emails
reassignbooleanYesNo0true/falseChanging a Recipient
attachementRequirementsarrayYesNon/acheck referenceManaging Signers' Attachments
indexstringYesNo00/1/2/3Creating a Signer Workflow
typestringYesNoSIGNERSIGNER/SENDER
signers





idstringYesNon/aSigner1
emailstringYesYesn/asigner1@example.com
firstNamestringYesYesn/aMary
lastNamestringYesYesn/aDoe
companystringYesNon/aAcme Inc.
titlestringYesNonullManaging Director
grouparrayYesNon/acheck referenceManaging Groups
languagestringYesNon/aen/fr/esConfigure Languages
signature





textualstringNoNonull

handdrawnstringYesNon/aAQAAAAAMkGiVM7tmRJzS2cANoDcyT0ASAABWA=
deliveryarrayYesNon/acheck referenceDeliver Signed Documents
knowledgeBasedAuthenticationarrayYesNon/acheck referenceAuthenticating Signers
autharrayYesNon/acheck referenceAuthenticating Signers
documents




Uploading & Deleting Documents
descriptionstringYesNon/aTest document1 description
idstringYesNon/adocument1
dataarrayYesNon/acheck referenceUploading & Deleting Documents
approvals




Adding Signatures
rolestringYesYesn/aSigner1
idstringYesNon/aapproval1
optionalbooleanYesNo0true/falseOptional Signature
enforceCaptureSignaturebooleanYesNo0true/falseEnforce Capture Signature
fieldsarrayYesNon/acheck referenceAdding Fields
namestringYesNon/adocument 1
extractbooleanYesNo0true/falseDocument Extraction/Position Extraction
extractionTypesarrayYesNon/a["TEXT_TAGS","ACROFIELDS"]Document Extraction/Position Extraction
fieldsarrayYesNon/acheck referenceField Injection
namestringYesNon/adocument1
settingsarrayYesNon/acheck referenceSigner Experience Customization
sender
lastNamestringYesNon/aSmith
firstNamestringYesNon/aJohn
emailstringYesNon/abobsmith@email.com (who is a sender under your main account)
statusstringYesNoDRAFTDRAFT/SENT/COMPLETED/ARCHIVED/DECLINED/OPTED_OUT/EXPIRED
namestringYesNon/aPackage created from template through REST API
typestringYesNoPACKAGEPACKAGE/TEMPLATE/LAYOUT
descriptionstringYesNon/aPackage created with the Conga Sign REST API
languagestringYesNoenen/fr/esConfigure Languages
visibilitystringYesNoACCOUNTACCOUNT/SENDER
autoCompletebooleanYesNo1true/false
dataarrayYesNon/acheck referencePackage Attribute
duestringYesNonull08-26-17
emailMessagestringYesNon/aThis message should be delivered to all signers

Response Payload

{
"id": "9sKhW-h-qS9m6Ho3zRv3n2a-rkI="
}
JS

How to Create a Package

The first part of the package JSON string is the roles object. Inside this, you can set items like the id, company, first name, last name, email, and name to customize your signer roles. Some of the other notable settings would be email, message, title, and delivery. 

{
	"roles":[
		{
			"id":"Role1",
			"signers":[
				{
					"email":"signer1@example.com",
					"firstName":"1.firstname",
					"lastName":"1.lastname",
				"company":"Conga Sign"
				}
			]
		},
JS

The next section of the package JSON string is the documents object. Inside this, you will set items like the name and the approvals (signature blocks).

 "documents":[
	{
		"approvals":[
			{
				"role":"Role1",
				"fields":[
					{
						"page":0,
						"top":100,
						"subtype":"FULLNAME",
						"height":50,
						"left":100,
						"width":200,
						"type":"SIGNATURE"
				}
			]
		},
JS

In the approvals, the main items to set would be the type, subtype, role, page, and location settings. These will define the signatures required in each document. 

	jsonString += "\"documents\":[{\"approvals\":[{\"role\":\"Role1\",\"fields\":[{\"page\":0,\"top\":100,\"subtype\":\"FULLNAME\",\"height\":50,\"left\":100,\"width\":200,\"type\":\"SIGNATURE\"}]},{\"role\":\"Role2\",\"fields\":[{\"page\":0,\"top\":300,\"subtype\":\"FULLNAME\",\"height\":50,\"left\":100,\"width\":200,\"type\":\"SIGNATURE\"}]}],\"name\":\"Test Document\"}],";
JS

Finally, the last few settings of the package JSON string that you will want to note are the name, type, status, emailMessage, and autoComplete.  In this example, status is set to SENT. This will send the package and notify the signers. If you want to save this package as a draft, make the value DRAFT, instead. 

jsonString += "\"name\":\"Example Package\",\"type\":\"PACKAGE\",\"language\":\"en\",\"emailMessage\":\"\",\"description\":\"New Package\",\"autocomplete\":true,\"status\":\"SENT\"";
jsonString += "}";
JS

The next line of the code will take your JSON string and make the StringContent object that you will pass as the payload in your REST API command. 

StringContent jsonContent = new StringContent(jsonString, Encoding.UTF8, "application/json");
JS

These next lines read your PDF file and use that to create the file ByteArrayContent object for your REST call. Be sure to change the placeholder to your filepath. 

byte[] fileByteArray = File.ReadAllBytes("PATH_TO_YOUR_PDF.pdf");
			ByteArrayContent content = new ByteArrayContent(fileByteArray);
JS

The next section defines the content-disposition header of the PDF file content object. 

content.Headers.ContentDisposition = new ContentDispositionHeaderValue("form-data");
content.Headers.ContentDisposition.Name = "\"file\"";
content.Headers.ContentDisposition.FileName = "\"NAME_OF_YOUR_FILE.pdf\"";
content.Headers.ContentType = new MediaTypeHeaderValue("application/pdf");
JS

The next block is where you create your multipart form and add your content objects created above to pass with your REST call. Be sure to set the File name.

MultipartFormDataContent form = new MultipartFormDataContent();
form.Add(content, "\"file\"", "\"NAME_OF_YOUR_FILE.pdf\"");
form.Add(jsonContent, "\"payload\"");
JS

Next, create the HttpClient that you will use to make your POST request and set the appropriate header authorization and accept values. 

HttpClient myClient = new HttpClient();
myClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", apiKey);
myClient.DefaultRequestHeaders.Add("Accept", "application/json");
JS

Finally, you will make the PST call and pass your form to Conga Sign, creating your document package. The Debug line will display the result to the debug output console. 

var response = myClient.PostAsync(new Uri(url) + "/packages/", form).Result;
Debug.WriteLine(response.Content.ReadAsStringAsync().Result);
JS