We have a very simple custom form on a website that we want to have submit via POST to our Keap account. Lead fills out a simple form, they then get placed into our Keap account as a Customer.
The API docs look pretty straightforward, making the connection to the API seems to be where things fall apart. At this time, we’re using a simple Personal Access Token, instead of building a complete backend and making the many API calls through authentication, then tokenization, then to /contacts. We’re starting here and may switch to building out a full back-end.
This is our fetch with a method of POST when the form is submitted:
/api.infusionsoft.com/crm/rest/contacts’, {
method: ‘POST’,
headers: {
‘Content-Type’: ‘application/x-www-form-urlencoded’,
‘X-Keap-API-Key’: process.env.PAT,
},
body: {
email_addresses: [
{
email: ‘email@test.com’,
},
],
},
})
What we get is: CORS error
Request URL: https://api.infusionsoft.com/crm/rest/contacts
Referrer Policy: strict-origin-when-cross-origin