Synchronous or asynchronous execution
Both execution models have different trade-offs.| Execution mode | Pros | Cons | Best fit for | 
|---|---|---|---|
| Synchronous | 
  | 
  | 
  | 
| Asynchronous | 
  | 
  | 
  | 
Executing action asynchronously
To trigger an action asynchronously, add theX-Async header or use the triggerActionAsync SDK method.
- cURL (standard endpoint)
 - Node SDK
 
X-Max-Retries header (the value must be between 0 and 5):
When using retries with asynchronous actions, make sure your action logic is idempotent. This means that running the action multiple times with the same input should produce the same result without unwanted side effects.
Response format
When triggering an action asynchronously, the response will include a status URL and ID that you can use to poll to obtain the action result:Checking the action result
Poll the action result endpoint to check if the action has completed:- cURL
 - Node SDK
 
Execution timing for asynchronous actions is not guaranteed. Actions are currently processed sequentially per environment, so execution time depends on how many actions are triggered and how long each one runs. Design your implementation to handle potential delays.
- Returns a 
404error if the action has not completed yet - Returns a 
200with the actual result data once the action completes successfully - Returns a 
500with an error once the action completes with a failure 
Receiving webhook notifications
Instead of polling, configure webhooks to be notified when an async action completes.- Set up webhooks from Nango to your app
 - Enable the 
Async action completedwebhook for your environment - When an action completes, Nango sends:
 
Troubleshoot errors & monitor
Navigate to the Logs tab to inspect potential errors and monitor action executions.Questions, problems, feedback? Please reach out in the Slack community.