# Using API in form

**URL:** <https://community.hubspot.com/t/using-api-in-form/13064>\
**Category:** APIs & Integrations\
**Tags:** forms\
**Created:** [February 18, 2019, 1:34pm UTC](https://community.hubspot.com/t/using-api-in-form/13064 "2019-02-18T13:34:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![YuriFA](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/yurifa/32/29572_2.png) [@YuriFA](https://community.hubspot.com/u/YuriFA)\
**Post date:** [February 18, 2019, 1:34pm UTC](https://community.hubspot.com/t/using-api-in-form/13064/1 "2019-02-18T13:34:37Z")

</div>

I am trying to apply a code for an API that realizes a real-time email validation on my langing page. I know at least two huge brazilian companies (that are Hubspot’s customers already) that need to apply this API either - and asked me for help.

The problem is that the API searches the code looking for the email field. But, in the source, every field has the same type and same class, becoming impossible to find the right spot. How do the API can identify the correct field (email), considering that all fields look the same in the code? Is there any detail that we are forgetting to look? Could you please help us solving this issue?

---

<div class="post-metadata">

**Author:** ![YuriFA](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/yurifa/32/29572_2.png) [@YuriFA](https://community.hubspot.com/u/YuriFA)\
**Post date:** [February 18, 2019, 2:26pm UTC](https://community.hubspot.com/t/using-api-in-form/13064/2 "2019-02-18T14:26:15Z")

</div>

[https://hblanding.safetymails.com/tesscripts](https://hblanding.safetymails.com/tesscripts)  
This is my landing page with the Script.

---

<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:** [February 21, 2019, 4:26pm UTC](https://community.hubspot.com/t/using-api-in-form/13064/3 "2019-02-21T16:26:47Z")

</div>

Hi, @YuriFA.

Happy to help.

All the fields in [this landing page’s](https://hblanding.safetymails.com/tesscripts) footer form have the `type="text"` and the `class="input"` because no form is actually selected in the [page editor](https://app.hubspot.com/content/5468858/edit/7568079597/content).

If you select a form in the editor:

 ![Select a form.jpg](https://d2qpr2jzcazej7.cloudfront.net/original/3X/8/9/8957580cc185585c7c8b0776df08d4b90c1e9702.jpeg)

you should see `type="email"` and a unique `id` like `email-ba9c05d2-a24c-424a-95c6-d02993d2e21d_4488` appear in the form’s source code. You can then use this to target your script.

---

<div class="post-metadata">

**Author:** ![YuriFA](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/yurifa/32/29572_2.png) [@YuriFA](https://community.hubspot.com/u/YuriFA)\
**Post date:** [February 21, 2019, 5:49pm UTC](https://community.hubspot.com/t/using-api-in-form/13064/4 "2019-02-21T17:49:37Z")

</div>

TY for your help, now I know how to put the class in the field. But the API still not working, the JavaScript cant read the field, JS work but can’t read the field.  
[https://hblanding.safetymails.com/sample-offer](https://hblanding.safetymails.com/sample-offer)

---

<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:** [February 27, 2019, 10:31pm UTC](https://community.hubspot.com/t/using-api-in-form/13064/5 "2019-02-27T22:31:07Z")

</div>

Apologies for the delayed response, @YuriFA.

To clarify, are you saying the external email validation API is not working? Can you describe how it is applying JavaScript or searching for the field and what errors it is returning?

If you are referring to an external API, I probably won’t be able to help troubleshooting its issues, but I can make sure that classes and IDs are applied correctly to the HubSpot form.
