{
  "components": {
    "schemas": {
      "DeleteResult": {
        "properties": {
          "deleted": {
            "type": "boolean"
          },
          "file_id": {
            "type": "string"
          },
          "files_deleted": {
            "type": "integer"
          },
          "folder_id": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "FileResource": {
        "properties": {
          "cipher": {
            "type": "string"
          },
          "content_type": {
            "type": "string"
          },
          "created_day": {
            "format": "int64",
            "type": "integer"
          },
          "download_count": {
            "format": "int64",
            "type": "integer"
          },
          "download_url": {
            "type": "string"
          },
          "encrypted": {
            "type": "boolean"
          },
          "expires_at": {
            "description": "Unix timestamp",
            "format": "int64",
            "type": "integer"
          },
          "expires_iso": {
            "format": "date-time",
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "original_name": {
            "type": "string"
          },
          "size_bytes": {
            "format": "int64",
            "type": "integer"
          }
        },
        "type": "object"
      },
      "FolderResource": {
        "properties": {
          "created_day": {
            "format": "int64",
            "type": "integer"
          },
          "file_count": {
            "type": "integer"
          },
          "files": {
            "items": {
              "$ref": "#/components/schemas/FileResource"
            },
            "type": "array"
          },
          "id": {
            "type": "string"
          },
          "password_set": {
            "type": "boolean"
          },
          "password_set_day": {
            "format": "int64",
            "type": "integer"
          },
          "premium": {
            "type": "boolean"
          },
          "total_bytes": {
            "format": "int64",
            "type": "integer"
          }
        },
        "type": "object"
      },
      "RegenerateResult": {
        "properties": {
          "download_url": {
            "type": "string"
          },
          "file_id": {
            "description": "New public_id",
            "type": "string"
          },
          "old_file_id": {
            "type": "string"
          }
        },
        "type": "object"
      }
    }
  },
  "info": {
    "description": "Two surfaces: /flux/* for resumable uploads (tus.io v1) and /api/v1/* for JSON metadata and folder ops. /api/v1/* always returns application/json; HTML pages live at /d/{id} and /v/{folder_id} but are not part of this API.",
    "title": "VorcaroFiles Public API",
    "version": "1.0.0"
  },
  "openapi": "3.0.3",
  "paths": {
    "/api/v1/files/{id}": {
      "get": {
        "description": "Returns metadata only. Use POST /d/{id} for the binary stream.",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileResource"
                }
              }
            },
            "description": "File metadata"
          },
          "404": {
            "description": "Not found or expired"
          }
        },
        "summary": "Get file metadata",
        "tags": [
          "api-files"
        ]
      },
      "parameters": [
        {
          "description": "File ID",
          "in": "path",
          "name": "id",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ]
    },
    "/api/v1/folders/{id}": {
      "delete": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteResult"
                }
              }
            },
            "description": "Folder deleted"
          },
          "401": {
            "description": "Folder password required or wrong"
          },
          "404": {
            "description": "Folder not found"
          }
        },
        "summary": "Delete folder and every file inside (permanent)",
        "tags": [
          "api-folders"
        ]
      },
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FolderResource"
                }
              }
            },
            "description": "Folder + files"
          },
          "401": {
            "description": "Folder password required or wrong"
          },
          "404": {
            "description": "Folder not found"
          }
        },
        "summary": "Get folder metadata + file list",
        "tags": [
          "api-folders"
        ]
      },
      "parameters": [
        {
          "description": "Folder ID",
          "in": "path",
          "name": "id",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "description": "Required when the folder is password-protected",
          "in": "header",
          "name": "X-Folder-Password",
          "required": false,
          "schema": {
            "type": "string"
          }
        }
      ]
    },
    "/api/v1/folders/{id}/files/{fileID}": {
      "delete": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteResult"
                }
              }
            },
            "description": "File deleted"
          },
          "401": {
            "description": "Folder password required or wrong"
          },
          "404": {
            "description": "File or folder not found"
          }
        },
        "summary": "Delete a single file from the folder (permanent)",
        "tags": [
          "api-folders"
        ]
      },
      "parameters": [
        {
          "description": "Folder ID",
          "in": "path",
          "name": "id",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "description": "File ID (public_id)",
          "in": "path",
          "name": "fileID",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "description": "Required when the folder is password-protected",
          "in": "header",
          "name": "X-Folder-Password",
          "required": false,
          "schema": {
            "type": "string"
          }
        }
      ]
    },
    "/api/v1/folders/{id}/files/{fileID}/regenerate": {
      "parameters": [
        {
          "description": "Folder ID",
          "in": "path",
          "name": "id",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "description": "Current public_id of the file",
          "in": "path",
          "name": "fileID",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "description": "Required when the folder is password-protected",
          "in": "header",
          "name": "X-Folder-Password",
          "required": false,
          "schema": {
            "type": "string"
          }
        }
      ],
      "post": {
        "description": "Invalidates the old /d/{id} URL and returns a fresh one. The on-disk blob is unchanged.",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegenerateResult"
                }
              }
            },
            "description": "Regenerated"
          },
          "401": {
            "description": "Folder password required or wrong"
          },
          "404": {
            "description": "File or folder not found"
          },
          "429": {
            "description": "Rate limited (1 regeneration per hour per file)"
          }
        },
        "summary": "Generate a new download link for a file (rate-limited 1/hour)",
        "tags": [
          "api-folders"
        ]
      }
    },
    "/api/v1/folders/{id}/password": {
      "parameters": [
        {
          "description": "Folder ID",
          "in": "path",
          "name": "id",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "description": "Current folder password, required if one is already set",
          "in": "header",
          "name": "X-Folder-Password",
          "required": false,
          "schema": {
            "type": "string"
          }
        }
      ],
      "post": {
        "description": "Send {\"new_password\": \"...\"} to set/change. Send empty string to remove the password.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "new_password": {
                    "description": "Empty string to remove the password",
                    "type": "string"
                  }
                },
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Password updated"
          },
          "400": {
            "description": "Password too short"
          },
          "401": {
            "description": "Current password required or wrong"
          }
        },
        "summary": "Set, change or remove the folder password",
        "tags": [
          "api-folders"
        ]
      }
    },
    "/d/{fileId}": {
      "parameters": [
        {
          "description": "Public file ID",
          "in": "path",
          "name": "fileId",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "post": {
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "properties": {
                  "password": {
                    "description": "Required when the file is encrypted.",
                    "type": "string"
                  }
                },
                "type": "object"
              }
            }
          },
          "required": false
        },
        "responses": {
          "200": {
            "description": "Binary stream (attachment)"
          },
          "401": {
            "description": "Missing or wrong password"
          },
          "404": {
            "description": "Not found or expired"
          }
        },
        "summary": "Stream the file bytes",
        "tags": [
          "download"
        ]
      }
    },
    "/flux/": {
      "post": {
        "description": "Initialize a new tus.io upload. Returns a Location URL for subsequent PATCH/HEAD/DELETE.",
        "parameters": [
          {
            "description": "Must be '1.0.0'",
            "in": "header",
            "name": "Tus-Resumable",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Total file size in bytes",
            "in": "header",
            "name": "Upload-Length",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Comma-separated 'key value-base64' pairs (filename, content_type, encrypt, password, ttl_hours, folder_id)",
            "in": "header",
            "name": "Upload-Metadata",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Upload created",
            "headers": {
              "Location": {
                "description": "Upload URL for PATCH/HEAD/DELETE",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "Create a resumable upload",
        "tags": [
          "flux"
        ]
      }
    },
    "/flux/{uploadId}": {
      "delete": {
        "parameters": [
          {
            "description": "Must be '1.0.0'",
            "in": "header",
            "name": "Tus-Resumable",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Upload aborted"
          }
        },
        "summary": "Terminate upload in progress",
        "tags": [
          "flux"
        ]
      },
      "head": {
        "parameters": [
          {
            "description": "Must be '1.0.0'",
            "in": "header",
            "name": "Tus-Resumable",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Offset retrieved",
            "headers": {
              "Upload-Length": {
                "schema": {
                  "type": "integer"
                }
              },
              "Upload-Offset": {
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "404": {
            "description": "Upload not found"
          }
        },
        "summary": "Get current upload offset",
        "tags": [
          "flux"
        ]
      },
      "parameters": [
        {
          "description": "Upload identifier",
          "in": "path",
          "name": "uploadId",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "patch": {
        "parameters": [
          {
            "description": "Must be '1.0.0'",
            "in": "header",
            "name": "Tus-Resumable",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Byte offset where this chunk begins",
            "in": "header",
            "name": "Upload-Offset",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/offset+octet-stream": {
              "schema": {
                "format": "binary",
                "type": "string"
              }
            }
          },
          "required": true
        },
        "responses": {
          "204": {
            "description": "Chunk received. On the final chunk, returns 200 with X-File-Id, X-Folder-Id, X-Download-Url, X-Folder-Url headers and a JSON body including expires_at and expires_iso.",
            "headers": {
              "X-Download-Url": {
                "schema": {
                  "type": "string"
                }
              },
              "X-File-Id": {
                "schema": {
                  "type": "string"
                }
              },
              "X-Folder-Id": {
                "schema": {
                  "type": "string"
                }
              },
              "X-Folder-New": {
                "schema": {
                  "type": "boolean"
                }
              },
              "X-Folder-Url": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "Send a chunk",
        "tags": [
          "flux"
        ]
      }
    }
  },
  "servers": [
    {
      "description": "production",
      "url": "https://files.vorcarohub.com"
    },
    {
      "description": "current host",
      "url": "/"
    }
  ],
  "tags": [
    {
      "description": "tus.io v1 resumable uploads (/flux/)",
      "name": "flux"
    },
    {
      "description": "JSON file metadata (/api/v1/files/)",
      "name": "api-files"
    },
    {
      "description": "JSON folder operations (/api/v1/folders/)",
      "name": "api-folders"
    },
    {
      "description": "Binary download (/d/)",
      "name": "download"
    }
  ]
}