> This page is for Unified.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.merge.dev/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.merge.dev/_mcp/server.

# /folders

POST https://api.merge.dev/api/filestorage/v1/folders
Content-Type: application/json

Creates a `Folder` object with the given values.

Reference: https://docs.merge.dev/merge-unified/filestorage/common-models/folders/list

## Authentication

- `Authorization` header (bearer token, required) — Token-based authentication with required prefix "Bearer"

## Servers

- `https://api.merge.dev/api` (Production, default)
- `https://api-eu.merge.dev/api` (ProductionEU)
- `https://api-ap.merge.dev/api` (ProductionAPSE1)

## Request

### Query parameters

- `is_debug_mode` (boolean, optional) — Whether to include debug fields (such as log file links) in the response.
- `run_async` (boolean, optional) — Whether or not third-party updates should be run asynchronously.

### Headers

- `X-Account-Token` (string, required) — Token identifying the end user.

### Body (application/json)

This endpoint expects a FileStorageFolderEndpointRequest.

- `model` (FolderRequest, required) — # The Folder Object ### Description The `Folder` object is used to represent a collection of files and/or folders in the workspace. Could be within a drive, if it exists. ### Usage Example Fetch from the `GET /api/filestorage/v1/folders` endpoint and view their folders.

## Response

### 201

- `model` (Folder, required) — # The Folder Object ### Description The `Folder` object is used to represent a collection of files and/or folders in the workspace. Could be within a drive, if it exists. ### Usage Example Fetch from the `GET /api/filestorage/v1/folders` endpoint and view their folders.
- `warnings` (list of WarningValidationProblem, required)
- `errors` (list of ErrorValidationProblem, required)
- `logs` (list of DebugModeLog, optional)

## Types

### FolderRequest

# The Folder Object ### Description The `Folder` object is used to represent a collection of files and/or folders in the workspace. Could be within a drive, if it exists. ### Usage Example Fetch from the `GET /api/filestorage/v1/folders` endpoint and view their folders.

- `name` (string, optional, nullable) — The folder's name.
- `folder_url` (string, optional, nullable) — The URL to access the folder.
- `size` (long, optional, nullable) — The folder's size, in bytes.
- `description` (string, optional, nullable) — The folder's description.
- `parent_folder` (string, optional, nullable) — The folder that the folder belongs to.
- `drive` (string, optional, nullable) — The drive that the folder belongs to.
- `permissions` (list of PermissionRequest, optional)
- `integration_params` (map from string to any, optional, nullable)
- `linked_account_params` (map from string to any, optional, nullable)

### Folder

# The Folder Object ### Description The `Folder` object is used to represent a collection of files and/or folders in the workspace. Could be within a drive, if it exists. ### Usage Example Fetch from the `GET /api/filestorage/v1/folders` endpoint and view their folders.

- `id` (string, optional)
- `remote_id` (string, optional, nullable) — The third-party API ID of the matching object.
- `created_at` (datetime, optional) — The datetime that this object was created by Merge.
- `modified_at` (datetime, optional) — The datetime that this object was modified by Merge.
- `name` (string, optional, nullable) — The folder's name.
- `folder_url` (string, optional, nullable) — The URL to access the folder.
- `size` (long, optional, nullable) — The folder's size, in bytes.
- `description` (string, optional, nullable) — The folder's description.
- `parent_folder` (string, optional, nullable) — The folder that the folder belongs to.
- `drive` (string, optional, nullable) — The drive that the folder belongs to.
- `permissions` (list of Permission, optional)
- `remote_created_at` (datetime, optional, nullable) — When the third party's folder was created.
- `remote_updated_at` (datetime, optional, nullable) — When the third party's folder was updated.
- `remote_was_deleted` (boolean, optional) — Indicates whether or not this object has been deleted in the third party platform. Full coverage deletion detection is a premium add-on. Native deletion detection is offered for free with limited coverage. [Learn more](https://docs.merge.dev/integrations/hris/supported-features/).
- `field_mappings` (FolderFieldMappings, optional, nullable)
- `remote_data` (list of RemoteData, optional, nullable)

### WarningValidationProblem

- `title` (string, required)
- `detail` (string, required)
- `problem_type` (string, required)
- `source` (ValidationProblemSource, optional)
- `block_merge_link` (boolean, optional)
- `raw_error` (string, optional)
- `error_code` (integer, optional)

### ErrorValidationProblem

- `title` (string, required)
- `detail` (string, required)
- `problem_type` (string, required)
- `source` (ValidationProblemSource, optional)
- `block_merge_link` (boolean, optional)
- `raw_error` (string, optional)
- `error_code` (integer, optional)

### DebugModeLog

- `log_id` (string, required)
- `dashboard_view` (string, required)
- `log_summary` (DebugModelLogSummary, required)

### PermissionRequest

# The Permission Object ### Description The Permission object is used to represent a user's or group's access to a File or Folder. Permissions are unexpanded by default. ### Usage Example Fetch from the `GET Files` or `GET Folders` endpoint. Permissions are unexpanded by default. Use the query param `expand=permissions` to see more details.

- `remote_id` (string, optional, nullable) — The third-party API ID of the matching object.
- `user` (string, optional, nullable) — The user that is granted this permission. This will only be populated if the type is `USER`.
- `group` (string, optional, nullable) — The group that is granted this permission. This will only be populated if the type is `GROUP`.
- `type` (enum, optional, nullable) — Denotes what type of people have access to the file.
  - Allowed values: `USER`, `GROUP`, `COMPANY`, `ANYONE`
- `roles` (list of enum, optional, nullable) — The permissions that the user or group has for the File or Folder. It is possible for a user or group to have multiple roles, such as viewing & uploading. Possible values include: `READ`, `WRITE`, `OWNER`. In cases where there is no clear mapping, the original value passed through will be returned.
  - Allowed values: `READ`, `WRITE`, `OWNER`
- `integration_params` (map from string to any, optional, nullable)
- `linked_account_params` (map from string to any, optional, nullable)

### Permission

# The Permission Object ### Description The Permission object is used to represent a user's or group's access to a File or Folder. Permissions are unexpanded by default. ### Usage Example Fetch from the `GET Files` or `GET Folders` endpoint. Permissions are unexpanded by default. Use the query param `expand=permissions` to see more details.

- `id` (string, optional)
- `remote_id` (string, optional, nullable) — The third-party API ID of the matching object.
- `created_at` (datetime, optional) — The datetime that this object was created by Merge.
- `modified_at` (datetime, optional) — The datetime that this object was modified by Merge.
- `user` (string, optional, nullable) — The user that is granted this permission. This will only be populated if the type is `USER`.
- `group` (string, optional, nullable) — The group that is granted this permission. This will only be populated if the type is `GROUP`.
- `type` (enum, optional, nullable) — Denotes what type of people have access to the file.
  - Allowed values: `USER`, `GROUP`, `COMPANY`, `ANYONE`
- `roles` (list of enum, optional, nullable) — The permissions that the user or group has for the File or Folder. It is possible for a user or group to have multiple roles, such as viewing & uploading. Possible values include: `READ`, `WRITE`, `OWNER`. In cases where there is no clear mapping, the original value passed through will be returned.
  - Allowed values: `READ`, `WRITE`, `OWNER`
- `remote_was_deleted` (boolean, optional) — Indicates whether or not this object has been deleted in the third party platform. Full coverage deletion detection is a premium add-on. Native deletion detection is offered for free with limited coverage. [Learn more](https://docs.merge.dev/integrations/hris/supported-features/).
- `field_mappings` (PermissionFieldMappings, optional, nullable)

### FolderFieldMappings

- `organization_defined_targets` (map from string to any, optional)
- `linked_account_defined_targets` (map from string to any, optional)

### RemoteData

# The RemoteData Object ### Description The `RemoteData` object is used to represent the full data pulled from the third-party API for an object. ### Usage Example TODO

- `path` (string, required) — The third-party API path that is being called.
- `data` (any, optional) — The data returned from the third-party for this object in its original, unnormalized format.

### ValidationProblemSource

- `pointer` (string, required)

### DebugModelLogSummary

- `url` (string, required)
- `method` (string, required)
- `status_code` (integer, required)

### PermissionFieldMappings

- `organization_defined_targets` (map from string to any, optional)
- `linked_account_defined_targets` (map from string to any, optional)

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "model": {
    "id": "e021f7a7-74fc-4487-8e12-14180c92d3b7",
    "remote_id": "14",
    "created_at": "2021-09-15T00:00:00Z",
    "modified_at": "2021-10-16T00:00:00Z",
    "name": "R&D",
    "folder_url": "https://drive.com/1234",
    "size": 2738000,
    "description": "All things R&D related at Merge!",
    "parent_folder": "47ce474c-asdf-34a2-754r-629f799f7d31",
    "drive": "31ce474c-asdf-34a2-754r-629f799f7d12",
    "permissions": [
      {
        "id": "105b9265-0d52-4e5c-bb88-0cb681ec77f6",
        "remote_id": "102895",
        "created_at": "2020-03-31T00:00:00Z",
        "modified_at": "2020-06-20T00:00:00Z",
        "user": "21ce474c-asdf-34a2-754r-629f799f7d12",
        "group": null,
        "type": "USER",
        "roles": [
          "OWNER"
        ],
        "remote_data": null
      },
      {
        "id": "a77ac1b4-a04f-4baa-a388-de3c0c173e1c",
        "remote_id": null,
        "created_at": "2020-03-31T00:00:00Z",
        "modified_at": "2020-06-20T00:00:00Z",
        "user": null,
        "group": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "type": "GROUP",
        "roles": [
          "READ"
        ],
        "remote_data": null
      }
    ],
    "remote_created_at": "2024-02-02T00:00:00Z",
    "remote_updated_at": "2024-06-10T00:00:00Z",
    "remote_was_deleted": true,
    "field_mappings": {
      "organization_defined_targets": {
        "custom_key": "custom_value"
      },
      "linked_account_defined_targets": {
        "custom_key": "custom_value"
      }
    },
    "remote_data": [
      {
        "path": "/folders",
        "data": null
      }
    ]
  },
  "warnings": [
    {
      "title": "Unrecognized Field",
      "detail": "An unrecognized field, age, was passed in with request data.",
      "problem_type": "UNRECOGNIZED_FIELD",
      "source": {
        "pointer": "/age"
      },
      "block_merge_link": true,
      "raw_error": "string",
      "error_code": 1
    }
  ],
  "errors": [
    {
      "title": "Missing Required Field",
      "detail": "custom_fields is a required field on model.",
      "problem_type": "MISSING_REQUIRED_FIELD",
      "source": {
        "pointer": "/model/custom_fields"
      },
      "block_merge_link": true,
      "raw_error": "string",
      "error_code": 1
    }
  ],
  "logs": [
    {
      "log_id": "99433219-8017-4acd-bb3c-ceb23d663832",
      "dashboard_view": "https://app.merge.dev/logs/99433219-8017-4acd-bb3c-ceb23d663832",
      "log_summary": {
        "url": "www.exampleintegration.com/api/v1/exampleapi",
        "method": "POST",
        "status_code": 200
      }
    }
  ]
}
```

**SDK Code**

```python
import requests

url = "https://api.merge.dev/api/filestorage/v1/folders"

payload = {}
headers = {
    "X-Account-Token": "X-Account-Token",
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.merge.dev/api/filestorage/v1/folders';
const options = {
  method: 'POST',
  headers: {
    'X-Account-Token': 'X-Account-Token',
    Authorization: 'Bearer <token>',
    'Content-Type': 'application/json'
  },
  body: '{}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.merge.dev/api/filestorage/v1/folders"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("X-Account-Token", "X-Account-Token")
	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.merge.dev/api/filestorage/v1/folders")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-Account-Token"] = 'X-Account-Token'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.merge.dev/api/filestorage/v1/folders")
  .header("X-Account-Token", "X-Account-Token")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.merge.dev/api/filestorage/v1/folders', [
  'body' => '{}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
    'X-Account-Token' => 'X-Account-Token',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.merge.dev/api/filestorage/v1/folders");
var request = new RestRequest(Method.POST);
request.AddHeader("X-Account-Token", "X-Account-Token");
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "X-Account-Token": "X-Account-Token",
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.merge.dev/api/filestorage/v1/folders")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```