# Find channels

> Find channels in the Console, or retrieve them in code by name, key, pattern, or search term.

In the Console, you find a [channel](https://docs.synnaxlabs.com/reference/channels) to plot it or to add it to a schematic. In a script, you retrieve a channel before you read or write its data.

## Find a channel in the Console

The [channels toolbar](https://docs.synnaxlabs.com/reference/channels#channels-in-the-console) lists all of the channels in Synnax. To open it, click or press **C**. To add a channel to a schematic, drag it from the toolbar onto the schematic.

To find a channel by name, click at the top of the left bar, or press **Ctrl+P** (**Cmd+P** on macOS), to open the [search palette](https://docs.synnaxlabs.com/reference/get-started/ui-overview#search-and-command-palette). Then type part of the name. Select a result to add the channel to the open line plot, or to a new line plot. A virtual channel opens in a log.

[](https://synnax.nyc3.cdn.digitaloceanspaces.com/docs/client/channels/find-dark.mp4#t=0.001)

## Retrieve channels in code

A script gets a channel from the Core before it reads or writes its data. Retrieve channels by name or key, by a pattern, or by a search term.

### By name or key

[Enterprise](https://docs.synnaxlabs.com/reference/get-started/editions "Needs Synnax Enterprise")

**Python**

```python
# One channel, by name or by key
tank_pressure = client.channels.retrieve("tank_pressure")
tank_pressure = client.channels.retrieve(tank_pressure.key)

# Many channels, by names or by keys
channels = client.channels.retrieve(["tank_pressure", "tank_temperature"])
channels = client.channels.retrieve([tank_pressure.key, tank_temperature.key])
```

When you pass one name or key, `retrieve` returns one channel. It raises `sy.NotFoundError` when no channel matches. When you pass a list, `retrieve` returns a list and leaves out the channels that it does not find.

Pass names or keys, not both in one list. A key never changes, but a name can change. Store keys in programs that run for a long time.

**TypeScript**

```typescript
// One channel, by name or by key
const tankPressure = await client.channels.retrieve("tank_pressure");
const sameChannel = await client.channels.retrieve(tankPressure.key);

// Many channels, by names or by keys
const names = ["tank_pressure", "tank_temperature"];
const byName = await client.channels.retrieve(names);
const byKey = await client.channels.retrieve([tankPressure.key, sameChannel.key]);
```

When you pass one name or key, `retrieve` returns one channel. It throws a `NotFoundError` when no channel matches. When you pass an array, `retrieve` returns an array and leaves out the channels that it does not find.

Pass names or keys, not both in one array. A key never changes, but a name can change. Store keys in programs that run for a long time.

### By pattern

A name that is not a valid [channel name](https://docs.synnaxlabs.com/reference/channels#names) is a regular expression, in [Go RE2 syntax](https://github.com/google/re2/wiki/Syntax). The pattern must match the full name, unless it starts with `^` or ends with `$`. For example, `tank_.*` matches `tank_pressure` and `tank_time`, but not `ox_tank_pressure`.

[Enterprise](https://docs.synnaxlabs.com/reference/get-started/editions "Needs Synnax Enterprise")

**Python**

```python
# Returns list[sy.Channel]
tank_channels = client.channels.retrieve(["tank_.*"])
```

Put the pattern in a list. With a pattern that is not in a list, `retrieve` raises `sy.MultipleFoundError` when more than one channel matches.

**TypeScript**

```typescript
// Returns Channel[]
const tankChannels = await client.channels.retrieve(["tank_.*"]);
```

Put the pattern in an array. With a pattern that is not in an array, `retrieve` throws a `MultipleFoundError` when more than one channel matches.

### By search term

Both clients can search channels by a part of their name and filter them by their properties.

[Enterprise](https://docs.synnaxlabs.com/reference/get-started/editions "Needs Synnax Enterprise")

**Python**

```python
import synnax as sy

matches = client.channels.retrieve(search_term="pressure", limit=10)
floats = client.channels.retrieve(data_types=[sy.DataType.FLOAT32], is_index=False)
```

The filters are `search_term`, `data_types`, `not_data_types`, `is_index`, `virtual`, `internal`, `node_key`, `limit`, and `offset`. Results match all the filters. Use `range_key` to include aliases from a range and search those aliases too. Set `include_status=True` to attach each channel’s status; a channel with no status gets `None`.

**TypeScript**

```typescript
import { DataType } from "@synnaxlabs/client";

// The ten best matches for "pressure"
const matches = await client.channels.retrieve({
  searchTerm: "pressure",
  limit: 10,
});

// All float32 data channels
const floats = await client.channels.retrieve({
  dataTypes: [DataType.FLOAT32],
  isIndex: false,
});
```

| Filter         | Returns channels that                                             |
| -------------- | ----------------------------------------------------------------- |
| `searchTerm`   | Have a name that is similar to the term.                          |
| `dataTypes`    | Have one of these data types.                                     |
| `notDataTypes` | Do not have any of these data types.                              |
| `isIndex`      | Are index channels (`true`) or are not (`false`).                 |
| `virtual`      | Are virtual channels. Calculated channels are not in the results. |
| `internal`     | Are channels that Synnax uses for itself (`true`) or are not.     |
| `limit`        | Are in the first `limit` results.                                 |
| `offset`       | Come after the first `offset` results.                            |

Synnax returns only the channels that match all of the filters.

## Find the channels of a range

A range can give channels a different name, called an [alias](https://docs.synnaxlabs.com/reference/ranges/aliases). To find channels by alias, or to read their data in a range, see [read and write range data](https://docs.synnaxlabs.com/reference/ranges/data).
