{
  "openapi": "3.1.1",
  "info": {
    "title": "Sharecrate Storage Report API",
    "version": "1.0.0",
    "summary": "Paste a file listing: see what fills your drive and what to delete to get under a quota.",
    "description": "Every endpoint performs the same calculation as the human page and returns inputs, result, units, assumptions, sources, warnings and computedAt. MCP endpoint: /mcp."
  },
  "servers": [
    {
      "url": "https://sharecratestoragereport.usefulweb.app"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Paste a file listing: see what fills your drive and what to delete to get under a quota.",
        "description": "Reads a file listing — a CSV with path and size (plus modified date, owner, SHA-256, older-version bytes or trash flag when you have them) or the output of du -ab / find -printf — and shows the space per file type, top folder and person, the largest files, duplicate copies, large files nobody touched for a long time, and an ordered clean-up plan with the space each step frees against your quota.\n\nMethodology:\n- Sizes are read as bytes; suffixes K, M, G, T (also KB/KiB …) count in steps of 1024, like du -h and most drives. Lines that cannot be read are listed as skipped, never guessed.\n- Without a header the listing is read as “size path” lines; folder lines that du prints for every directory are dropped (a path that is the parent of another path is a folder), so nothing is counted twice.\n- File types come from the extension (no file contents are read). Duplicates are exact when the listing has SHA-256 values, otherwise “possible” for the same name and size.\n- Stored size = files + older versions + trash (minus identical copies when the drive deduplicates). The plan frees space in this order: empty the trash, delete older versions, remove duplicate copies, then large files untouched for the chosen number of days.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "sharecrate_storage_report",
        "x-owner-app": "sharecrate",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SharecrateStorageReportInput"
              },
              "examples": {
                "example1": {
                  "summary": "Team drive over its 2 GB quota",
                  "value": {
                    "listing": "path,bytes,modified,owner,sha256\nProjects/Launch/video-final.mp4,734003200,2026-10-02,Ana,\nProjects/Launch/video-final (copy).mp4,734003200,2026-10-02,Ben,\nProjects/Launch/press-kit.zip,52428800,2026-11-20,Ana,\nPhotos/2024/IMG_0001.jpg,5242880,2024-06-01,Cleo,\nPhotos/2024/IMG_0002.jpg,5767168,2024-06-01,Cleo,\nPhotos/2024/raw-backup.zip,1288490188,2024-06-03,Cleo,\nHandbook/Onboarding.pdf,2202009,2026-09-15,Ana,\nHandbook/Onboarding.md,18432,2026-11-28,Ben,\nFinance/2025-budget.xlsx,412000,2025-12-12,Ana,\nMusic/demo-mix.wav,98566144,2025-03-01,Ben,",
                    "quotaMB": 2048,
                    "targetPercent": 90,
                    "staleDays": 365,
                    "bigFileMB": 10,
                    "asOf": "2026-12-01"
                  }
                },
                "example2": {
                  "summary": "du -ab output of a web server folder",
                  "value": {
                    "listing": "4096\t./site/assets\n1048576\t./site/assets/hero.webp\n2097152\t./site/assets/video.mp4\n20480\t./site/index.html\n512\t./site/robots.txt\n3170816\t./site\n734003200\t./backups/site-2025-01.tar.gz\n734003200\t./backups/site-2025-02.tar.gz",
                    "quotaMB": 1024,
                    "targetPercent": 80,
                    "staleDays": 30,
                    "bigFileMB": 100
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SharecrateStorageReportResult"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON body.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (see errors[]).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tool": {
      "get": {
        "operationId": "getToolDefinition",
        "summary": "Inputs, output schema and examples for this tool",
        "responses": {
          "200": {
            "description": "Tool definition.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Problem": {
        "type": "object",
        "description": "RFC 9457 problem details. 422 responses include per-field `errors`.",
        "required": [
          "type",
          "title",
          "status",
          "detail"
        ],
        "properties": {
          "type": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "detail": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "field",
                "message"
              ],
              "properties": {
                "field": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "SharecrateStorageReportInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "listing": {
            "title": "File listing",
            "description": "CSV/TSV with a header row containing path and bytes (sizes like 12K or 3.4 MB work too), or lines of “size path” from du -ab or find -printf \"%s\\t%p\\n\".",
            "type": "string",
            "maxLength": 6000000,
            "default": "path,bytes,modified,owner,sha256\nProjects/Launch/video-final.mp4,734003200,2026-10-02,Ana,\nProjects/Launch/video-final (copy).mp4,734003200,2026-10-02,Ben,\nProjects/Launch/press-kit.zip,52428800,2026-11-20,Ana,\nPhotos/2024/IMG_0001.jpg,5242880,2024-06-01,Cleo,\nPhotos/2024/IMG_0002.jpg,5767168,2024-06-01,Cleo,\nPhotos/2024/raw-backup.zip,1288490188,2024-06-03,Cleo,\nHandbook/Onboarding.pdf,2202009,2026-09-15,Ana,\nHandbook/Onboarding.md,18432,2026-11-28,Ben,\nFinance/2025-budget.xlsx,412000,2025-12-12,Ana,\nMusic/demo-mix.wav,98566144,2025-03-01,Ben,"
          },
          "quotaMB": {
            "title": "Quota in MB (0 = none)",
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "default": 2048
          },
          "targetPercent": {
            "title": "Aim to use at most (% of the quota)",
            "type": "number",
            "minimum": 10,
            "maximum": 100,
            "default": 90
          },
          "staleDays": {
            "title": "Untouched for at least (days)",
            "type": "number",
            "minimum": 1,
            "maximum": 36500,
            "default": 365
          },
          "bigFileMB": {
            "title": "Large file from (MB)",
            "type": "number",
            "minimum": 0,
            "maximum": 1000000,
            "default": 10
          },
          "asOf": {
            "title": "Today’s date for ages (YYYY-MM-DD, empty = newest date in the listing)",
            "type": "string",
            "maxLength": 10,
            "default": ""
          },
          "dedupe": {
            "title": "Identical files are stored once (drives that deduplicate)",
            "type": "boolean",
            "default": false
          }
        },
        "required": []
      },
      "SharecrateStorageReportResult": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "schemaVersion",
          "tool",
          "computedAt",
          "inputs",
          "summary",
          "result",
          "units",
          "assumptions",
          "sources",
          "warnings",
          "presentation",
          "links"
        ],
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "1.0"
          },
          "tool": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "name",
              "version"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "version": {
                "type": "string"
              }
            }
          },
          "computedAt": {
            "type": "string",
            "format": "date-time"
          },
          "inputs": {
            "type": "object",
            "description": "Normalised inputs actually used, including applied defaults."
          },
          "summary": {
            "type": "string"
          },
          "result": {
            "type": "object"
          },
          "units": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "assumptions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "title"
              ],
              "properties": {
                "title": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                },
                "publisher": {
                  "type": "string"
                },
                "retrievedAt": {
                  "type": "string"
                },
                "note": {
                  "type": "string"
                }
              }
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "presentation": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Display blocks used by the human page (same data)."
          },
          "links": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "human",
              "api",
              "openapi",
              "methodology"
            ],
            "properties": {
              "human": {
                "type": "string",
                "format": "uri"
              },
              "api": {
                "type": "string",
                "format": "uri"
              },
              "openapi": {
                "type": "string",
                "format": "uri"
              },
              "methodology": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        }
      }
    }
  }
}