How to Create a Folder in a SharePoint Library with the REST API in Power Automate
A flow can create a folder in a document library with one REST request to _api/web/folders. Paired with a quick check that the folder isn't there yet, the flow can run any number of times and still leave exactly one folder.
Syntax
Both requests go through Send an HTTP request to SharePoint (How to Use Send an HTTP Request to SharePoint).
Look for the folder
| Field | Value |
|---|---|
| Method | GET |
| Uri | _api/web/lists/getbytitle('<library name>')/rootfolder/folders?$filter=Name eq '<folder name>'&$select=Name |
| Headers | Accept: application/json;odata=nometadata |
<library name>: the library's title, as in Site contents.rootfolder/folders: the folders at the top of the library.$filter=Name eq '<folder name>': only the folder with that name.$select=Namekeeps the answer short.
The answer has a value array: one folder when it exists, empty when it doesn't.
Create the folder
| Field | Value |
|---|---|
| Method | POST |
| Uri | _api/web/folders |
| Headers | Accept: application/json;odata=nometadata |
Content-Type: application/json;odata=verbose |
{
"__metadata": { "type": "SP.Folder" },
"ServerRelativeUrl": "<address of the new folder>"
}
This is the request in Microsoft's Working with folders and files with REST.
<address of the new folder>: the folder's address from the server's root: the site's path, the library's web address, then the folder's name. On the root site, a folder 2026 in the library at/Contractsis/Contracts/2026. On a site at/sites/Finance, it would be/sites/Finance/Contracts/2026.
The Example
A document library called Contracts, on the root site, gets a folder called 2026. The flow, Create a Folder, has four parts:
- Manually trigger a flow.
- Find the folder, the GET.
- If the folder is missing, a condition.
- Create the folder, the POST, in the condition's True branch.
Prerequisites
- Permission to add to the library, such as Edit or Contribute, for the account the flow's SharePoint connection uses.
Step 1: Look for the Folder
Add Send an HTTP request to SharePoint and rename it Find the folder:
| Field | Value |
|---|---|
| Site Address | Your site |
| Method | GET |
| Uri | _api/web/lists/getbytitle('Contracts')/rootfolder/folders?$filter=Name eq '2026'&$select=Name |
| Headers | Accept: application/json;odata=nometadata |

Step 2: Create It Only When It's Missing
Add a Condition and rename it If the folder is missing (How to Add a Condition in Power Automate). On the left, add this expression; choose is equal to; on the right, add the expression true:
empty(body('Find_the_folder')?['value'])
empty() is true when the value array has no folders in it (How to Check If an Array Is Empty in Power Automate). Find_the_folder is the action's name with underscores for spaces.
Step 3: Create the Folder
In the condition's True branch, add Send an HTTP request to SharePoint and rename it Create the folder:
| Field | Value |
|---|---|
| Site Address | Your site |
| Method | POST |
| Uri | _api/web/folders |
| Headers | Accept: application/json;odata=nometadata |
Content-Type: application/json;odata=verbose |
{
"__metadata": { "type": "SP.Folder" },
"ServerRelativeUrl": "/Contracts/2026"
}

Step 4: Run the Flow Twice
Save the flow and test it manually (How to Test a Cloud Flow Manually in Power Automate). On the first run, Find the folder found nothing, and Create the folder created it.
Then I ran it again with Test > Automatically > With a recently used trigger (How to Rerun a Cloud Flow with the Same Inputs in Power Automate). This time Find the folder found 2026, the condition was false, and Create the folder was skipped, shown by its grey sign:

The Result
The Contracts library has one 2026 folder, after two runs:

Common Mistakes
| Mistake | What happens | Do this instead |
|---|---|---|
Leaving out the site's path on a site under /sites/ | The address points at the root site | Start with the site's path, such as /sites/Finance/Contracts/2026 |
| Creating without looking first | A second run tries to create it again | Look for the folder and create it only when it's missing |
The library's address in getbytitle('…') | No list has that title | Use the library's title there, and its address in ServerRelativeUrl |
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| Find the folder fails with status 404 | No library with that title | Check the title in Site contents |
| Create the folder fails with status 404 or 400 | The address in ServerRelativeUrl is wrong | Check the site's path and the library's web address |
| The condition is always false | The expression names another action | Match the action's name, with underscores for spaces |
FAQ
Isn't there an action for this?
Yes. The SharePoint connector has Create new folder, which Microsoft describes as creates a new folder or folder path (Microsoft SharePoint Connector in Power Automate). The REST request fits a flow that already talks to SharePoint through REST, and takes the address as plain text.
How do I put the site's path in the address?
Read it from the site. On a site under /sites/, a GET to _api/web?$select=ServerRelativeUrl returns its path, such as /sites/Finance, and the folder's address is that path followed by /Contracts/2026. The Overtime Timesheet setup flow builds its folder's address this way.
Does this need a premium licence?
No. Send an HTTP request to SharePoint is part of the standard SharePoint connector.
Conclusion
Look for the folder with a GET on rootfolder/folders?$filter=Name eq '<folder name>', and when the value array is empty, POST an SP.Folder with its ServerRelativeUrl to _api/web/folders. The flow then creates the folder once, however often it runs.
Additional Resources
- Working with folders and files with REST: creating, renaming and deleting folders.
- Microsoft SharePoint Connector in Power Automate: the connector's own folder actions.
