We have a form on our site that is not built in Hubspot.
We want to send leads to Hubspot CRM via an API.
One of my partners is using this format but it gives us a 400 error message:
https://forms.hubspot.com/uploads/form/v2/:portlID/:guid
When trying to use this format, we get a 401 (unautherized)
https://api.hsforms.com/submissions/v3/integration/secure/submit/portalID/guid
What should I do to receive leads? What url structure should I use and do I need an oath / API key? And if so, where can I set it and how to use it?
Thank you
Hi @SKuvent,
In order to use this API, you will need to use the Bearer Token that you can obtain by setting up a Private App on HubSpot. There you will select the necessary scopes and will receive the Access Token that you will use to make the API call.
The /submissions/v2/post/upload/secure/:portalId/:formGuid endpoint will require the “forms” scope.
To see more details regarding the form submission endpoint, see this document:
Hope this helps!
Hi @SKuvent
on form submit call an API end point to your server. In the server side use the HubSpot API (curl provided below) to create contact in your instance. You have the create a pvt app and provide contact create and update scope to it, then it will create a access token which you have to use to hit the HubSpot endpoint. If you want to send the HubSpot properties then use their internal name from instance.
curl --request POST \
--url https://api.hubapi.com/crm/v3/objects/contacts \
--header 'authorization: Bearer YOUR_ACCESS_TOKEN' \
--header 'content-type: application/json' \
--data '{
"associations": [
{
"types": [
{
"associationCategory": "HUBSPOT_DEFINED",
"associationTypeId": 0
}
],
"to": {
"id": "string"
}
}
],
"objectWriteTraceId": "string",
"properties": {
"additionalProp1": "string",
"additionalProp2": "string",
"additionalProp3": "string"
}
}'
I hope this will help you out. Please mark it as Solution Accepted and upvote to help another Community member.
Thanks!