Getting 415 Error When Submitting Contact Form to HubSpot API

Issue with Newsletter Signup Form

I’m working on a newsletter registration form that connects to HubSpot’s API. The form displays correctly on my site, but when users try to submit it, I keep getting a 415 “Unsupported Media Type” error response.

My Current Form Code

<form method="POST" enctype="application/x-www-form-urlencoded" accept-charset="UTF-8" action="https://forms.hsforms.com/submissions/v3/public/submit/formsnext/multipart/12345678/abc123-def4-56gh-78ij-klmnopqrstuv">
    <input required placeholder="Enter email" type="email" name="email" autocomplete="email">
    <input required placeholder="Your first name" type="text" name="firstname" autocomplete="given-name">
    <input required placeholder="Your last name" type="text" name="lastname" autocomplete="family-name">
    <button type="submit">Join Newsletter</button>
</form>

Request Details

The form sends data like this:

user_email=john.doe%40example.com&firstname=John&lastname=Doe

Content-Type header is set to “application/x-www-form-urlencoded” and the request method is POST.

What I’ve Tried

  • Changed the Content-Type header to different values
  • Tried different charset settings like utf-8 and iso-8859-1
  • Modified Accept header to various formats
  • Checked form encoding multiple times

The server keeps returning 415 status code. Has anyone faced this issue before? What could be causing the media type rejection?

Your form’s portal ID in the action URL looks wrong. HubSpot portal IDs are 7-8 digits, but you’ve got 12345678 - that’s just placeholder text. Same with the form GUID. When these don’t match a real form in your account, the API gives you a 415 error instead of something useful. Go to Marketing > Forms in HubSpot, pick your form, and grab the actual embed code. The real portal ID and form GUID are in there. I wasted hours on this same issue because I was using example values from the docs.

The 415 error with form submissions is a pain I’ve dealt with countless times. While everyone’s focusing on technical fixes, you’re missing the bigger picture.

Manual API submissions are fragile. Field mappings change, endpoints get updated, and you’re constantly debugging weird errors.

I stopped wrestling with direct API calls years ago. Built a simple automation that handles all form submissions instead. Someone fills out the form, triggers a workflow that processes the data and sends it to HubSpot with proper formatting.

You set up field mapping once, handle errors properly, and add duplicate checking or data validation. No more 415 errors - the automation handles all the API quirks.

I use this for newsletter signups, contact forms, even complex multi-step forms. Takes 10 minutes to set up, then you never think about it again.

Your current form code stays the same. Just point it to the automation endpoint instead of HubSpot directly.

check if ur sending extra hidden fields or CSRF tokens that HubSpot doesn’t recognize. sometimes frameworks automatically add form data that breaks the API. I had this exact issue with my contact form - my CMS was injecting a _token field that HubSpot rejected. inspect the actual POST data being sent, not just what u think ur sending.

had the same issue last month! your form action url is mixing endpoints. either use the basic forms endpoint without /multipart or switch to multipart/form-data encoding. hubspot’s picky about this mismatch. try removing /multipart from your action url first - that usually fixes it.

Your field names probably don’t match what HubSpot expects. I hit this same issue with their forms API - HubSpot wants the exact property names from your form config, not generic stuff like ‘email’ or ‘firstname’. Go into your HubSpot form settings and copy the actual field names from there. Also double-check your form ID and portal ID in the action URL. Wrong IDs can throw a 415 error instead of the 404 you’d expect. Your encoding looks good though.

The 415 error happens when your form’s encoding doesn’t match what the endpoint expects. I hit this same issue building a client registration form. Your action URL has /multipart but your form uses application/x-www-form-urlencoded. HubSpot’s API is picky about this - either change your enctype to multipart/form-data or remove /multipart from your URL. Also caught that you’re using user_email in your request but email in your form field - these need to match exactly.