title: REST API Embedded Signing -Docusign
body: <p>I'm using REST API for Embedded Signing. I have created the template with tags and set them as required fields, but while embedding the document in the website for signing I couldn`t see the tags I have set in the template. I have created this envelope by setting the template ID in the API code(<a href="http://iodocs.docusign.com/APIWalkthrough/embeddedSigning" rel="nofollow">http://iodocs.docusign.com/APIWalkthrough/embeddedSigning</a> - php). Here is the code</p>
  
  <pre><code>&lt;?php
  
  // Input your info:
  $email = "email address";           
  $password = "password";     
  $integratorKey = "integrator key";      
  $recipientName = "signer name";     
  $templateId = "template ID";        
  $templateRoleName = "template Role Name";   
  $clientUserId = "client ID";    
  
  // construct the authentication header:
  $header = "&lt;DocuSignCredentials&gt;&lt;Username&gt;" . $email . "&lt;/Username&gt;&lt;Password&gt;" . $password . "&lt;/Password&gt;&lt;IntegratorKey&gt;" . $integratorKey . "&lt;/IntegratorKey&gt;&lt;/DocuSignCredentials&gt;";
  
  /////////////////////////////////////////////////////////////////////////////////////////////////
  // STEP 1 - Login (retrieves baseUrl and accountId)
  /////////////////////////////////////////////////////////////////////////////////////////////////
  $url = "https://demo.docusign.net/restapi/v2/login_information";
  $curl = curl_init($url);
  curl_setopt($curl, CURLOPT_HEADER, false);
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($curl, CURLOPT_HTTPHEADER, array("X-DocuSign-Authentication: $header"));
  
  $json_response = curl_exec($curl);
  $status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
  
  if ( $status != 200 ) {
      echo "error calling webservice, status is:" . $status;
      exit(-1);
  }
  
  $response = json_decode($json_response, true);
  $accountId = $response["loginAccounts"][0]["accountId"];
  $baseUrl = $response["loginAccounts"][0]["baseUrl"];
  curl_close($curl);
  
  //--- display results
  echo "accountId = " . $accountId . "\nbaseUrl = " . $baseUrl . "\n";
  
  
  
  /////////////////////////////////////////////////////////////////////////////////////////////////
  // STEP 2 - Create an envelope with an Embedded recipient (uses the clientUserId property)
  /////////////////////////////////////////////////////////////////////////////////////////////////
  $data = array("accountId" =&gt; $accountId, 
      "emailSubject" =&gt; "DocuSign API - Embedded Signing Example",
      "templateId" =&gt; $templateId, 
      "templateRoles" =&gt; array(
          array( "roleName" =&gt; $templateRoleName, "email" =&gt; $email, "name" =&gt; $recipientName, "clientUserId" =&gt; $clientUserId )),
      "status" =&gt; "sent");                                                                    
  
  $data_string = json_encode($data);  
  $curl = curl_init($baseUrl . "/envelopes" );
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($curl, CURLOPT_POST, true);
  curl_setopt($curl, CURLOPT_POSTFIELDS, $data_string);                                                                  
  curl_setopt($curl, CURLOPT_HTTPHEADER, array(                                                                          
      'Content-Type: application/json',                                                                                
      'Content-Length: ' . strlen($data_string),
      "X-DocuSign-Authentication: $header" )                                                                       
  );
  
  $json_response = curl_exec($curl);
  $status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
  if ( $status != 201 ) {
      echo "error calling webservice, status is:" . $status . "\nerror text is --&gt; ";
      print_r($json_response); echo "\n";
      exit(-1);
  }
  
  $response = json_decode($json_response, true);
  $envelopeId = $response["envelopeId"];
  curl_close($curl);
  
  //--- display results   
  echo "Envelope created! Envelope ID: " . $envelopeId . "\n"; 
  
  /////////////////////////////////////////////////////////////////////////////////////////////////
  // STEP 3 - Get the Embedded Singing View 
  /////////////////////////////////////////////////////////////////////////////////////////////////
  $data = array("returnUrl" =&gt; "http://www.docusign.com/devcenter",
      "authenticationMethod" =&gt; "None", "email" =&gt; $email, 
      "userName" =&gt; $recipientName, "clientUserId" =&gt; $clientUserId
  );                                                                    
  
  $data_string = json_encode($data);    
  $curl = curl_init($baseUrl . "/envelopes/$envelopeId/views/recipient" );
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($curl, CURLOPT_POST, true);
  curl_setopt($curl, CURLOPT_POSTFIELDS, $data_string);                                                                  
  curl_setopt($curl, CURLOPT_HTTPHEADER, array(                                                                          
      'Content-Type: application/json',                                                                                
      'Content-Length: ' . strlen($data_string),
      "X-DocuSign-Authentication: $header" )                                                                       
  );
  
  $json_response = curl_exec($curl);
  $status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
  if ( $status != 201 ) {
      echo "error calling webservice, status is:" . $status . "\nerror text is --&gt; ";
      print_r($json_response); echo "\n";
      exit(-1);
  }
  
  $response = json_decode($json_response, true);
  $url = $response["url"];
  
  //--- display results
  echo "Embedded URL is: \n\n" . $url . "\n\nNavigate to this URL to start the embedded signing view of the envelope\n"; 
  </code></pre>
  
  <p>?</p>
  
  <p>If I send envelope directly from the demo account using the same template it shows all the tags I have set. Why this happens, is there any additional settings for displaying tags from the template.</p>