---
updatedAt: 2025-09-29T20:46:19.000Z
agentTools:
  projectIndex: https://developer.eagleeyenetworks.com/llms.txt
---

# Archived Files

# Introduction

Eagle Eye Networks <Glossary>user</Glossary>s can archive part of their recorded videos in the archive storage associated with their <Glossary>account</Glossary>. Archived videos are protected from being overwritten by the system according to the retention time configuration. Using the [/files](https://developer.eagleeyenetworks.com/reference/getfiles) API, you can access a list of archived <Glossary>file</Glossary>s, and, if necessary, rename, move, and delete them.

# Before you begin

* [Login](https://developer.eagleeyenetworks.com/docs/login-confidential-client) to your <Glossary>account</Glossary> and receive an <Glossary>access token</Glossary>.
* Get our <Glossary>Base URL</Glossary> from [here](https://developer.eagleeyenetworks.com/docs/key-concepts)

# Archiving Video

You can archive any recorded video using the [`/export`](https://developer.eagleeyenetworks.com/reference/createexportjob) API. This creates an <Glossary>export</Glossary> job that processes the video and saves it in the archive for long-term storage or downloading to your local machine.

```curl
curl --request POST \
     --url https://api.c030.eagleeyenetworks.com/api/v3.0/exports \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "type": "video",
  "period": {
    "startTimestamp": "2023-03-19T09:08:07.542Z",
    "endTimestamp": "2023-03-20T09:08:07.542Z"
  },
  "info": {
    "directory": "/exports",
    "name": "sun_going_under_on_the_7th"
  },
  "deviceId": "10058b7a"
}
'
```
```python
import requests

url = "https://api.c030.eagleeyenetworks.com/api/v3.0/exports"

payload = {
    "type": "video",
    "period": {
        "startTimestamp": "2023-03-19T09:08:07.542Z",
        "endTimestamp": "2023-03-20T09:08:07.542Z"
    },
    "info": {
        "name": "sun_going_under_on_the_7th",
        "directory": "/exports"
    },
    "deviceId": "10058b7a"
}
headers = {
    "accept": "application/json",
    "content-type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```
```csharp
using RestSharp;


var options = new RestClientOptions("https://api.c030.eagleeyenetworks.com/api/v3.0/exports");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("accept", "application/json");
request.AddJsonBody("{\"type\":\"video\",\"period\":{\"startTimestamp\":\"2023-03-19T09:08:07.542Z\",\"endTimestamp\":\"2023-03-20T09:08:07.542Z\"},\"info\":{\"name\":\"sun_going_under_on_the_7th\",\"directory\":\"/exports\"},\"deviceId\":\"10058b7a\"}", false);
var response = await client.PostAsync(request);

Console.WriteLine("{0}", response.Content);

```
```node
const url = 'https://api.c030.eagleeyenetworks.com/api/v3.0/exports';
const options = {
  method: 'POST',
  headers: {accept: 'application/json', 'content-type': 'application/json'},
  body: JSON.stringify({
    type: 'video',
    period: {
      startTimestamp: '2023-03-19T09:08:07.542Z',
      endTimestamp: '2023-03-20T09:08:07.542Z'
    },
    info: {name: 'sun_going_under_on_the_7th', directory: '/exports'},
    deviceId: '10058b7a'
  })
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

On success, the response includes the ID of the new <Glossary>export</Glossary> job. The job will process asynchronously, and you can check its status using the [`/exports/{id}`](https://developer.eagleeyenetworks.com/reference/getexportjob) endpoint.

```json
{
  "id": "f2d4ad7b-bada-4c44-9f70-9c4b85e46b7d"
}
```

> 📘 Note
>
> The id of the <Glossary>export</Glossary> job is not the same as the id of the archived <Glossary>file</Glossary>. To identify the file id, you need to wait for the job to complete and then call the [/files](https://developer.eagleeyenetworks.com/reference/getfiles) with query parameters that match the `directory` and `name` you specified in the request above.

# Listing the Files

By calling the `GET` [/files](https://developer.eagleeyenetworks.com/reference/getfiles) endpoint you can retrieve a list of the available <Glossary>file</Glossary>s and folders in the archive storage.

```curl
curl --location 'https://<base-URL>/api/v3.0/files' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <access-token>'
```
```python
import requests

url = "https://api.c030.eagleeyenetworks.com/api/v3.0/files?sort=%2BcreateTimestamp&pageSize=100"

headers = {"accept": "application/json"}

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

print(response.text)
```
```csharp
using RestSharp;


var options = new RestClientOptions("https://api.c030.eagleeyenetworks.com/api/v3.0/files?sort=%2BcreateTimestamp&pageSize=100");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("accept", "application/json");
var response = await client.GetAsync(request);

Console.WriteLine("{0}", response.Content);

```
```node
const url = 'https://api.c030.eagleeyenetworks.com/api/v3.0/files?sort=%2BcreateTimestamp&pageSize=100';
const options = {method: 'GET', headers: {accept: 'application/json'}};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

The response to the above request is the following:

```json
{
    "nextPageToken": "",
    "prevPageToken": "",
    "results": [
        {
            "id": "4272a107-a9f1-4f45-bc95-3882a285205c",
            "mimeType": "application/directory",
            "directory": "/",
            "name": "Test"
        },
        {
            "id": "36230c7b-f827-49b8-a76a-d8620f899dae",
            "mimeType": "video/mp4",
            "directory": "/",
            "name": "Video CAM 1 2023-05-22 15-10-39.mp4"
        },
        {
            "id": "2c236d24-79e3-44d5-adeb-4d370221217d",
            "mimeType": "video/mp4",
            "directory": "/Test",
            "name": "Video CAM 1 2023-05-22 15-10-39.mp4"
        }
    ]
}
```

By using the [/files/\{id}](https://developer.eagleeyenetworks.com/reference/getfile) endpoint it is possible to get detailed information about a specific ID.

```curl
curl --location 'api.cxxx.eagleeyenetworks.com/api/v3.0/files/2c236d24-79e3-44d5-adeb-4d370221217d?include=publicShare&include=createTimestamp' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <access-token>'
```
```python
import requests

url = "https://api.cxxx.eagleeyenetworks.com/api/v3.0/files/2c236d24-79e3-44d5-adeb-4d370221217d"

headers = {"accept": "application/json"}

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

print(response.text)
```
```csharp
using RestSharp;


var options = new RestClientOptions("https://api.c030.eagleeyenetworks.com/api/v3.0/files/2c236d24-79e3-44d5-adeb-4d370221217d");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("accept", "application/json");
var response = await client.GetAsync(request);

Console.WriteLine("{0}", response.Content);

```
```node
const url = 'https://api.c030.eagleeyenetworks.com/api/v3.0/files/2c236d24-79e3-44d5-adeb-4d370221217d';
const options = {method: 'GET', headers: {accept: 'application/json'}};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

> 📘 Note
>
> You can retrieve more information about a <Glossary>file</Glossary> by including different parameters. To maximize the performance and minimize the response time, it is recommended to limit the parameters you include.

# Deleting a File

To delete a <Glossary>file</Glossary> or folder make a `DELETE` call to the [/files/\{id}](https://developer.eagleeyenetworks.com/reference/deletefile) endpoint:

```curl
curl --location --request DELETE 'https://api.cxxx.eagleeyenetworks.com/api/v3.0/files/2c236d24-79e3-44d5-adeb-4d370221217d' \
--header 'Authorization: Bearer <access-token>'
```
```python
import requests

url = "https://api.cxxx.eagleeyenetworks.com/api/v3.0/files/2c236d24-79e3-44d5-adeb-4d370221217d"

headers = {"accept": "application/json"}

response = requests.delete(url, headers=headers)

print(response.text)
```
```csharp
using RestSharp;


var options = new RestClientOptions("https://api.cxxx.eagleeyenetworks.com/api/v3.0/files/2c236d24-79e3-44d5-adeb-4d370221217d");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("accept", "application/json");
var response = await client.DeleteAsync(request);

Console.WriteLine("{0}", response.Content);

```
```node
const url = 'https://api.cxxx.eagleeyenetworks.com/api/v3.0/files/2c236d24-79e3-44d5-adeb-4d370221217d';
const options = {method: 'DELETE', headers: {accept: 'application/json'}};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

# Downloading a File

To download a <Glossary>file</Glossary> add the `alt=media` parameters to the `/files/{id}` endpoint as shown below:

```curl
curl --location 'https://<base_URL>/api/v3.0/files/<ID>?alt=media' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <access-token>'
--output <local-path>\<file-name>.mp4

```
```python
import requests

url = "https://api.cxxx.eagleeyenetworks.com/api/v3.0/files/2c236d24-79e3-44d5-adeb-4d370221217d:download"

headers = {"accept": "application/octet-stream"}

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

print(response.text)
```
```csharp
using RestSharp;


var options = new RestClientOptions("https://api.cxxx.eagleeyenetworks.com/api/v3.0/files/2c236d24-79e3-44d5-adeb-4d370221217d:download");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("accept", "application/octet-stream");
var response = await client.GetAsync(request);

Console.WriteLine("{0}", response.Content);

```
```node
const url = 'https://api.cxxx.eagleeyenetworks.com/api/v3.0/files/2c236d24-79e3-44d5-adeb-4d370221217d:download';
const options = {method: 'GET', headers: {accept: 'application/octet-stream'}};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

If you run the above request by CURL, the media <Glossary>file</Glossary> is downloaded to the `<local-path>` with `.mp4` extension.

# Uploading a File

Uploading a <Glossary>file</Glossary> to the archive storage is a multi-step process. To start, you need to make a `POST` request to the [/files](https://developer.eagleeyenetworks.com/reference/addfile) endpoint. In the request body, you'll need to include the name of the file with the file extension included. Optionally, you can include the `directory` parameter to specify the folder where the file will be uploaded or the `mimeType` parameter to explicitly specify the type of the file.

```curl
curl --request POST \
     --url https://api.cxxx.eagleeyenetworks.com/api/v3.0/files \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
    "mimeType": "video/mp4",
    "directory": "/uploads",
    "name": "Video CAM 1 2023-05-22 15-10-39.mp4"
}
'
```
```python
import requests

url = "https://api.cxxx.eagleeyenetworks.com/api/v3.0/files?name=Video%20CAM%201%202023-05-22%2015-10-39.mp4&directory=%2Fuploads&mimeType=video%2Fmp4"

headers = {
    "accept": "application/json",
    "content-type": "application/octet-stream"
}

response = requests.post(url, headers=headers)

print(response.text)
```
```csharp
using RestSharp;


var options = new RestClientOptions("https://api.cxxx.eagleeyenetworks.com/api/v3.0/files?name=Video%20CAM%201%202023-05-22%2015-10-39.mp4&directory=%2Fuploads&mimeType=video%2Fmp4");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("accept", "application/json");
request.AddHeader("content-type", "application/octet-stream");
var response = await client.PostAsync(request);

Console.WriteLine("{0}", response.Content);

```
```node
const url = 'https://api.cxxx.eagleeyenetworks.com/api/v3.0/files?name=Video%20CAM%201%202023-05-22%2015-10-39.mp4&directory=%2Fuploads&mimeType=video%2Fmp4';
const options = {
  method: 'POST',
  headers: {accept: 'application/json', 'content-type': 'application/octet-stream'}
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

If successful, the response to the above will include the `id` of the newly created <Glossary>file</Glossary>. You can then use this `id` to find the `uploadUrl` of the file by sending a request to the [/files/\{file\_id}](https://developer.eagleeyenetworks.com/reference/getfile) endpoint. You'll need to set the `include` parameter to `uploadUrl` in the request.

```curl
curl --request GET \
     --url 'https://api.cxxx.eagleeyenetworks.com/api/v3.0/files/36230c7b-f827-49b8-a76a-d8620f899dae?include=uploadUrl' \
     --header 'accept: application/json'
```
```python
import requests

url = "https://api.cxxx.eagleeyenetworks.com/api/v3.0/files/36230c7b-f827-49b8-a76a-d8620f899dae"

headers = {"accept": "application/json"}

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

print(response.text)
```
```csharp
using RestSharp;


var options = new RestClientOptions("https://api.cxxx.eagleeyenetworks.com/api/v3.0/files/36230c7b-f827-49b8-a76a-d8620f899dae");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("accept", "application/json");
var response = await client.GetAsync(request);

Console.WriteLine("{0}", response.Content);

```
```node
const url = 'https://api.cxxx.eagleeyenetworks.com/api/v3.0/files/36230c7b-f827-49b8-a76a-d8620f899dae';
const options = {method: 'GET', headers: {accept: 'application/json'}};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

Once you have the `uploadUrl`, you can use it to upload the file to the archive storage.

```curl
curl --upload-file 'Video CAM 1 2023-05-22 15-10-39.mp4' 'https://een-drivefs-c025.s3.amazonaws.com/....'
```

# Renaming and Moving a File or a Folder

The following example of a `PATCH` request shows how to rename/move a <Glossary>file</Glossary> or folder. You need to make a `PATCH` request with the detailed `/files/<ID>` endpoint for this purpose.

```curl
curl --location --request PATCH 'https://<base_URL>/api/v3.0/files/36230c7b-f827-49b8-a76a-d8620f899dae' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <access-token>' \
--data '{
    "directory": "/new-folder",
    "name": "New Name.mp4"
}'
```
```python
import requests

url = "https://api.cxxx.eagleeyenetworks.com/api/v3.0/files/36230c7b-f827-49b8-a76a-d8620f899dae"

payload = {
    "directory": "/new-folder",
    "name": "New Name.mp4"
}
headers = {
    "accept": "application/json",
    "content-type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.text)
```
```csharp
using RestSharp;


var options = new RestClientOptions("https://api.cxxx.eagleeyenetworks.com/api/v3.0/files/36230c7b-f827-49b8-a76a-d8620f899dae");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("accept", "application/json");
request.AddJsonBody("{\"directory\":\"/new-folder\",\"name\":\"New Name.mp4\"}", false);
var response = await client.PatchAsync(request);

Console.WriteLine("{0}", response.Content);

```
```node
const url = 'https://api.cxxx.eagleeyenetworks.com/api/v3.0/files/36230c7b-f827-49b8-a76a-d8620f899dae';
const options = {
  method: 'PATCH',
  headers: {accept: 'application/json', 'content-type': 'application/json'},
  body: JSON.stringify({directory: '/new-folder', name: 'New Name.mp4'})
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

As shown above, you can change the name of a <Glossary>file</Glossary> or folder. You can also use the same name, but a different `directory` value to move the <Glossary>file</Glossary> or folder. If the directory does not exist, it is automatically created and the move operation is performed.