Can i run 2 api calls in one workflow?

I’m working on an app where users can upload an image, initiate an API call to generate an AI image based on a prompt, and then another API call to receive the generated image. However, when attempting the second API call to receive the image, the output is consistently empty. Specifically, if I create the two steps in one workflow, the second API call output always comes back empty—there is no file present.

As a temporary solution, I created a separate page called “result” where the data is successfully received from the database on load. The workflow on this page involves an API call to generate the image, create database entries, and handle images, resulting in a successful outcome.

Now, I’m wondering why making two API calls in the same page doesn’t work as expected, and I’m looking for a solution to avoid creating a new page just to load the result. Any insights or suggestions would be appreciated.



1 Like

@MoeMehdawi

The API is likely running asynchronously so this means that you need to poll it to extract the result … or if it offers a webhook build this endpoint.

that’s true,

first API image generating takes up to 10 seconds, so I add a pause of 20 seconds then in the same workflow I pull the image however the result always empty output

it only work if i add new page and on page load, i pull the image (second API) call

i can’t figure out why it can’t be done in the same page or workflow

to give you visual how the workflow i am trying to do

generate image API call > wait 20 second > pull the image API call > display the image
never worked

i have to make a new page to solve it
generate image API call > wait 20 second >create new thing > navigate to page results
Now, on the page result

when page load > API call to pull the image > display image

Please note that polling is not pausing …