Download PDF
Download page Creating and Sending a Transaction.
Creating and Sending a Transaction
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
HTTP Headers
Authorization: Bearer access_token
Accept: application/json
Content-Type: multipart/form-data
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--
Request Payload Table
Property | Type | Editable | Required | Default | Sample Values | Reference |
---|---|---|---|---|---|---|
roles | Adding, Updating, Removing Signers | |||||
id | string | Yes | No | n/a | Signer1 | |
name | string | Yes | No | n/a | Signer1 | |
emailMessage | array | Yes | No | n/a | check reference | Customizing Invitation Emails |
reassign | boolean | Yes | No | 0 | true/false | Changing a Recipient |
attachementRequirements | array | Yes | No | n/a | check reference | Managing Signers' Attachments |
index | string | Yes | No | 0 | 0/1/2/3 | Creating a Signer Workflow |
type | string | Yes | No | SIGNER | SIGNER/SENDER | |
signers | ||||||
id | string | Yes | No | n/a | Signer1 | |
string | Yes | Yes | n/a | signer1@example.com | ||
firstName | string | Yes | Yes | n/a | Mary | |
lastName | string | Yes | Yes | n/a | Doe | |
company | string | Yes | No | n/a | Acme Inc. | |
title | string | Yes | No | null | Managing Director | |
group | array | Yes | No | n/a | check reference | Managing Groups |
language | string | Yes | No | n/a | en/fr/es | Configure Languages |
signature | ||||||
textual | string | No | No | null | ||
handdrawn | string | Yes | No | n/a | AQAAAAAMkGiVM7tmRJzS2cANoDcyT0ASAABWA= | |
delivery | array | Yes | No | n/a | check reference | Deliver Signed Documents |
knowledgeBasedAuthentication | array | Yes | No | n/a | check reference | Authenticating Signers |
auth | array | Yes | No | n/a | check reference | Authenticating Signers |
documents | Uploading & Deleting Documents | |||||
description | string | Yes | No | n/a | Test document1 description | |
id | string | Yes | No | n/a | document1 | |
data | array | Yes | No | n/a | check reference | Uploading & Deleting Documents |
approvals | Adding Signatures | |||||
role | string | Yes | Yes | n/a | Signer1 | |
id | string | Yes | No | n/a | approval1 | |
optional | boolean | Yes | No | 0 | true/false | Optional Signature |
enforceCaptureSignature | boolean | Yes | No | 0 | true/false | Enforce Capture Signature |
fields | array | Yes | No | n/a | check reference | Adding Fields |
name | string | Yes | No | n/a | document 1 | |
extract | boolean | Yes | No | 0 | true/false | Document Extraction/Position Extraction |
extractionTypes | array | Yes | No | n/a | ["TEXT_TAGS","ACROFIELDS"] | Document Extraction/Position Extraction |
fields | array | Yes | No | n/a | check reference | Field Injection |
name | string | Yes | No | n/a | document1 | |
settings | array | Yes | No | n/a | check reference | Signer Experience Customization |
sender | ||||||
lastName | string | Yes | No | n/a | Smith | |
firstName | string | Yes | No | n/a | John | |
string | Yes | No | n/a | bobsmith@email.com (who is a sender under your main account) | ||
status | string | Yes | No | DRAFT | DRAFT/SENT/COMPLETED/ARCHIVED/DECLINED/OPTED_OUT/EXPIRED | |
name | string | Yes | No | n/a | Package created from template through REST API | |
type | string | Yes | No | PACKAGE | PACKAGE/TEMPLATE/LAYOUT | |
description | string | Yes | No | n/a | Package created with the Conga Sign REST API | |
language | string | Yes | No | en | en/fr/es | Configure Languages |
visibility | string | Yes | No | ACCOUNT | ACCOUNT/SENDER | |
autoComplete | boolean | Yes | No | 1 | true/false | |
data | array | Yes | No | n/a | check reference | Package Attribute |
due | string | Yes | No | null | 08-26-17 | |
emailMessage | string | Yes | No | n/a | This message should be delivered to all signers |
Response Payload
{
"id": "9sKhW-h-qS9m6Ho3zRv3n2a-rkI="
}
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"
}
]
},
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"
}
]
},
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\"}],";
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 += "}";
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");
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);
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");
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\"");
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");
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);