# Edit and delete ranges

> Rename a range, change its times or stage, and delete it.

Rename a [range](https://docs.synnaxlabs.com/reference/ranges), change its times or its stage, or delete it. To change labels and metadata, see [metadata and labels](https://docs.synnaxlabs.com/reference/ranges/metadata).

## Rename a range

**Console**

Right-click the range in the ranges toolbar or the range explorer and select **Rename**. You can also click the name on the [range overview](https://docs.synnaxlabs.com/reference/ranges/find#range-overview).

**Python**

```python
client.ranges.rename(my_range.key, "My Updated Range")
```

**TypeScript**

```typescript
await client.ranges.rename(myRange.key, "My Updated Range");
```

## Change the times or the stage

**Console**

On the [range overview](https://docs.synnaxlabs.com/reference/ranges/find#range-overview), click the start or end time on the timeline and change it. To start, complete, or reopen the range, click its stage. Each stage change sets the start or end time. See [stages](https://docs.synnaxlabs.com/reference/ranges/reference#stages).

The Console cannot change the color or the parent of a range.

**Python**

Call `client.ranges.set_time_range` to change the start and end, or `client.ranges.set_end` to change only the end. Call `client.ranges.set_color` and `client.ranges.set_parent` to change the color and the parent. Pass `None` to clear the color or to make the range top-level:

```python
from datetime import datetime

import synnax as sy

my_range = client.ranges.retrieve(name="My Range")
client.ranges.set_time_range(
    my_range.key,
    sy.TimeRange(
        start=sy.TimeStamp(datetime(2023, 2, 12, 13, 0)),
        end=sy.TimeStamp(datetime(2023, 2, 12, 15, 0)),
    ),
)
client.ranges.set_color(my_range.key, "#00FF00")
client.ranges.set_parent(my_range.key, None)
```

**TypeScript**

Call `client.ranges.dispatch` with a `ranger.set` action for each field to change. You can change `timeRange`, `color`, and `parent`. Set `color` to `null` to clear it.

`dispatch` applies only to a range that the client holds in its cache. It returns `false` and sends nothing when the range is not in the cache, so retrieve the range first:

```typescript
import { ranger, TimeRange, TimeStamp } from "@synnaxlabs/client";

const myRange = await client.ranges.retrieve("My Range");
const sent = await client.ranges.dispatch(myRange.key, [
  ranger.set({
    path: ["timeRange"],
    value: new TimeRange(
      new TimeStamp("2023-02-12 13:00:00"),
      new TimeStamp("2023-02-12 15:00:00"),
    ),
  }),
  ranger.set({ path: ["color"], value: "#00FF00" }),
]);
if (!sent) throw new Error("My Range is not in the client cache");
```

**Arc**

An automation can only end a range that it created. `ranges.end` sets the end to the current time. Give it the key that `ranges.create` output:

```arc
import ranges

sequence test {
    run_key str $= ""
    stage idle {
        start_cmd == 1 => run
    }
    stage run {
        ranges.create(name="Hotfire", color="#3bc454") -> run_key
        stop_cmd == 1 => done
    }
    stage done {
        ranges.end(key=run_key)
        start_cmd == 1 => run
    }
}

true => test
```

See [create ranges in Arc](https://docs.synnaxlabs.com/reference/ranges/arc).

> Do not call `create` with the key of a range to change it. The create fails because a range already has the key.

## Delete a range

Deleting a range also deletes its child ranges, its [snapshots](https://docs.synnaxlabs.com/reference/ranges/snapshots), its [metadata](https://docs.synnaxlabs.com/reference/ranges/metadata), its [aliases](https://docs.synnaxlabs.com/reference/ranges/aliases), and the schematics, line plots, logs, tables, and panels that it owns. It does not delete the data of the channels in the range.

**Console**

Right-click the range in the ranges toolbar or the range explorer and select **Delete**, then confirm.

![](https://synnax.nyc3.cdn.digitaloceanspaces.com/docs/client/ranges/delete/2d71fc2b921b/window-light.webp)

**Python**

```python
client.ranges.delete(my_range.key)
client.ranges.delete([my_range.key, my_other_range.key])
```

A key that matches no range is ignored.

**TypeScript**

```typescript
await client.ranges.delete(myRange.key);
await client.ranges.delete([myRange.key, myOtherRange.key]);
```
