API field names don't correspond to Form UI field names


I'm using the form API to submit from my javascript client to my forms in hubspot. Some of the fields are ok: I am able to tell what name they should be from the name in the form UI. But most of them, and especially any non standard one such as "date of birth", don't work. I tried data_of_birth, dateofBirth, dateOfBirth, DateOfBirth, date_of_birth_property...nothing works. Worse yet, the API docs do not cover this. It only says "it follows the same format as the Contacts API". But when you look at the Contacts API, it doesn't use the fields: {} field it uses properties: {}. And still doesn't dicuss the format. This is a crucial piece of info to use the API. https://developers.hubspot.com/docs/methods/forms/submit_form_v3

No matter what I put in the request, I always get something like:

"status": "error",
"message": "The request is not valid",
"correlationId": "6df6de0c-ee28-4934-b585-208650f06619",
"errors": [
"message": "Error in 'fields.dateofbirth'. Field 'dateofbirth' isn't in form definition",
"requestId": "858912a1da6908f18b68e0e5c8f5cd8a"

Request payload:

"fields": [
{"name": "email", "value": "brucewayne@gmail.com"},
{"name": "firstname", "value": "Bruce"},
{"name": "lastname", "value": "Wayne"},
{"name": "phone", "value": "4052023432"},
{"name": "date_of_birth", "value": "04231956"}

"legalConsentOptions": {
"legitimateInterest": {
"value": true,
"subscriptionTypeId": 999,
"legalBasis": "CUSTOMER",
"text": "Legitimate interest consent text"



Going from the error message, it seems like the wrong internal name for the field might have been used here. A great way to check into this is to head over to your property settings in HS, find this property and check the 'Internal name'. I hope that helps!