# hubspot-php form submit responds: "The request is not valid"

**URL:** <https://community.hubspot.com/t/hubspot-php-form-submit-responds-the-request-is-not-valid/24414>\
**Category:** APIs & Integrations\
**Tags:** forms\
**Created:** [August 20, 2020, 8:23am UTC](https://community.hubspot.com/t/hubspot-php-form-submit-responds-the-request-is-not-valid/24414 "2020-08-20T08:23:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![philx](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/philx/32/43872_2.png) [@philx](https://community.hubspot.com/u/philx)\
**Post date:** [August 20, 2020, 8:23am UTC](https://community.hubspot.com/t/hubspot-php-form-submit-responds-the-request-is-not-valid/24414/1 "2020-08-20T08:23:41Z")

</div>

After updating hubspot-php library the form-submit function does not work anymore.

Response:

```auto
Client error: `POST https://forms.hubspot.com/submissions/v3/integration/submit/.../...` resulted in a `400 Bad Request` response:
{"status":"error","message":"The request is not valid","correlationId":"4768e363-cc2f-469f-b935-bf70023d5cfd","errors":[ (truncated...)

```

code that was used before update and worked:

`$hubspot->forms()->submit($this->hubspot_portal, $this->hubspot_form, ['hs_context' => json_encode([ 'hutk' => @$_COOKIE['hubspotutk'], 'ipAddress' => $_SERVER['REMOTE_ADDR'], 'pageUrl' => ($_SERVER['HTTP_REFERER'] ? $_SERVER['HTTP_REFERER'] : ($_SERVER['HTTPS'] ? 'https' : 'http') . '://' . $_SERVER['SERVER_NAME'] . '/register'), 'pageName' => 'Register' ]), "email" => $user->email, "firstname" => $user->name, "lastname" => $user->surname, "jobtitle" => $user->position, "company" => $customer->name, "company_type" => strtoupper($type ? $type->name : ''), "phone" => $user->phone, "source" => ($user->registered_by ? "Inbound" : "Outbound"), "utm_campaign" => $user->campaign, "utm_source" => $user->source, "utm_medium" => $user->medium]);`

also tried this format of data instead:

`$data = ["fields" => [ ["name" => "email", "value" => "abc@xyz.com"], ["name" => "hs_context", "value" => ""], ["name" => "firstname", "value" => ""], ["name" => "lastname", "value" => ""], ["name" => "jobtitle", "value" => ""], ["name" => "company", "value" => ""], ["name" => "company_type", "value" => ""], ["name" => "phone", "value" => ""], ["name" => "source", "value" => ""], ["name" => "utm_campaign", "value" => ""], ["name" => "utm_source", "value" => ""], ["name" => "utm_medium", "value" => ""], ]];`

Do you have any clue how to fix this?

There is no working documentation or detailed error message - just “the request is not valid”

---

<div class="post-metadata">

**Author:** ![WendyGoh](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/wendygoh/32/42320_2.png) [@WendyGoh](https://community.hubspot.com/u/WendyGoh)\
**Post date:** [August 21, 2020, 3:51am UTC](https://community.hubspot.com/t/hubspot-php-form-submit-responds-the-request-is-not-valid/24414/2 "2020-08-21T03:51:50Z")

</div>

Hey @philx,

Looking at the form POST request URL, I noticed that it is different from the POST request url documented here: [Submit data for a form | Forms API](https://legacydocs.hubspot.com/docs/methods/forms/submit_form).

The supported Form POST request url should look something like this:

### POST [https://api.hsforms.com/submissions/v3/integration/submit/:portalId/:formGuid](https://api.hsforms.com/submissions/v3/integration/submit/:portalId/:formGuid)

Could you change the request url to match the documented request url and see if it works?

---

<div class="post-metadata">

**Author:** ![philx](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/philx/32/43872_2.png) [@philx](https://community.hubspot.com/u/philx)\
**Post date:** [August 21, 2020, 7:20am UTC](https://community.hubspot.com/t/hubspot-php-form-submit-responds-the-request-is-not-valid/24414/3 "2020-08-21T07:20:20Z")

</div>

changed it but still getting the same response

---

<div class="post-metadata">

**Author:** ![philx](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/philx/32/43872_2.png) [@philx](https://community.hubspot.com/u/philx)\
**Post date:** [August 21, 2020, 8:43am UTC](https://community.hubspot.com/t/hubspot-php-form-submit-responds-the-request-is-not-valid/24414/4 "2020-08-21T08:43:34Z")

</div>

resolved: after managing to get a look at a detailed error message it turned out that the required data structure changed (2nd one in original posting), some fields are validated stricter (required / no empty values) and email validation needed to be deactivated by a skip parameter
