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

# Configure Alibaba OSS

> Configure Alibaba Cloud Object Storage Service for your downloads

## Overview

Set up Alibaba Cloud OSS for uploaded videos. Credentials are verified before saving.

## Header Parameters

<ParamField header="x-api-key" type="string" required>
  Your API key for authentication
</ParamField>

## Request Body

<ParamField body="endpoint" type="string" required>
  OSS endpoint URL (e.g., `https://oss-cn-hangzhou.aliyuncs.com`)
</ParamField>

<ParamField body="bucket" type="string" required>
  OSS bucket name
</ParamField>

<ParamField body="access_key_id" type="string" required>
  OSS Access Key ID
</ParamField>

<ParamField body="access_key_secret" type="string" required>
  OSS Access Key Secret
</ParamField>

<ParamField body="folder_prefix" type="string">
  Optional folder prefix for organizing uploads (e.g., `downloads/2024/`)
</ParamField>

<ParamField body="base_folder" type="string" default="videos">
  Base folder name for uploaded files. Defaults to `videos` if not specified. Set to a custom value to change the top-level folder where files are stored (e.g., `downloads`, `media`).
</ParamField>

## Response

<ResponseField name="message" type="string">
  Success confirmation message
</ResponseField>

<ResponseField name="provider" type="string">
  Storage provider type: `oss`
</ResponseField>

<ResponseField name="container_or_bucket" type="string">
  The configured bucket name
</ResponseField>

<ResponseField name="folder_prefix" type="string">
  The configured folder prefix (if provided)
</ResponseField>

## Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://api.tornadoapi.io/user/oss" \
    -H "x-api-key: sk_your_api_key" \
    -H "Content-Type: application/json" \
    -d '{
      "endpoint": "https://oss-cn-hangzhou.aliyuncs.com",
      "bucket": "tornado-downloads",
      "access_key_id": "LTAI5tXXXXXXXXXXXXXX",
      "access_key_secret": "XXXXXXXXXXXXXXXXXXXXXXXXXX"
    }'
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      "https://api.tornadoapi.io/user/oss",
      headers={"x-api-key": "sk_your_api_key"},
      json={
          "endpoint": "https://oss-cn-hangzhou.aliyuncs.com",
          "bucket": "tornado-downloads",
          "access_key_id": "LTAI5tXXXXXXXXXXXXXX",
          "access_key_secret": "XXXXXXXXXXXXXXXXXXXXXXXXXX"
      }
  )
  print(response.json())
  ```

  ```json Response theme={null}
  {
    "message": "Alibaba OSS storage configured successfully",
    "provider": "oss",
    "container_or_bucket": "tornado-downloads"
  }
  ```
</CodeGroup>

## Success Response

<ResponseExample>
  ```json 200 OK theme={null}
  {
    "message": "Alibaba OSS storage configured successfully",
    "provider": "oss",
    "container_or_bucket": "tornado-downloads"
  }
  ```
</ResponseExample>

## Error Responses

<ResponseExample>
  ```json 400 Bad Request - Invalid Credentials theme={null}
  {
    "error": "Credential validation failed: AccessDenied"
  }
  ```

  ```json 400 Bad Request - Bucket Not Found theme={null}
  {
    "error": "Credential validation failed: NoSuchBucket"
  }
  ```

  ```json 401 Unauthorized theme={null}
  {
    "error": "Invalid API Key"
  }
  ```

  ```json 503 Service Unavailable theme={null}
  {
    "error": "OSS storage configuration is temporarily unavailable"
  }
  ```
</ResponseExample>

## OSS Endpoint Regions

| Region           | Endpoint                                  |
| ---------------- | ----------------------------------------- |
| China (Hangzhou) | `https://oss-cn-hangzhou.aliyuncs.com`    |
| China (Shanghai) | `https://oss-cn-shanghai.aliyuncs.com`    |
| China (Beijing)  | `https://oss-cn-beijing.aliyuncs.com`     |
| Singapore        | `https://oss-ap-southeast-1.aliyuncs.com` |
| US West          | `https://oss-us-west-1.aliyuncs.com`      |
| Germany          | `https://oss-eu-central-1.aliyuncs.com`   |
