# Wait for API response in workflow

**URL:** <https://forum.bubble.io/t/wait-for-api-response-in-workflow/45236>\
**Category:** APIs\
**Created:** [December 23, 2018, 5:01am UTC](https://forum.bubble.io/t/wait-for-api-response-in-workflow/45236 "2018-12-23T05:01:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jon2](https://avatars.discourse-cdn.com/v4/letter/j/e47774/32.png) [@jon2](https://forum.bubble.io/u/jon2)\
**Post date:** [December 23, 2018, 5:01am UTC](https://forum.bubble.io/t/wait-for-api-response-in-workflow/45236/1 "2018-12-23T05:01:47Z")

</div>

I’ve encountered an issue that seems so obvious that I’m almost hesitant to ask about it. I’ve searched and I don’t see anything so I’ll just ask 🙂

I have a workflow that pulls data from an API, saves that data to a state, and then does something with that data (stored as a state… My broad question is, how can I make sure I’ve gotten a response before continuing then next steps in the workflow. Is this even possible to have a async wait of sorts? Sometimes if the initial API response is slow then subsequent steps fail because there is no data available for them to do work on, I don’t like putting in delays because this doesn’t seem robust (what if the delay isn’t long enough) and inefficient (there is a delay every time even when the response is quick)

My apologies if this has been addressed before.

Thanks

---

<div class="post-metadata">

**Author:** ![philip](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/philip/32/17830_2.png) [@philip](https://forum.bubble.io/u/philip)\
**Post date:** [December 23, 2018, 5:35am UTC](https://forum.bubble.io/t/wait-for-api-response-in-workflow/45236/2 "2018-12-23T05:35:33Z")

</div>

> [@jon2](#):
>
> how can I make sure I’ve gotten a response before continuing then next steps in the workflow. Is this even possible to have a async wait of sorts? Sometimes if the initial API response is slow then subsequent steps fail because there is no data available for them to do work on

In my use cases this seems to be addressed by Bubble when placing a conditional statement on the subsequent steps following API data retrieval “When Result of Step 1’s:api\_data\_field\_retrieved is not empty”

> [@jon2](#):
>
> I don’t like putting in delays

AFAIK the delays only affect events on screen and not API/database related operations, so this won’t help even if you did add a 5-10 second delay. Try adding the conditional mentioned above and see if that fixes the issue. I’ve also noticed, even without conditionals, if I try and use a variable returned by an API in later workflow steps (ie Make changes to thing), Bubble will wait until that value is returned before attempting to commit changes. It’s possible I’ve always requested data that’s quickly accessible, and your API requests are taking longer and in turn behaving differently. I’m interested to hear from others if there is a better way to address this.

---

<div class="post-metadata">

**Author:** ![jon2](https://avatars.discourse-cdn.com/v4/letter/j/e47774/32.png) [@jon2](https://forum.bubble.io/u/jon2)\
**Post date:** [December 23, 2018, 2:02pm UTC](https://forum.bubble.io/t/wait-for-api-response-in-workflow/45236/3 "2018-12-23T14:02:36Z")

</div>

Thanks for the reply! I have never tried the conditional method you mentioned i.e.

`FILTER STEP 2 IF: Step 1 - API Response is empty`

My assumption was that the built-in bubble workflow logic would not wait for the API response and just filter the action. I’ll give it a try!
