{
  "openapi": "3.1.0",
  "info": {
    "title": "URL 파일 업로드 API",
    "description": "원격 URL을 통해 파일을 다운로드하여 파일 서버에 업로드합니다",
    "license": {
      "name": "MIT"
    },
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://files-api.evolink.ai",
      "description": "파일 서비스 환경"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/api/v1/files/upload/url": {
      "post": {
        "summary": "URL 파일 업로드",
        "description": "- 원격 파일 URL을 제공하여 업로드\n- 시스템이 자동으로 원격 파일을 다운로드하여 저장합니다\n- 다른 서버에서 파일을 마이그레이션하는 데 적합합니다\n- 파일은 72시간 후 만료됩니다\n- 현재 사용자 할당량이 제한되어 있습니다. 할당량이 소진되면 업로드가 실패합니다. 영구 저장이 필요한 경우 로컬에 저장해 주세요\n\n**참고:**\n파일 업로드 API 기본 URL은 `https://files-api.evolink.ai`입니다",
        "operationId": "uploadFileUrl",
        "tags": [
          "파일 업로드"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UrlUploadRequest"
              },
              "examples": {
                "url_upload": {
                  "summary": "URL 파일 업로드",
                  "value": {
                    "file_url": "https://example.com/image.jpg"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "파일이 성공적으로 업로드되었습니다",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileUploadResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "UrlUploadRequest": {
        "type": "object",
        "required": [
          "file_url"
        ],
        "properties": {
          "file_url": {
            "type": "string",
            "format": "uri",
            "description": "원격 파일 URL\n\n**요구사항:**\n- 공개적으로 접근 가능한 URL이어야 합니다\n- HTTP 및 HTTPS 프로토콜 지원\n- 시스템이 이 URL에서 파일 콘텐츠를 자동으로 다운로드합니다\n- 요청당 최대 `1`개 파일\n- 지원 파일 형식: 이미지(JPEG, PNG, GIF, WebP), 동영상(MP4, MOV, WebM), 오디오(MP3, WAV, M4A, AAC, FLAC, OGG)",
            "example": "https://example.com/image.jpg"
          },
          "upload_path": {
            "type": "string",
            "description": "사용자 정의 업로드 경로\n\n**참고:**\n- 지정하지 않으면 시스템이 파일 유형에 따라 자동으로 분류합니다",
            "example": "downloads"
          },
          "file_name": {
            "type": "string",
            "description": "사용자 정의 파일 이름\n\n**참고:**\n- 지정하지 않으면 시스템이 자동으로 고유한 파일 이름을 생성합니다",
            "example": "downloaded.jpg"
          }
        }
      },
      "FileUploadResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "description": "요청 성공 여부",
            "example": true
          },
          "code": {
            "type": "integer",
            "description": "응답 상태 코드",
            "example": 200
          },
          "msg": {
            "type": "string",
            "description": "응답 메시지",
            "example": "파일이 성공적으로 업로드되었습니다"
          },
          "data": {
            "$ref": "#/components/schemas/FileData"
          }
        }
      },
      "FileData": {
        "type": "object",
        "properties": {
          "file_id": {
            "type": "string",
            "description": "고유 파일 식별자",
            "example": "file_abc123"
          },
          "file_name": {
            "type": "string",
            "description": "저장된 파일 이름",
            "example": "downloaded.jpg"
          },
          "original_name": {
            "type": "string",
            "description": "원본 파일 이름",
            "example": "downloaded.jpg"
          },
          "file_size": {
            "type": "integer",
            "description": "파일 크기 (바이트)",
            "example": 2048
          },
          "mime_type": {
            "type": "string",
            "description": "파일 MIME 유형",
            "example": "image/jpeg"
          },
          "upload_path": {
            "type": "string",
            "description": "파일 저장 경로",
            "example": "downloads"
          },
          "file_url": {
            "type": "string",
            "format": "uri",
            "description": "파일 접근 URL",
            "example": "https://files.evolink.ai/downloads/downloaded.jpg"
          },
          "download_url": {
            "type": "string",
            "format": "uri",
            "description": "파일 다운로드 URL",
            "example": "https://files.evolink.ai/api/v1/files/download/file_abc123"
          },
          "upload_time": {
            "type": "string",
            "format": "date-time",
            "description": "업로드 시간 (ISO 8601 형식)",
            "example": "2025-10-09T00:00:00+08:00"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "파일 만료 시간 (ISO 8601 형식)",
            "example": "2025-10-12T00:00:00+08:00"
          }
        }
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "##모든 API는 Bearer Token 인증이 필요합니다##\n\n**API Key 받기:**\n\n[API Key 관리 페이지](https://evolink.ai/dashboard/keys)를 방문하여 API Key를 받으세요\n\n**요청 헤더에 추가:**\n```\nAuthorization: Bearer YOUR_API_KEY\n```"
      }
    }
  },
  "tags": [
    {
      "name": "파일 업로드",
      "description": "파일 업로드 관련 API"
    }
  ]
}