# 204 Error: Submit User Data to Hubspot

**URL:** <https://community.hubspot.com/t/204-error-submit-user-data-to-hubspot/11497>\
**Category:** APIs & Integrations\
**Tags:** forms\
**Created:** [November 20, 2018, 7:25pm UTC](https://community.hubspot.com/t/204-error-submit-user-data-to-hubspot/11497 "2018-11-20T19:25:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/system/32/124_2.png) [@system](https://community.hubspot.com/u/system)\
**Post date:** [November 20, 2018, 7:25pm UTC](https://community.hubspot.com/t/204-error-submit-user-data-to-hubspot/11497/1 "2018-11-20T19:25:45Z")

</div>

Hi everyone!

We’re trying to connect a custom sign-up form on our website to the Hubspot Forms API and running into some issues.

We’re pushing page views to window.\_hsq on page transition via [https://developers.hubspot.com/docs/methods/tracking\_code\_api/identify\_visitor](https://developers.hubspot.com/docs/methods/tracking_code_api/identify_visitor). Think this is working.

```auto
// init
var isInit = true;

// on $state transition
$transitions.onSuccess({}, function (transition) {
 // define hub spot object
 $window._hsq = $window._hsq || [];

 // send $state to hubspot
 $window._hsq.push(['setPath', transition.to().url]);

 // if not init -> tell hubspot to track this page view
 // not required on init https://developers.hubspot.com/docs/methods/tracking_code_api/tracking_code_overview#spa
 if (!isInit) $window._hsq.push(['trackPageView']);

 // tip isInit
 isInit = false;
});

```

Then we’re sending user data to Hubspot via [https://developers.hubspot.com/docs/methods/forms/submit\_form\_v3](https://developers.hubspot.com/docs/methods/forms/submit_form_v3).

```auto
// define data
var data = {
 "portalId": "1229789",
 "formGuid": "e651236b-4d20-453e-a0d6-76f7330e1238",
 "submittedAt": 1542718668884,
 "fields":[
 {
 "name": "firstname",
 "value": "a"
 },
 {
 "name": "lastname",
 "value": "b"
 },
 {
 "name": "email",
 "value": "a@c.com"
 }
 ],
 "context":{
 "hutk": "5ed4d4eec89b95727d50742cb49507bb",
 "pageName": "un-auth-signup",
 "pageUri": "/signup?iframe&email"
 }
};

return $http.post('https://api.hsforms.com/submissions/v3/integration/submit/4920989/f561b96b-4d20-453e-a0d6-76f7456e2438', data);

```

The response is erroring out for us in Angular:

- status: -1
- xhrStatus: “error”

Any idea what we need to do differently? Much appreciated!  
Abby

---

<div class="post-metadata">

**Author:** ![IsaacTakushi](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/isaactakushi/32/70387_2.png) [@IsaacTakushi](https://community.hubspot.com/u/IsaacTakushi)\
**Post date:** [November 21, 2018, 8:12pm UTC](https://community.hubspot.com/t/204-error-submit-user-data-to-hubspot/11497/2 "2018-11-21T20:12:08Z")

</div>

Welcome, [@abby.perkins](https://community.hubspot.com/u/abby.perkins)!

Happy to help, but I have some questions:

1. Is your website a single-page application?
2. Account **1229789** is no longer active, so it won’t be possible to submit to any forms with that Hub ID (`portalId`). did you mean to type a different value?
3. At the end of your code block, I see the request URL `https://api.hsforms.com/submissions/v3/integration/submit/4920989/f561b96b-4d20-453e-a0d6-76f7456e2438`. There are no active forms [in that account](https://app.hubspot.com/forms/4920989), so the `formGuid` `f561b96b-4d20-453e-a0d6-76f7456e2438` won’t work either.

Can you send me a link to the form in your account which you are attempting to submit to?

---

<div class="post-metadata">

**Author:** ![system](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/system/32/124_2.png) [@system](https://community.hubspot.com/u/system)\
**Post date:** [November 26, 2018, 2:18pm UTC](https://community.hubspot.com/t/204-error-submit-user-data-to-hubspot/11497/3 "2018-11-26T14:18:41Z")

</div>

Hi,

Appreciate you for the reply

Form =\> [https://dev-app.glew.io/#/signup](https://dev-app.glew.io/#/signup)  
Code =\>

[

 ![](https://d2qpr2jzcazej7.cloudfront.net/original/3X/5/6/56cc2ec9102dd1f0db912dca56c0884840e1257a.png)

Screen Shot 2018-11-26 at 9.18.19 AM.png3272x1880 768 KB

]([https://community.hubspot.com/legacyfs/online/uploads/default/original/2X/7/76beb961e1d68c02f1176e97ecf0d3a182eb2477.png](https://community.hubspot.com/legacyfs/online/uploads/default/original/2X/7/76beb961e1d68c02f1176e97ecf0d3a182eb2477.png))

---

<div class="post-metadata">

**Author:** ![IsaacTakushi](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/isaactakushi/32/70387_2.png) [@IsaacTakushi](https://community.hubspot.com/u/IsaacTakushi)\
**Post date:** [November 26, 2018, 8:52pm UTC](https://community.hubspot.com/t/204-error-submit-user-data-to-hubspot/11497/4 "2018-11-26T20:52:43Z")

</div>

Hi [@ccarrin2](https://community.hubspot.com/u/ccarrin2),

Thanks for confirming your Hub ID and sharing that data.

I successfully made [this test submission](https://app.hubspot.com/forms/4929709/e651b96b-4d20-453e-a0d6-76f7330e2438/submissions) from Postman using `https://api.hsforms.com/submissions/v3/integration/submit/4929709/e651b96b-4d20-453e-a0d6-76f7330e2438`, so there’s nothing wrong with your request URL.

I’m noticing that the `data` object is not properly-formatted JSON. Unless you’re converting it to JSON in the part of the “send user data” request" which is cut off in that screenshot, I don’t think this request would work.

Per the [Forms API documentation](https://developers.hubspot.com/docs/methods/forms/submit_form_v3), the body should have double quotes around everything except variables. For example:

```auto
{
 "submittedAt": $window.Date.now(),
 "fields": [
 {
 "name": "email",
 "value": self.form.email
 }
]}

```

The `email` object also has an extra `,` at the end even though it’s the last object in the `fields` array, but I don’t know that this alone would cause the issues you’re seeing.

Let me know if adding proper JSON format to the `data` object helps!
