Send Template and Sign API Demo

- API Demo Form
- SERVER CODE
Fill out the form to create a document.
*Mandatory fields
PHP CURL
Retrieve Access Token
$curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://www.esigngenie.com/esign/api/oauth2/access_token", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => "grant_type=client_credentials&client_id=CLIENT_ID&client_secret=CLIENT_SECRET&scope=read-write", CURLOPT_HTTPHEADER => array( "cache-control: no-cache", "content-type: application/x-www-form-urlencoded" ), )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; }
Retrieve Signing Session URL
$curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://www.esigngenie.com/esign/api/templates/createFolder", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => '{ "folderName":"Sample Documents", "templateIds":[ID_OF_TEMPLATE_A,ID_OF_TEMPLATE_B], "fields": { "FIELD1_NAME":"FIELD1_VALUE", "FIELD2_NAME":"FIELD2_VALUE", .... }, "parties":[ { "firstName":"FIRST_NAME_OF_RECIPIENT_PARTY", "lastName":"LAST_NAME_OF_RECIPIENT_PARTY", "emailId":"EMAIL_ID_OF_RECIPIENT_PARTY", "permission":"FILL_FIELDS_AND_SIGN", "workflowSequence":1, "sequence":1 }, .... ], "signInSequence":false, "createEmbeddedSigningSession":true, "createEmbeddedSigningSessionForAllParties":true, "signSuccessUrl":"YOUR_PAGE_TO_REDIRECT_USER_FROM_EMBEDDED_SESSION", "signDeclineUrl":"YOUR_PAGE_TO_REDIRECT_USER_FROM_EMBEDDED_SESSION", "signLaterUrl":"YOUR_PAGE_TO_REDIRECT_USER_FROM_EMBEDDED_SESSION", "signErrorUrl":"YOUR_PAGE_TO_REDIRECT_USER_FROM_EMBEDDED_SESSION", "themeColor":"ANY_CSS_COLOR_TO_MATCH_YOUR_APPLICATION", "allowSendNowAndEmbeddedSigningSession":false }', CURLOPT_HTTPHEADER => array( "Authorization: Bearer YOUR_ACCESS_TOKEN", "cache-control: no-cache", "content-type: application/json" ), )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; }