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

# Get a Large Number of Entities by Name

This recipe uses the [V3 API](/docs/v3-api-overview) through the
[V3 Python SDK](/docs/getting-started-with-the-v3-sdk). The custom entity list endpoint is stable,
so the client doesn't need `early_access`. `long_list_of_entity_names` is a placeholder for your own
list of names.

#### SDK boilerplate

Import the V3 SDK and instantiate the client. Pass your tenant's root URL and your API key; the
SDK adds `/api/v3` itself.

**`Python (lines 1-6)`**

```python Python (lines 1-6)
from benchling_v3_sdk import Benchling

benchling = Benchling(
    base_url="https://yourcompany.benchling.com",
    api_key="<your-api-key>",
)
```

#### Write a chunking helper

A generator that yields successive slices of a list. The name filter accepts at most 100 names
per request, so a list of thousands of names has to be split up.

**`Python (lines 8-10)`**

```python Python (lines 8-10)
def chunks(lst, n):
    for i in range(0, len(lst), n):
        yield lst[i:i + n]
```

#### Iterate the chunks

Drop any `None` entries first, then handle one chunk of at most 100 names per pass of the loop.

**`Python (lines 12-14)`**

```python Python (lines 12-14)
names = [name for name in long_list_of_entity_names if name is not None]
entities = []
for chunk_of_names in chunks(names, 100):
```

#### Request the entities

One list call per chunk. Use `name_any_of_case_sensitive` rather than `name_any_of`: the
case-insensitive filter can be non-performant. The SDK sends the names as a comma-separated
`name.anyOf.caseSensitive` query parameter on `GET /api/v3/custom-entity/items`.

Iterating the pager fetches every page of matches, so a chunk that matches more than
`page_size` entities still returns all of them. The response tab shows the shape of one page,
trimmed for brevity.

**`Python (lines 15-16)`**

```python Python (lines 15-16)
    for entity in benchling.custom_entity.list(name_any_of_case_sensitive=chunk_of_names, page_size=100):
        entities.append(entity)
```

#### Complete files

**`Python`**

```python title="Python"
from benchling_v3_sdk import Benchling

benchling = Benchling(
    base_url="https://yourcompany.benchling.com",
    api_key="<your-api-key>",
)

def chunks(lst, n):
    for i in range(0, len(lst), n):
        yield lst[i:i + n]

names = [name for name in long_list_of_entity_names if name is not None]
entities = []
for chunk_of_names in chunks(names, 100):
    for entity in benchling.custom_entity.list(name_any_of_case_sensitive=chunk_of_names, page_size=100):
        entities.append(entity)
print(len(entities))
```

**`Response Example`**

```json title="Response Example"
{
  "items": [
    {
      "__typename": "CustomEntity",
      "aliases": [
        "sBN000"
      ],
      "archiveReason": "Made in error",
      "archived": true,
      "authors": "https://yourcompany.benchling.com/api/v3/custom-entity/bfi_xCUXNVyG/authors/items",
      "createdAt": "2017-04-18T05:54:56.247545+00:00",
      "creator": {
        "__typename": "User",
        "id": "ent_a0SApq3z"
      },
      "customFields": [
        {
          "__typename": "CustomField",
          "name": "Legacy ID",
          "value": "STR100"
        }
      ],
      "entityRegistryId": "sBN000",
      "folder": {
        "__typename": "Folder",
        "id": "lib_R8KcsjhW"
      },
      "id": "bfi_xCUXNVyG",
      "modifiedAt": "2017-04-18T05:55:48.685345+00:00",
      "name": "sBN000",
      "project": null,
      "registrationOrigin": {
        "__typename": "RegistrationOrigin",
        "originEntry": null,
        "registeredAt": "2022-02-16T21:10:11.729Z"
      },
      "registry": {
        "__typename": "Registry",
        "id": "src_NetYd96a"
      },
      "schemaFields": [],
      "typedSchema": {
        "__typename": "CustomEntitySchema",
        "id": "ts_EM122lfJ"
      }
    }
  ],
  "nextToken": "string"
}
```

V3 returns the standard `{items, nextToken}` envelope rather than V2's
`{customEntities, nextToken}`, and uses `typedSchema` in place of the deprecated `schema` field.