# Issue with Form API

**URL:** <https://community.hubspot.com/t/issue-with-form-api/13441>\
**Category:** APIs & Integrations\
**Tags:** forms\
**Created:** [March 11, 2019, 12:32pm UTC](https://community.hubspot.com/t/issue-with-form-api/13441 "2019-03-11T12:32:07Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![sougata](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/sougata/32/44503_2.png) [@sougata](https://community.hubspot.com/u/sougata)\
**Post date:** [March 11, 2019, 12:32pm UTC](https://community.hubspot.com/t/issue-with-form-api/13441/1 "2019-03-11T12:32:07Z")

</div>

I am using custom form for data capture and Form API to post those submission to Hubspot. But I have found that some submissions were not posted to Hubspot, though the data is present in our database. I am not able to find out the issue as there is no similarities / patterns for those submissions.

So I started logging the responses from Hubspot after the post. I am getting 204 or 302 for all of them. But some emails were not created on hubpot, like “fg@dd.c.c”.

Here is my code -

```auto
function submit_hubspot_form($form_id, $param_string)
{
 $endpoint = 'https://forms.hubspot.com/uploads/form/v2/' . $portal_id . '/' . $form_id;
 $ch = @curl_init();
 @curl_setopt($ch, CURLOPT_POST, true);
 @curl_setopt($ch, CURLOPT_POSTFIELDS, $param_string);
 @curl_setopt($ch, CURLOPT_URL, $endpoint);
 @curl_setopt($ch, CURLOPT_HTTPHEADER, array(
 'Content-Type: application/x-www-form-urlencoded'
 ));
 @curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 $response = @curl_exec($ch); //Log the response from HubSpot as needed.
 $status_code = @curl_getinfo($ch, CURLINFO_HTTP_CODE); //Log the response status code
 @curl_close($ch);
 return $status_code;
}

```

Can anybody please let me know what issue would have caused this?

---

<div class="post-metadata">

**Author:** ![cbarley](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/cbarley/32/82559_2.png) [@cbarley](https://community.hubspot.com/u/cbarley)\
**Post date:** [March 12, 2019, 6:43pm UTC](https://community.hubspot.com/t/issue-with-form-api/13441/2 "2019-03-12T18:43:11Z")

</div>

Hi @sougata , I can’t tell what you’re doing that might be wrong here, but if you’re being returned a 204, it should be successful. That said, I can’t dig in without the following. Are you able to provide this:

1. A link to the form you’re submitting to in your hubspot account
2. An example of the raw payload you’re sending to HubSpot.
3. Any _full_ response you’re receiving from our severs.

---

<div class="post-metadata">

**Author:** ![sougata](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/sougata/32/44503_2.png) [@sougata](https://community.hubspot.com/u/sougata)\
**Post date:** [March 13, 2019, 6:38am UTC](https://community.hubspot.com/t/issue-with-form-api/13441/3 "2019-03-13T06:38:47Z")

</div>

Hi Connor,

You can find the form on [sourcesecurity.com](http://sourcesecurity.com) site. Visit - [https://www.sourcesecurity.com/white-papers/datasat-communications.html](https://www.sourcesecurity.com/white-papers/datasat-communications.html)

My request details are -

Endpoint -

`https://forms.hubspot.com/uploads/form/v2/XXX/api-key`

Params -

`&firstname=Sougata&lastname=Bose&company=SSc&email=fg%40dd.c.c&receive_marketing_emails=Yes&domain_registered_temporary=international&domain_registered_from=international&hs_context=%7B%22hutk%22%3A%2227e60ad0369ec9686412e4377ee94239%22%2C%22ipAddress%22%3A%22127.0.0.1%22%2C%22pageUrl%22%3A%22http%3A%5C%2F%5C%2Fssc.pt%5C%2Fwhite-papers%5C%2Fis-your-access-control-as-effective-as-you-think.html%3Fref%3Dnav%22%2C%22pageName%22%3A%22Access+control+in+practice+faces+challenges+%7C+HID+White+Paper+-+SourceSecurity.com%22%7D`

For the above data I am getting 204 response. But no contact created for “fg@dd.c.c” email address.

---

<div class="post-metadata">

**Author:** ![cbarley](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/cbarley/32/82559_2.png) [@cbarley](https://community.hubspot.com/u/cbarley)\
**Post date:** [March 13, 2019, 1:18pm UTC](https://community.hubspot.com/t/issue-with-form-api/13441/4 "2019-03-13T13:18:47Z")

</div>

hi @sougata , I was able to submit a test email through that form and it appeared in your account without issue: [HubSpot](https://app.hubspot.com/contacts/454960/contact/128552624/).

Are you doing any client-side validation? I won’t be able to offer you much here as everything appears to be working properly.

---

<div class="post-metadata">

**Author:** ![sougata](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/sougata/32/44503_2.png) [@sougata](https://community.hubspot.com/u/sougata)\
**Post date:** [March 14, 2019, 4:26am UTC](https://community.hubspot.com/t/issue-with-form-api/13441/5 "2019-03-14T04:26:26Z")

</div>

Hi Connor,

Have you submitted the form with email I gave you?

---

<div class="post-metadata">

**Author:** ![cbarley](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/cbarley/32/82559_2.png) [@cbarley](https://community.hubspot.com/u/cbarley)\
**Post date:** [March 14, 2019, 7:25pm UTC](https://community.hubspot.com/t/issue-with-form-api/13441/6 "2019-03-14T19:25:24Z")

</div>

Hi @sougata , I haven’t but that email doesn’t look valid. Here are the rules we have for validating emails: [Accounts Dashboard | HubSpot](https://developers.hubspot.com/docs/faq/how-does-hubspot-validate-email-addresses)

---

<div class="post-metadata">

**Author:** ![sougata](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/sougata/32/44503_2.png) [@sougata](https://community.hubspot.com/u/sougata)\
**Post date:** [March 15, 2019, 4:16am UTC](https://community.hubspot.com/t/issue-with-form-api/13441/7 "2019-03-15T04:16:36Z")

</div>

I agree. But why did hubspot returned 204 when submitted with this email? @04 means a successfull submission, right?

---

<div class="post-metadata">

**Author:** ![cbarley](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/cbarley/32/82559_2.png) [@cbarley](https://community.hubspot.com/u/cbarley)\
**Post date:** [March 15, 2019, 3:17pm UTC](https://community.hubspot.com/t/issue-with-form-api/13441/8 "2019-03-15T15:17:48Z")

</div>

That Forms API endpoint doesn’t do any validation client-side, so it was likely a case of “failing silently” where we give you a 204 because it submitted to the API, but we didn’t actually save the contact in the DB. If you’d like more strict validation, I’d recommend using the V3 endpoint: [https://developers.hubspot.com/docs/methods/forms/submit\_form\_v3](https://developers.hubspot.com/docs/methods/forms/submit_form_v3)
