# API Error on Transactional Single Sends

**URL:** <https://community.hubspot.com/t/api-error-on-transactional-single-sends/69048>\
**Category:** APIs & Integrations\
**Tags:** php\
**Created:** [November 10, 2022, 7:56pm UTC](https://community.hubspot.com/t/api-error-on-transactional-single-sends/69048 "2022-11-10T19:56:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![craigcri](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/craigcri/32/93509_2.png) [@craigcri](https://community.hubspot.com/u/craigcri)\
**Post date:** [November 10, 2022, 7:56pm UTC](https://community.hubspot.com/t/api-error-on-transactional-single-sends/69048/1 "2022-11-10T19:56:03Z")

</div>

Using PHP, we’re attempting to do a transactional email “simple send” fails, despite building my Request object using the RequestEgg.

Full error:

`{"status":"error","message":"Invalid input JSON on line 1, column 67: Cannot deserialize value of type `java.util.LinkedHashMap\<java.lang.String,java.lang.String\>`from Array value (token`JsonToken.START\_ARRAY`)","correlationId":"7ab5cf67-6968-476a-8b66-2e0a76c9cf9d"}`

Here’s the section of code throwing the error:

```lia-code-sample
$email = new \HubSpot\Client\Marketing\Transactional\Model\PublicSingleSendRequestEgg([
 'email_id' => 123456789,
 'message' => [
 'to' => 'myemail@email.com',
 ],
 'contact_properties' => [
 [
 'name' => 'firstname',
 'value' => 'MyName'
 ]
 ],
 'custom_properties' => [
 [
 'name' => 'trackingNumber',
 'value' => '12345678987654321'
 ]
 ]
]);
return $HubSpot->marketing()->transactional()->singleSendApi()->sendEmail($email);

```

Curious if anyone can help point us in the right direction?

---

<div class="post-metadata">

**Author:** ![skimura](https://avatars.discourse-cdn.com/v4/letter/s/9de053/32.png) [@skimura](https://community.hubspot.com/u/skimura)\
**Post date:** [November 11, 2022, 6:05am UTC](https://community.hubspot.com/t/api-error-on-transactional-single-sends/69048/2 "2022-11-11T06:05:07Z")

</div>

@craigcri

Hi.

`PublicSingleSendRequestEgg` parameter might be wrong.

How about check `hubspot API reference` ? It’s very useful.

> **[Marketing API | Marketing Email - HubSpot docs](https://developers.hubspot.com/docs/api-reference/legacy/marketing/marketing-emails/guide)**
>
> Learn how to create, update, and retrieve data for your emails using the Marketing Emails v3 API.

It has sample code（include PHP） and test tool.

 ![スクリーンショット 2022-11-11 15.00.31.jpg](https://d2qpr2jzcazej7.cloudfront.net/original/3X/8/8/885337d09ae167c962833dee4da4b25dad202c12.jpeg)

Thanks.

---

<div class="post-metadata">

**Author:** ![craigcri](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/craigcri/32/93509_2.png) [@craigcri](https://community.hubspot.com/u/craigcri)\
**Post date:** [November 11, 2022, 5:28pm UTC](https://community.hubspot.com/t/api-error-on-transactional-single-sends/69048/3 "2022-11-11T17:28:42Z")

</div>

That’s what I thought as well, but I’ve validated RequestEgg and it has returned valid.

Even trying to push an Object or Json string into it, it expects value as an Array, so I feel it is formatted correctly.

Even using Setter methods for the required parameters, passing it to the Send function throws the same error.

---

<div class="post-metadata">

**Author:** ![craigcri](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/craigcri/32/93509_2.png) [@craigcri](https://community.hubspot.com/u/craigcri)\
**Post date:** [November 11, 2022, 10:51pm UTC](https://community.hubspot.com/t/api-error-on-transactional-single-sends/69048/4 "2022-11-11T22:51:57Z")

</div>

Turns out my formatting was incorrect for custom properties and contact properties above. Items are no longer formatted in individual arrays.

Also I discovered even if your Contact Properties or Custom Properties are empty arrays, it will throw errors. Sad.
