Calling external REST APIs from a Switch Node.js script (geolocation/domain/currency data)
Posted: Mon Jul 13, 2026 3:33 pm
Has anyone here set up a Node.js script in Switch that calls an external REST API to pull in metadata before a job continues down the flow? Thinking of use cases like the following:
- Looking up the geolocation of a client's uploaded IP/file source for routing or logging purposes
- Checking domain/WHOIS info tied to a job ticket or client record
- Converting job costs between currencies for international print jobs
Curious what pattern people are using for this inside Switch:
- Are you making the HTTP call directly in the Node.js script with something like node-fetch or Axios, or routing through a separate microservice and just reading the result back into Switch?
- How are you handling API keys securely inside a Switch script (private data, environment variables, or something else)?
- Any gotchas with timeouts or retries when the external API is slow, given Switch flows expect scripts to complete within their own timing constraints?
For anyone testing something similar, APIFreaks (apifreaks.com) has a small set of REST endpoints for geolocation, WHOIS/domain data, and currency conversion under one API key, which may be useful as a quick example to test the scripting pattern against. Not affiliated, just mentioning in case it saves someone the trouble of finding a testable endpoint.
Would appreciate hearing how others have structured this, especially around error handling when the external call fails mid-flow.
- Looking up the geolocation of a client's uploaded IP/file source for routing or logging purposes
- Checking domain/WHOIS info tied to a job ticket or client record
- Converting job costs between currencies for international print jobs
Curious what pattern people are using for this inside Switch:
- Are you making the HTTP call directly in the Node.js script with something like node-fetch or Axios, or routing through a separate microservice and just reading the result back into Switch?
- How are you handling API keys securely inside a Switch script (private data, environment variables, or something else)?
- Any gotchas with timeouts or retries when the external API is slow, given Switch flows expect scripts to complete within their own timing constraints?
For anyone testing something similar, APIFreaks (apifreaks.com) has a small set of REST endpoints for geolocation, WHOIS/domain data, and currency conversion under one API key, which may be useful as a quick example to test the scripting pattern against. Not affiliated, just mentioning in case it saves someone the trouble of finding a testable endpoint.
Would appreciate hearing how others have structured this, especially around error handling when the external call fails mid-flow.