I am using Docusign PHP Client and trying to create and envelope and send it as email. With the current SDK, I was getting an error:

> 
> INVALID\_REQUEST\_BODY The request body is missing or improperly formatted. Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'API\_REST.Models.v2.document[]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.\r\n ◀
>  To fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive t ▶
>  Path 'documents.documentBase64', line 1, position 31.
> 
> 
> 

So I had to edit [EnvelopeApi.php (line 2876)](https://github.com/docusign/docusign-php-client/blob/master/src/Api/EnvelopesApi.php#L2876) `json_encode($httpBody)` to make it work.

---

Now that it's working, I receive a response like this, **however I can't change status created to sent** is my problem.

```
EnvelopeSummary {#460 ▼
  #container: array:4 [▼
    "envelope_id" => "6b9ef863-2ee0-4ea6-9f7e-20b7d4f59b22"
    "status" => "created"
    "status_date_time" => "2018-10-03T12:30:22.8600000Z"
    "uri" => "/envelopes/6b9ef863-2ee0-4ea6-9f7e-20b7d4f59b22"
  ]
}

```

My full code:

First, I authenticated and fetched my `$accountId`

`And then creating Envelope`:

```
$path = public_path('test.pdf');
$b64Doc = base64_encode(file_get_contents($path));

$document = new Document();
$document->setName("TEST.pdf");
$document->setFileExtension("pdf");
$document->setDocumentId(1);
$document->setDocumentBase64($b64Doc);

$sign_here = new SignHere();
$sign_here->setXPosition(25);
$sign_here->setYPosition(50);
$sign_here->setDocumentId(1);
$sign_here->setPageNumber(1);
$sign_here->setRecipientId(1);

$tabs = new Tabs();
$tabs->setSignHereTabs($sign_here);

$signers = new Signer();
$signers->setName('Test User');
$signers->setEmail('test@mailinator.com');
$signers->setRoleName('Signer');
$signers->setRecipientId(1);
$signers->setRoutingOrder(1);
$signers->setTabs($tabs);

$recipients = new Recipients();
$recipients->setSigners($signers);

$envelope_definition = new EnvelopeDefinition();
$envelope_definition->setEmailSubject('Signature Request');
$envelope_definition->setStatus("sent"); // ***
$envelope_definition->setDocuments($document);
$envelope_definition->setRecipients($recipients);

$options = new CreateEnvelopeOptions();
$options->setCdseMode(null);
$options->setMergeRolesOnDraft(null);

try {
   $envelopeSummary = $envelopeApi->createEnvelope($accountId, $envelope_definition, $options);
   dd($envelopeSummary);

   // Also tried this:
   // $envelopeApi->update($accountId, $envelopeSummary->getEnvelopeId(), json_encode(['status' => 'sent']);

 } catch (ApiException $e){
     dd($e->getResponseBody()->errorCode . " " . $e->getResponseBody()->message);
}

```

`$envelope_definition->setStatus("sent");` this should trigger the email, right? But it doesn't for some reason. Also I can't see this created envelope in my Sandbox either.