> This page is for Developer Documentation.

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

# List files

GET https://{tenant_name}.benchling.com/api/v2-beta/files

List files

Reference: https://docs.benchling.com/docs/api/v2-beta/benchling-api-beta/files/list-files

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Query parameters

- `pageSize` (integer, optional, default: 50) — Number of results to return.
- `nextToken` (string, optional)
- `sort` (enum, optional, default: modifiedAt) — Method by which to order search results. Valid sorts are modifiedAt (modified time, most recent first) createdAt (creation time, most recent first) and name (item name, alphabetical). Optionally add :asc or :desc to specify ascending or descending order. Default is modifiedAt.
  - Allowed values: `modifiedAt`, `name`, `createdAt`, `modifiedAt:asc`, `name:asc`, `createdAt:asc`, `modifiedAt:desc`, `name:desc`, `createdAt:desc`
- `archiveReason` (string, optional) — Archive reason. Restricts items to those with the specified archive reason. Use "NOT_ARCHIVED" to filter for unarchived items. Use "ANY_ARCHIVED" to filter for archived items regardless of reason. Use "ANY_ARCHIVED_OR_NOT_ARCHIVED" to return items for both archived and unarchived.
- `createdAt` (string, optional) — Datetime, in RFC 3339 format. Supports the > and \< operators. Time zone defaults to UTC. Restricts results to those created in the specified range. e.g. > 2017-04-30. Date ranges can be specified with the following nomenclature > YYYY-MM-DD AND \<YYYY-MM-DD.
- `creatorIds` (string, optional) — Comma separated list of user IDs.
- `folderId` (string, optional) — ID of a folder. Restricts results to those in the folder.
- `mentionedIn` (string, optional) — Comma-separated list of entry IDs. Restricts results to items mentioned in those entries.
- `modifiedAt` (string, optional) — Datetime, in RFC 3339 format. Supports the > and \< operators. Time zone defaults to UTC. Restricts results to those modified in the specified range. e.g. > 2017-04-30. Date ranges can be specified with the following nomenclature > YYYY-MM-DD AND \<YYYY-MM-DD.
- `name` (string, optional) — Restricts results to those with the specified name.
- `nameIncludes` (string, optional) — Name substring. Restricts results to those with names that include the provided substring.
- `names.anyOf.caseSensitive` (string, optional) — Comma-separated list of names. Maximum of 100. Restricts results to those that match any of the specified names, case sensitive.
- `names.anyOf` (string, optional) — Comma-separated list of names. Maximum of 100. Restricts results to those that match any of the specified names, case insensitive. Warning - this filter can be non-performant due to case insensitivity.
- `originIds` (string, optional) — Comma-separated list of item IDs. Restricts results to those whose origin parent is any of the specified items.
- `ids` (string, optional) — Comma-separated list of ids. Matches all of the provided IDs, or returns a 400 error that includes a list of which IDs are invalid.
- `displayIds` (string, optional) — Comma-separated list of display ids. Matches all of the provided IDs, or returns a 400 error that includes a list of which IDs are invalid.
- `returning` (string, optional) — Comma-separated list of fields to return. Modifies the output shape. To return all keys at a given level, enumerate them or use the wildcard, '*'. For more information, [click here](https://docs.benchling.com/docs/getting-started-1#returning-query-parameter).

## Response

### 200

OK

- `files` (list of File, optional)
- `nextToken` (string, optional)

## Errors

### 400 Bad Request Error

Bad Request

- `error` (BadRequestErrorError, optional)
- `invalidIds` (list of string, optional)

## Types

### File

- `errorMessage` (string, optional, nullable)
- `uploadStatus` (enum, optional)
  - Allowed values: `IN_PROGRESS`, `SUCCEEDED`, `FAILED_VALIDATION`, `NOT_UPLOADED`
- `archiveRecord` (ArchiveRecord, optional, nullable) — ArchiveRecord Resource if the file is archived. This is null if the file is not archived.
- `createdAt` (datetime, optional) — Date and time the file was created
- `creator` (FileCreator, optional) — UserSummary of the user who created the file
- `customFields` (map from string to CustomField, optional) — Custom field values of the file
- `displayId` (string, optional) — User-friendly ID of the file
- `filename` (string, optional)
- `folderId` (string, optional) — ID of the folder that contains the file
- `id` (string, optional)
- `modifiedAt` (datetime, optional) — Date and time the file was last modified
- `name` (string, optional)

### BadRequestErrorError

- `message` (string, optional)
- `type` (enum, optional)
  - Allowed values: `invalid_request_error`
- `userMessage` (string, optional)

### ArchiveRecord

- `reason` (string, optional)

### FileCreator

UserSummary of the user who created the file

- `handle` (string, optional)
- `id` (string, optional)
- `name` (string, optional)

### CustomField

- `value` (string, optional)

## Examples

**Response**

```json
{
  "files": [
    {
      "errorMessage": "string",
      "uploadStatus": "SUCCEEDED",
      "archiveRecord": {
        "reason": "Made in error"
      },
      "createdAt": {},
      "creator": {
        "handle": "string",
        "id": "string",
        "name": "string"
      },
      "customFields": {},
      "displayId": "string",
      "filename": "IC50Chart.png",
      "folderId": "lib_bf0636",
      "id": "file_Of5GuBSq",
      "modifiedAt": {},
      "name": "IC50 Chart"
    }
  ],
  "nextToken": "string"
}
```

**SDK Code**

```python
import requests

url = "https://{tenant_name}.benchling.com/api/v2-beta/files"

querystring = {"archiveReason":"NOT_ARCHIVED","createdAt":"> 2022-03-01 AND < 2022-04-01","modifiedAt":"> 2022-03-01 AND < 2022-04-01","nextToken":"Im5ldyB0ZXN0Ig=="}

headers = {"Authorization": "Bearer <token>"}

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

print(response.json())
```

```javascript
const url = 'https://{tenant_name}.benchling.com/api/v2-beta/files?archiveReason=NOT_ARCHIVED&createdAt=%3E+2022-03-01+AND+%3C+2022-04-01&modifiedAt=%3E+2022-03-01+AND+%3C+2022-04-01&nextToken=Im5ldyB0ZXN0Ig%3D%3D';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

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