> For the complete documentation index, see [llms.txt](https://docs.hedge.video/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hedge.video/canister/features/automation.md).

# Automation

Automate transfers and fetch information about mounted tapes using Canister's API.

## How it works

The Canister API responds to URLs beginning with `canister://`. These can be triggered from a browser, shell, or script. [Deployment calls](https://docs.hedge.video/canister/features/deployment) can be included in your automated workflows.

\
**Example script usage**

{% tabs %}
{% tab title="Mac" %}
From the Terminal:

```
open "canister://open"
```

{% endtab %}

{% tab title="Windows" %}
Using Python:

```
import os
os.system("start canister://open")
```

{% endtab %}
{% endtabs %}

#### Add Archive <a href="#add-archive" id="add-archive"></a>

Archive a source to all mounted tapes:

{% tabs %}
{% tab title="Mac" %}

```
canister://addarchive?sources=/Volumes/X9 SSD/Important Footage
```

{% endtab %}

{% tab title="Windows" %}

```
canister://addarchive?sources="E:\Important footage"
```

{% endtab %}
{% endtabs %}

The parameters below are supported:

| URL Parameter     | Type   | Required? |
| ----------------- | ------ | --------- |
| sources           | String | Mandatory |
| destinationtape   | String | optional  |
| destinationfolder | String | optional  |

A Collection of different sources, files, or folders can be combined using the `|` (pipe) operator.

{% tabs %}
{% tab title="Mac" %}
{% code overflow="wrap" %}

```
canister://addarchive?sources=/Volumes/X9 SSD/Important Footage 1|/Volumes/X9 SSD/Important Footage 2
```

{% endcode %}
{% endtab %}

{% tab title="Windows" %}
{% code overflow="wrap" %}

```
canister://addarchive?sources="E:\Important footage 1"|"F:\Important footage 2"
```

{% endcode %}
{% endtab %}
{% endtabs %}

Putting it together:

{% tabs %}
{% tab title="Mac" %}
{% code overflow="wrap" %}

```
canister://addarchive?sources=/Volumes/X9 SSD/Important Footage&destinationtape=Archive 01&destinationfolder=260304
```

{% endcode %}
{% endtab %}

{% tab title="Windows" %}
{% code overflow="wrap" %}

```
canister://addarchive?sources="E:\Important footage 1"&destinationtape="Archive 01"&destinationfolder="260304"
```

{% endcode %}
{% endtab %}
{% endtabs %}

#### Add Retrieve <a href="#add-retrieve" id="add-retrieve"></a>

Retrieve folders or files from tape:

{% tabs %}
{% tab title="Mac" %}
{% code overflow="wrap" %}

```
canister://retrieve?sources=260304/Important Footage 1&sourcetape=Archive 01&destinationpath=/Volumes/X9 SSD/Retrieved Footage
```

{% endcode %}
{% endtab %}

{% tab title="Windows" %}
{% code overflow="wrap" %}

```
canister://addretrieve?sources="260304\Important footage 1"&sourcetape="Archive 01"&destinationpath="E:\Retrieved Footage"
```

{% endcode %}
{% endtab %}
{% endtabs %}

The parameters below are supported:

| URL Parameter   | Type   | Required? |
| --------------- | ------ | --------- |
| sources         | string | mandatory |
| sourcetape      | string | mandatory |
| destinationpath | string | mandatory |

#### Get Tapes <a href="#get-tapes" id="get-tapes"></a>

Generate a JSON list of mounted tapes using `gettapes`.

{% tabs %}
{% tab title="Mac" %}
\
On Mac a path and filename must be supplied to the `gettapes` call.

{% code overflow="wrap" %}

```
canister://gettapes?path=/Users/Username/Desktop/gettapes.json
```

{% endcode %}

| URL Parameter | Type   | Required?                 |
| ------------- | ------ | ------------------------- |
| path          | String | mandatory (inc. filename) |
| {% endtab %}  |        |                           |

{% tab title="Windows" %}
\
On Windows the path can be omitted from the `gettapes` call. This will dump a `tapes.json` file to the Canister `AppData` folder. A filename should not be supplied for the output.

{% code overflow="wrap" %}

```
canister://gettapes?path="c:\path\to\scripts"
```

{% endcode %}

| URL Parameter | Type   | Required? |
| ------------- | ------ | --------- |
| path          | String | optional  |
| {% endtab %}  |        |           |
| {% endtabs %} |        |           |

Sample output:

{% tabs %}
{% tab title="Mac" %}

```json
[
  {
    "name" : "Archive 01",
    "serial" : "19WT134678",
    "mountPath" : "/Users/LTO Mac/Library/Application Support/Canister/.MountIndexData/146498582",
    "status" : "Mounted",
    "totalCapacityBytes" : 5732142415872,
    "freeBytes" : 3994656406
  }
]
```

{% endtab %}

{% tab title="Windows" %}

```json
[
  {
    "name"               : "Archive 01",
    "serial"             : "19WT134678",
    "driveLetter"        : "Z",
    "status"             : "READY",
    "totalCapacityBytes" : 2408088338432,
    "freeBytes"          : 2408085192704
  }
]
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.hedge.video/canister/features/automation.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
