How to Stop HubSpot from Creating Automatic Forms?

I’m using the HubSpot forms API to send contact data from my website. Everything works fine but there’s an annoying issue. Each time I submit data through the API, HubSpot creates a new form automatically in the Marketing section. These forms get names like #form_abc123xyz and they’re marked as “non-HubSpot forms”.

The system explanation says these are HTML forms from external websites that get tracked automatically. The problem is my data gets recorded twice - once in my actual form that I created in HubSpot, and once in these auto-created forms.

Here’s my implementation:

// Configuration settings
define('CRM_PORTAL_ID', getenv('crm_portal_id'));
define('CRM_FORM_GUID', getenv('crm_form_guid'));
define('CRM_API_URL', "https://forms.hubspot.com/uploads/form/v2/".CRM_PORTAL_ID."/{guid}");

// Form submission handler
function submit_to_crm($current_url, $page_title, $api_endpoint, $form_data) {
    $context_data = array(
        'ipAddress' => $_SERVER['REMOTE_ADDR'],
        'pageUrl' => $current_url,
        'pageName' => $page_title,
    );
    
    if (isset($_COOKIE['hubspotutk'])) {
        $context_data['hutk'] = $_COOKIE['hubspotutk'];
    }
    
    $form_data['hs_context'] = $context_data;
    
    $post_string = "";
    foreach ($form_data as $field => $val) {
        if (is_string($val)) {
            $val = urlencode($val);
        } else if (is_array($val)) {
            $val = json_encode($val);
        }
        $post_string .= $field."=".$val."&";
    }
    $post_string = rtrim($post_string, "&");
    
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_POST, true);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $post_string);
    curl_setopt($curl, CURLOPT_URL, $api_endpoint);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    
    $response = curl_exec($curl);
    curl_close($curl);
    
    return $response;
}

// Usage example
$api_response = submit_to_crm(
    "https://mysite.com/contact-us/",
    "Contact Us Page",
    str_replace("{guid}", CRM_FORM_GUID, CRM_API_URL),
    array(
        "firstname" => $user_data["first_name"],
        "lastname" => $user_data["last_name"],
        "email" => $user_data["email_address"],
        "phone" => $user_data["phone_number"],
        "message" => $user_data["inquiry"]
    )
);

Is there a way to prevent this automatic form creation? My forms list is getting cluttered with these generated entries that I have to manually delete. The original form I created is organized in a folder while these auto-generated ones appear at the root level.

Been dealing with HubSpot integrations for years - this duplication mess happens all the time. You’re fighting HubSpot’s system instead of working with it.

I ditched the direct API approach completely. Those tracking prevention methods work sometimes, but they’re unreliable and HubSpot keeps changing their detection.

What works: put an automation layer between your site and HubSpot. It grabs data from your website, cleans it up, then sends it to HubSpot using the right method (Forms API for workflow triggers, Contacts API when you don’t need them).

The automation handles context data properly and can deduplicate before it hits HubSpot. You get retry logic and better error handling than managing curl requests yourself.

Your PHP stays mostly the same - just point it to the automation webhook instead of HubSpot directly. The automation does the heavy lifting and stops those auto-generated forms.

I use Latenode since it has native HubSpot connectors and handles API quirks automatically. Way cleaner than debugging form tracking issues.

This happens because HubSpot’s tracking script sees form submissions from external domains and auto-creates these phantom forms for analytics. The problem is your hs_context configuration - you’re sending external pageUrl data that triggers the auto-tracking.

Try removing pageUrl and pageName from your hs_context array completely. Without page context, HubSpot treats these as direct API calls instead of tracked web forms. Keep the ipAddress and hutk cookie for contact association, but ditch the webpage references.

Another trick that worked for me: set the pageUrl to match your HubSpot domain instead of your actual site domain. This fools the tracking system into thinking the submission came from within HubSpot.

If you need the page tracking data for reporting, just store it in custom contact properties instead of the context object. You’ll keep the info without triggering automatic form creation.

Had this exact problem six months ago and figured out what works. HubSpot’s auto form tracking kicks in whenever it sees submissions from external domains, even through their official API. Here’s the fix: add ‘iframeName’: ‘custom_iframe’ to your hs_context data. This stops the tracking system from treating your API calls like external form submissions. Also set ‘sfdcCampaignId’: ‘’ as an empty string. An even better solution is to switch to HubSpot’s Contact API instead of the Forms API for programmatic tasks. This completely sidesteps the form tracking while still creating contacts and firing workflows. The contact endpoint doesn’t create phantom forms since it’s built for direct data integration, not form submissions. If you need to use the Forms API for workflow triggers, ensure that your pageUrl matches your HubSpot domain tracking settings exactly. Otherwise, it assumes it’s an external source and auto-tracks it.