ExactOnline API multiple requests working locally but failing on automation platforms

I have a script that handles creating and updating records through the ExactOnline API. Everything works perfectly when I test it on my local machine, but when I deploy it to automation platforms like Zapier or n8n, it stops working properly.

const authToken = 'my_token_here';
const companyDivision = 'division_id_here';

const companyInfo = {
  "Name": "business name",
  "City": "location",
  "Website": "example.com"
};

const personDetails = {
  "FirstName": "john",
  "LastName": "doe",
  "City": "location name"
};

async function processRequest(requestType) {
  if (requestType == "create_company_and_person") {
    const companyResult = await createCompany(companyInfo);
    const newCompanyId = companyResult;
    
    personDetails.Account = newCompanyId;
    const personResult = await createPerson(personDetails);
    
    return 'Process completed successfully';
  }
}

async function createCompany(data) {
  const response = await sendPostRequest(1, data);
  return response.d.ID;
}

async function createPerson(data) {
  const response = await sendPostRequest(2, data);
  const updateData = { MainContact: response.d.ID };
  await updateCompany(updateData, data.Account);
  return response.d.ID;
}

async function sendPostRequest(requestType, payload) {
  let apiUrl = `https://start.exactonline.nl/api/v1/${companyDivision}/crm/`;
  apiUrl += requestType === 1 ? 'Accounts' : 'Contacts';
  
  const response = await fetch(apiUrl, {
    method: 'POST',
    headers: {
      'Accept': 'application/json',
      'Authorization': `Bearer ${authToken}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify(payload)
  });
  
  return await response.json();
}

async function updateCompany(updateData, companyId) {
  const updateUrl = `https://start.exactonline.nl/api/v1/${companyDivision}/crm/Accounts(guid'${companyId}')`;
  
  await fetch(updateUrl, {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': `Bearer ${authToken}`
    },
    body: JSON.stringify(updateData)
  });
}

async function executeWorkflow() {
  await processRequest("create_company_and_person");
  return "Workflow completed";
}

output = [executeWorkflow()];

The issue seems to happen specifically when making multiple API calls in sequence. Has anyone experienced similar problems with ExactOnline API on these platforms?

Yeah, that’s probably it. ExactOnline prefers slower requests, so try adding delays between calls. Also check how those platforms handle async operations – it can behave totally different than running locally.

Had the same issue moving from local dev to cloud with ExactOnline’s API. Usually it’s the auth token handling - cloud platforms cache and reuse tokens differently than local. ExactOnline tokens expire fast and their API gives terrible error messages when it happens. Add error handling to check response codes and token validity before each request. Also check if your automation platform hits the API from different IPs - ExactOnline rate limits harder based on source IP. Log the actual API responses to see what error codes you’re getting on the platform vs locally.

Classic timing issue with ExactOnline’s API on automation platforms. Your sequential calls are hitting the API too fast for ExactOnline to keep up. I’ve run into this exact problem - automation platforms like Zapier and n8n handle Promise resolution differently than running Node.js locally. ExactOnline needs time to commit that first record before you can reference it in the next call. Wrap your API calls with proper await statements and add a small delay between creating the company and creating the person. Also check your HTTP status codes - ExactOnline sometimes returns 200 but stuffs error details in the response body that automated environments miss.