# Create Folders Async

Create one or more folders from Apex asynchronously, respecting cloud-storage and Salesforce rate limits.

> Kind: Apex method · Updated: 2026-07-01

## Signature

```apex
global static void createFoldersAsync(
  List<Types.CreateFolderInput> inputs,
  String libraryId,
  String runAs
)
```

### Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| inputs | List&lt;<a href="#/apex-type-create-folder-input">Types.CreateFolderInput</a>&gt; | required | One entry per folder. Provide a request id (random string) with each input to later filter the CloudFiles Event Object for the newly created folder. |
| libraryId | String | required | Type of library, e.g. sharepoint. Get this value from the Content Library. |
| runAs | String | optional | Email of the user on whose behalf the action runs. Supply integrationUser to run as the automation user. |

## Return Type

void — this method runs asynchronously and does not return information about the newly created folders. Filter the CloudFiles Event Object using the request id supplied on each input to retrieve details of the created folder.

## Example

```apex
List<cldfs.Types.CreateFolderInput> inputs = new List<cldfs.Types.CreateFolderInput>{
    new cldfs.Types.CreateFolderInput('01PLJOYLOAWJBFGBSE7FHK5AKOSIMDIO6H', 'TestFolder', 'b!ZfA15HRS1Uy9pH3Vw5tFjAHfP1lRYlZAvDwLnHYYq8sa-L6ejXB-TJbMYUxi1QfL', 'super-random-string')
};
cldfs.Client.createFoldersAsync(
   inputs,
  'sharepoint',
  'integrationUser'
);
```

> **When to use** — Prefer createFoldersAsync over createFolders when migrating large amounts of data — it handles both cloud-storage and Salesforce rate limits.
