How to add a form to your website with the API code

In this article, you will learn how to add a Form directly to your website using the API code. This configuration is special if you want to create a more customable form. So you need to know some code to create HTML. To integrate it, you can follow these steps:

  1. Enter the ‘Form API’ menu.
  2. Determine the form that you want to attach to the website. Then, click the ‘More’ button and select ‘Embed Code’.
  3. Click the ‘API’ tab. Here several sections of the Form will appear. What you need to pay attention to is the Endpoint and Request sections.


Endpoint will be the link that connects the Form on your website with the MTARGET account, then Request is a mandatory field in the Form code which will later be entered into the HTML Editor.

If you use the chatbox component, or multiplechoice, or anything that has more than 1 choice, you need to add “[~]” (no spaces) between the values ​​you filled in, these values ​​function as a link between values. For example, here you use the Male and Female values ​​in your checkbox, then the values ​​should be like this: { “email”: “String”, “home”: “String”, “checkbox-X10”: “Male [~] Female”, (NO SPACE) “multiple-Sq5”: “String” }

  1. Prepare the code according to the Endpoint and Request Form.
  2. Now go back to your website. Select settings that allow you to enter and modify HTML code on your web.
  3. Once you find it, you can now choose where to display the Form.
  4. Paste the HTML code that has been adjusted, to your website.
  5. Save the configuration. Open your website to check whether the Form has appeared in the right location.

Later, all data that the user enters in the form will be integrated into the form campaign in your MTARGET account.

Was this article helpful?
Let's See How They Improved By Using Our Products
Learn how our customers increase their leads and revenue through personalization and many other features. Check their stories!


The latest tutorials sent straight to your inbox.