Last week, I worked for a client who needed to process API responses in Power Automate. The challenge? Sometimes, the API would return an empty body, and the flow required to handle it gracefully without breaking. If you have ever encountered this issue, you know how frustrating it can be when your flow fails because the response is empty.
We can check if the array is empty in Power Automate to avoid this. In this tutorial, I will show you three different ways to do this:
- Using the Power Automate empty() Function with a Condition Action
- Using the Power Automate length() Function with a Condition Action
- Check for an Empty Array with the First Index in Power Automate
Different Methods to Check If an Array Is Empty in Power Automate
Here, we will check if an array is empty in Microsoft Power Automate. I will cover two standard methods: using the empty() function and the length() function.
Using empty() Function [with a Condition Action]
This method checks if the array is empty using the empty() function. Now, follow the below steps:
1. Go to Power Automate -> + Create -> Instant cloud flow -> Name it “Check Empty Array” -> Select Manually trigger a flow -> Create.

2. Add the Initialize variable and provide the below parameters:
- Name: myArray.
- Type: Array.
- Value: [] (empty).

3. Add a Condition Action and provide the below:
- Left side: empty(variables(‘myArray’)) (use the “Expression” tab).
- Operator: is equal to.
- Right side: true (type in “Expression” tab).

4. In the true section, add a compose prover the value as Array is empty. In the same way, in the False section, add a Compose action and provide the value as Array is not empty.

Save and run the flow. After the flow runs successfully, you can see the true part will run because our array variable is empty.

Using length() Function [With a Condition Action]
This method uses the length() function to check if the array has zero elements. To do this, follow the below steps:
1. Same as above: Instant cloud flow -> “Check Empty Array” -> Manually trigger a flow.

2. Add the Initialize variable action and provide the below parameter:
- Name: myArray.
- Type: Array.
- Value: [1, 2, 3] (non-empty).

3. Add a Condition Action and provide the below:
- Left side: length(variables(‘myArray’)) (use the “Expression” tab).
- Operator: is equal to.
- Right side: 0 (as a value).

4. In the ‘True’ section, add a Compose action with the value Array is empty. Similarly, in the ‘False’ section, add a Compose action with the value Array is not empty.

Save and run the flow. Once the flow executes successfully, you will see that the ‘False’ section runs because the array variable is not empty.

Check for an Empty Array with the First Index in Power Automate
Suppose you have a Power Automate flow that receives an array of items (e.g., a list of names). Before proceeding, you want to check if the array is empty.
To do this, follow the below steps:
1. Go to Power Automate -> Click + Create -> Instant Cloud Flow -> Name your flow (Check Empty Array) and select Manually trigger a flow as the trigger -> Click Create.

2. Add a new action Initialize variable action and provide the below parameter:
- Name: myArray
- Type: Array
- Value: For testing non-empty arrays like [“Alice”, “Bob”, “Charlie”].

3. Add a Condition to check the First Index and provide the below parameter:
- First field: variables(‘myArray’)?[0]
(This expression checks the first element of myArray. The? ensures no error if the array is empty, returning null instead.)
- Operator: is equal to
- Second field: null (type this directly or use the expression null).
This condition checks if the first index ([0]) is null, which happens when the array is empty.

4. In the ‘True’ section, add a Compose action with the value ‘The array is empty‘. In the same way, in the False section, add a Compose action and provide the value as “The array has items: @{join(variables(‘myArray’),’,’)}.”

Click Save, then Test -> Manually. After the flow runs successfully, the false part will run.

Conclusion
In this tutorial, we explored three ways to check if an array is empty in Power Automate. We used the empty() function to determine if an array has no elements, the length() function to check if the array’s size is zero, and the first index method to verify if the first element exists.
You may also like:
- Check If an Array Contains Value in Power Automate
- Check If an Input String Is an Integer Using Power Automate
- Check IF Attachment Exists Using Power Automate
- Check If the Filename Contains in Power Automate
- Check IF SharePoint List is Empty in Power Automate
- Check if SharePoint List Already Exists in Power Automate

Hey! I’m Bijay Kumar, founder of SPGuides.com and a Microsoft Business Applications MVP (Power Automate, Power Apps). I launched this site in 2020 because I truly enjoy working with SharePoint, Power Platform, and SharePoint Framework (SPFx), and wanted to share that passion through step-by-step tutorials, guides, and training videos. My mission is to help you learn these technologies so you can utilize SharePoint, enhance productivity, and potentially build business solutions along the way.