ExactOnline API multiple requests work locally but fail on automation platforms

I’m having trouble with my ExactOnline API integration. My script works perfectly when I test it on my local machine, but it breaks when I deploy it to automation platforms like Zapier or n8n. The issue seems to happen right before making fetch requests.

const authToken = 'your-token-here';
const companyId = 'division-id';

const clientInfo = {
  "CompanyName": "sample company",
  "Location": "sample city",
  "WebAddress": "example.com"
};

const personInfo = {
  "GivenName": "john",
  "FamilyName": "doe", 
  "Location": "sample city"
};

async function processRequest(requestType) {
  if (requestType == "create_client_and_person") {
    const clientResult = await createClient(clientInfo);
    const clientGUID = clientResult;
    
    personInfo.ClientAccount = clientGUID;
    const personResult = await createPerson(personInfo);
    
    return 'Process completed successfully';
  }
}

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

async function createPerson(data) {
  const response = await sendPOST(2, data);
  
  const updateData = {
    PrimaryContact: response.d.ID
  };
  
  await updateClient(updateData, data.ClientAccount);
  return response.d.ID;
}

async function sendPOST(entityType, payload) {
  let apiUrl = `https://start.exactonline.nl/api/v1/${companyId}/crm/`;
  apiUrl += entityType === 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();
}

Anyone else run into this problem with ExactOnline API calls on these platforms?

Check if your automation platform handles async/await properly. Zapier and n8n sometimes choke on nested async functions - especially when you’re doing createClient then createPerson back-to-back. They might timeout during those sequential API calls or just not wait for promises to finish. Wrap everything in try/catch blocks and log the actual error responses you get. Also test whether it fails on the first API call or just the second one - that’ll tell you if it’s the platform being weird or an actual API problem.

I’ve hit this exact issue with ExactOnline before. It’s definitely rate limiting - their API has pretty strict throttling that automation platforms trigger way more than local environments. When you’re doing createClient then createPerson back-to-back, the platform’s probably firing them off too fast. Set up a retry with exponential backoff and check those response headers for rate limit info. Also double-check your auth token has the right scopes for both Accounts and Contacts endpoints - I’ve seen platforms handle token permissions weird compared to local testing.

i had similar issues w/ ExactOnline API on n8n. might be a timeout thing – those platforms can be picky. adding some error handling and maybe a delay could help, especially since u’re hitting the API twice in a row.