> 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.

# /files

GET https://api.merge.dev/api/filestorage/v1/files

Returns a list of `File` objects.

Reference: https://docs.merge.dev/merge-unified/filestorage/common-models/files/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

- `created_after` (datetime, optional) — If provided, will only return objects created after this datetime.
- `created_before` (datetime, optional) — If provided, will only return objects created before this datetime.
- `cursor` (string, optional) — The pagination cursor value.
- `drive_id` (string, optional) — Specifying a drive id returns only the files in that drive. Specifying null returns only the files outside the top-level drive.
- `expand` (list of enum, optional) — Which relations should be returned in expanded form. Multiple relation names should be comma separated without spaces.
  - Allowed values: `drive`, `folder`, `permissions`
- `folder_id` (string, optional) — Specifying a folder id returns only the files in that folder. Specifying null returns only the files in root directory.
- `include_deleted_data` (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/).
- `include_remote_data` (boolean, optional) — Whether to include the original data Merge fetched from the third-party to produce these models.
- `include_shell_data` (boolean, optional) — Whether to include shell records. Shell records are empty records (they may contain some metadata but all other fields are null).
- `mime_type` (string, optional) — If provided, will only return files with these mime_types. Multiple values can be separated by commas.
- `modified_after` (datetime, optional) — If provided, only objects synced by Merge after this date time will be returned.
- `modified_before` (datetime, optional) — If provided, only objects synced by Merge before this date time will be returned.
- `name` (string, optional) — If provided, will only return files with this name. This performs an exact match.
- `order_by` (enum, optional) — Overrides the default ordering for this endpoint. Possible values include: created_at, -created_at, modified_at, -modified_at.
  - Allowed values: `-created_at`, `-modified_at`, `created_at`, `modified_at`
- `page_size` (integer, optional) — Number of results to return per page. The maximum limit is 100.
- `remote_created_after` (datetime, optional) — If provided, will only return files created in the third party platform after this datetime.
- `remote_created_before` (datetime, optional) — If provided, will only return files created in the third party platform before this datetime.
- `remote_id` (string, optional) — The API provider's ID for the given object.

### Headers

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

## Response

### 200

- `next` (string, optional, nullable)
- `previous` (string, optional, nullable)
- `results` (list of File, optional)

## Types

### File

# The File Object ### Description The `File` object is used to represent a file in the workspace. The Object typically exists under a folder or drive, if it exists. ### Usage Example Fetch from the `GET /api/filestorage/v1/files` endpoint and view their files.

- `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 file's name.
- `file_url` (string, optional, nullable) — The URL to access the file.
- `file_thumbnail_url` (string, optional, nullable) — The URL that produces a thumbnail preview of the file. Typically an image.
- `size` (long, optional, nullable) — The file's size, in bytes.
- `mime_type` (string, optional, nullable) — The file's mime type.
- `description` (string, optional, nullable) — The file's description.
- `folder` (string, optional, nullable) — The folder that the file belongs to.
- `checksum` (map from string to any, optional, nullable) — This field stores file checksum data. 'type' indicates the algorithm (e.g. crc_32, sha1, sha256, quickXor, or md5), and 'content_hash' is the unique hash used to verify file integrity and detect alterations.
- `permissions` (list of Permission, optional)
- `drive` (string, optional, nullable) — The drive that the file belongs to.
- `remote_created_at` (datetime, optional, nullable) — When the third party's file was created.
- `remote_updated_at` (datetime, optional, nullable) — When the third party's file 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` (FileFieldMappings, optional, nullable)
- `remote_data` (list of RemoteData, 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)

### FileFieldMappings

- `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.

### PermissionFieldMappings

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

## Examples

**Response**

```json
{
  "next": "cD0yMDIxLTAxLTA2KzAzJTNBMjQlM0E1My40MzQzMjYlMkIwMCUzQTAw",
  "previous": "cj1sZXdwd2VycWVtY29zZnNkc2NzUWxNMEUxTXk0ME16UXpNallsTWtJ",
  "results": [
    {
      "id": "45ce474c-dhcj-43a6-754r-629f799f7d68",
      "remote_id": "12",
      "created_at": "2021-09-15T00:00:00Z",
      "modified_at": "2021-10-16T00:00:00Z",
      "name": "merge_file_storage_launch.docx",
      "file_url": "https://drive.com/1234",
      "file_thumbnail_url": "https://drive.com/1234/thumbnail.png",
      "size": 254,
      "mime_type": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
      "description": "Use common model scopes to redact data returned in Merge's Common Models!",
      "folder": "8e889422-e086-42dc-b99e-24d732039b0b",
      "checksum": {
        "content_hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
        "type": "sha256"
      },
      "permissions": [
        {
          "id": "31ce489c-asdf-68b1-754r-629f799f7123",
          "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": "2ea7db93-1ae9-4686-82c9-35c768000736",
          "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
        }
      ],
      "drive": "204ca79c-0c86-4f6c-9ca6-61b946a4708a",
      "remote_created_at": "2022-02-02T00:00:00Z",
      "remote_updated_at": "2022-02-03T00: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": "/files",
          "data": null
        }
      ]
    }
  ]
}
```

**SDK Code**

```python
import requests

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

querystring = {"include_remote_data":"true"}

headers = {
    "X-Account-Token": "X-Account-Token",
    "Authorization": "Bearer <token>"
}

response = requests.get(url, headers=headers, params=querystring)

print(response.json())
```

```javascript
const url = 'https://api.merge.dev/api/filestorage/v1/files?include_remote_data=true';
const options = {
  method: 'GET',
  headers: {'X-Account-Token': 'X-Account-Token', Authorization: 'Bearer <token>'}
};

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"
	"net/http"
	"io"
)

func main() {

	url := "https://api.merge.dev/api/filestorage/v1/files?include_remote_data=true"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("X-Account-Token", "X-Account-Token")
	req.Header.Add("Authorization", "Bearer <token>")

	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/files?include_remote_data=true")

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

request = Net::HTTP::Get.new(url)
request["X-Account-Token"] = 'X-Account-Token'
request["Authorization"] = 'Bearer <token>'

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.get("https://api.merge.dev/api/filestorage/v1/files?include_remote_data=true")
  .header("X-Account-Token", "X-Account-Token")
  .header("Authorization", "Bearer <token>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.merge.dev/api/filestorage/v1/files?include_remote_data=true', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'X-Account-Token' => 'X-Account-Token',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.merge.dev/api/filestorage/v1/files?include_remote_data=true");
var request = new RestRequest(Method.GET);
request.AddHeader("X-Account-Token", "X-Account-Token");
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "X-Account-Token": "X-Account-Token",
  "Authorization": "Bearer <token>"
]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.merge.dev/api/filestorage/v1/files?include_remote_data=true")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

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()
```