> ## Documentation Index
> Fetch the complete documentation index at: https://docs.silicondata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Bulk download

## <span style={{ color: 'white', fontWeight: 'bold', backgroundColor: '#007BFF', border: '2px solid #007BFF', borderRadius: '5px', padding: '5px', display: 'inline-block' }}>POST</span> /api/data-hub/gpu/archive/list

Get GPU batch download list. A list of `id` from response must be used in the `/download` endpoint to find the download URL.

### Authorization

**🔒OAuth2**: OAuth2PasswordBearer\
**Flow type**: password\
**Token URL**: token

### Request Body

The request body must be in `application/json` format. All fields are optional; `filter` is a list of single-key objects.

| Field                   | Type    | Required | Description                                       | Constraints                  |
| ----------------------- | ------- | -------- | ------------------------------------------------- | ---------------------------- |
| `filter/tier`           | integer | No       | The data tier to be downloaded; defaults to 3     |                              |
| `filter/interval`       | string  | No       | Interval of the data                              | \[day, month, quarter, year] |
| `filter/type`           | string  | No       | Data type                                         | \[rental, retail]            |
| `filter/period`         | string  | No       | Data period, e.g. "2025-03-31", "2025-03", "2025" |                              |
| `paginate/num_per_page` | integer | No       | How many records to return per page; default 50   | \[ 1 .. 100 ]                |
| `paginate/page_num`     | integer | No       | The page index number; default 1                  | >= 1                         |
| `order_by/period`       | string  | No       | Sort order of the file list                       | \[asc, desc]                 |

### Request Example

```json theme={null}
{
  "filter": [
    {"tier": 3},
    {"interval": "day"},
    {"type": "rental"},
    {"period": "2025-06-02"}
  ],
  "paginate": {"num_per_page": 10, "page_num": 1},
  "order_by": [
    {"period": "desc"}
  ]
}
```

### Responses

Response consists of meta and data, where:

* meta is the metadata regarding the request. `code` in `meta` indicates the error code of the request, with 0 indicating no error.
* data contains the total number of results and a list of results, each containing the `id` that can be used to download the data.

```json theme={null}
{
  "meta": {
    "code": 0,
    "url": "/api/data-hub/gpu/archive/list",
    "message": "OK",
    "timestamp": 1748908800
  },
  "data": {
    "total": 1,
    "results": [
      {
        "tier": 3,
        "interval": "day",
        "period": "2025-06-02",
        "type": "rental",
        "csv_s3_path": "s3://bucket/path/to/file.csv",
        "id": "1234567890123456789",
        "sequence_id": 1
      }
    ]
  }
}
```

***

## <span style={{ color: 'white', fontWeight: 'bold', backgroundColor: '#007BFF', border: '2px solid #007BFF', borderRadius: '5px', padding: '5px', display: 'inline-block' }}>POST</span> /api/data-hub/gpu/archive/download

Get GPU data download URL using `id`, obtained from the `/list` endpoint.

### Authorization

**🔒OAuth2**: OAuth2PasswordBearer\
**Flow type**: password\
**Token URL**: token

### Request Body

The request body must be in `application/json` format.

| Field | Type    | Required | Description                   | Constraints |
| ----- | ------- | -------- | ----------------------------- | ----------- |
| `id`  | integer | Yes      | ID used for find download URL |             |

### Request Example

```json theme={null}
{
  "id": 1234567890123456789
}
```

### Responses

```json theme={null}
{
  "meta": {
    "code": 0,
    "url": "/api/data-hub/gpu/archive/download",
    "message": "OK",
    "timestamp": 1748908800
  },
  "data": {
    "csv_download_url": "https://sd-data-archive.s3.amazonaws.com/gpu/2025-03-31.csv?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Expires=3600&X-Amz-Signature=8f3c1b9a2d..."
  }
}
```

## Batch download GPU data using Python

This example shows how to batch download GPU data using the two endpoints above. We first list the available data using the `/list` endpoint, and then download each file using the `/download` endpoint.

The required API token can be obtained through the user portal.

```python theme={null}
import requests

token = "ENTER YOUR API TOKEN HERE"
headers = {'Authorization': f'Bearer {token}'}
base_url = "https://api.silicondata.com/api/data-hub/gpu/archive"
body = {
    "filter": [
        {"tier": 3},
        {"interval": "day"},
        {"type": "rental"},
        {"period": "2025-06-02"}
    ],
    "paginate": {"num_per_page": 10, "page_num": 1},
    "order_by": [
        {"period": "desc"}
    ]
}
listing_res = requests.post(f"{base_url}/list", json=body, headers=headers).json()
for res in listing_res['data']['results']:
    download_res = requests.post(f"{base_url}/download", json={"id": res['id']}, headers=headers).json()
    csv_download_url = download_res['data']['csv_download_url']
    with open(f"{res['period']}.csv", 'wb') as file:
        file.write(requests.get(csv_download_url).content)
```
