{
  "openapi": "3.1.0",
  "info": {
    "title": "ship.page",
    "version": "1.0.0",
    "description": "Throw HTML at an API, get an unguessable URL back. Anonymous deploys need no auth; account routes accept an sp_ API key or a Firebase ID token as a Bearer credential. Docs: https://ship.page/docs — agents start at https://ship.page/docs/agents. MCP server: POST https://ship.page/mcp.",
    "contact": { "name": "Bitgate, Inc.", "url": "https://ship.page", "email": "abuse@bitgate.com" }
  },
  "servers": [{ "url": "https://ship.page" }],
  "security": [],
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "An sp_… API key (minted via POST /keys or the dashboard) or a Firebase ID token."
      }
    },
    "schemas": {
      "ClientConfig": {
        "type": "object",
        "required": ["serve_domain"],
        "properties": { "serve_domain": { "type": "string", "example": "ship.place" } }
      },
      "Error": {
        "type": "object",
        "required": ["error", "code"],
        "properties": {
          "error": { "type": "string", "description": "Human-readable message." },
          "code": {
            "type": "string",
            "description": "Machine-stable error code — parse this, not `error`.",
            "enum": [
              "bad_request",
              "invalid_ttl",
              "invalid_email",
              "invalid_name",
              "invalid_plan",
              "invalid_zip",
              "invalid_claim_token",
              "file_cap_exceeded",
              "zip_too_large",
              "body_too_large",
              "decompression_cap",
              "auth_required",
              "subscription_required",
              "not_found",
              "method_not_allowed",
              "already_claimed",
              "claim_conflict",
              "restore_conflict",
              "drop_expired",
              "rate_limited",
              "backend_unavailable",
              "internal_error",
              "expired",
              "too_large",
              "unsupported",
              "busy",
              "hash_mismatch",
              "storage_full",
              "unknown_blob",
              "draft_changed",
              "content_changed",
              "publish_in_progress",
              "publish_incomplete",
              "blocked",
              "missing",
              "already_live",
              "invalid_request",
              "invalid_link_name",
              "link_name_reserved",
              "link_name_taken",
              "link_exists",
              "link_limit_reached",
              "link_frozen",
              "drop_not_found",
              "not_saving"
            ]
          },
          "hint": { "type": "string", "description": "Human-directed guidance. Agents should relay this to their user verbatim." },
          "upgrade_url": { "type": "string", "format": "uri", "description": "Present when a plan upgrade resolves the failure." },
          "docs_url": { "type": "string", "format": "uri", "description": "Relevant docs page, when one applies." }
        }
      },
      "DeployResponse": {
        "type": "object",
        "required": ["slug", "url", "files", "plan", "expires_at", "password_protected"],
        "properties": {
          "slug": { "type": "string", "example": "vast-juice-c2dse" },
          "url": { "type": "string", "format": "uri", "example": "https://vast-juice-c2dse.ship.place/" },
          "files": { "type": "array", "items": { "type": "string" } },
          "plan": { "type": "string", "enum": ["free", "pro", "team"] },
          "expires_at": { "type": ["string", "null"], "format": "date-time", "description": "Null for drops that never expire (subscribers)." },
          "name": { "type": "string", "description": "Present when ?name= was used." },
          "replaced": { "type": "boolean", "description": "Present when ?name= was used; true if an existing named drop was replaced." },
          "password_protected": { "type": "boolean", "description": "Whether visitors must unlock the drop with a password." },
          "claim_token": {
            "type": "string",
            "pattern": "^spc_[a-z0-9]{24}$",
            "description": "One-time claim token, present only on anonymous deploys and shown exactly once. Anyone holding it can attach the drop to an account via POST /drops/{slug}/claim."
          },
          "claim_url": {
            "type": "string",
            "format": "uri",
            "description": "Present on anonymous API and MCP deploys: a browser link that saves the drop to whichever account opens it. It carries the claim token, so keep it private."
          },
          "next_step": {
            "type": "string",
            "description": "Present on API and MCP deploys that expire: when the page expires and how to keep it online, written to be passed on to the person the page was made for."
          },
          "hint": {
            "type": "string",
            "description": "Present when the requested ttl was over the plan's maximum; the drop got the maximum instead."
          },
          "claim_email": {
            "type": "string",
            "format": "email",
            "description": "Present when ?email= was accepted on an anonymous deploy; the claim link was mailed to this address."
          },
          "forms": {
            "oneOf": [{ "$ref": "#/components/schemas/DeployForms" }, { "type": "null" }],
            "description": "What happens to the forms on the uploaded pages, found at upload with nothing to set up. Null or absent when there are none."
          }
        }
      },
      "AppendResponse": {
        "type": "object",
        "required": ["slug", "url", "files", "total_files", "plan", "expires_at"],
        "properties": {
          "slug": { "type": "string" },
          "url": { "type": "string", "format": "uri" },
          "files": { "type": "array", "items": { "type": "string" }, "description": "Files added by this request." },
          "total_files": { "type": "integer", "description": "Total files in the drop after appending (cap 10,000)." },
          "plan": { "type": "string", "enum": ["free", "pro", "team"] },
          "expires_at": { "type": ["string", "null"], "format": "date-time" }
        }
      },
      "PasswordBody": {
        "type": "object",
        "required": ["password"],
        "properties": {
          "password": {
            "type": "string",
            "minLength": 8,
            "maxLength": 128,
            "writeOnly": true,
            "description": "8-128 Unicode characters, at most 512 UTF-8 bytes. Never put passwords in URLs."
          }
        }
      },
      "PasswordResponse": {
        "type": "object",
        "required": ["slug", "password_protected"],
        "properties": {
          "slug": { "type": "string" },
          "password_protected": { "type": "boolean" }
        }
      },
      "FilesBody": {
        "type": "object",
        "required": ["files"],
        "properties": {
          "files": {
            "type": "object",
            "description": "Path → content map. Values are a string, or { encoding: \"base64\", content: string } for binary.",
            "additionalProperties": {
              "oneOf": [
                { "type": "string" },
                {
                  "type": "object",
                  "required": ["encoding", "content"],
                  "properties": {
                    "encoding": { "type": "string", "const": "base64" },
                    "content": { "type": "string" }
                  }
                }
              ]
            }
          }
        }
      },
      "Drop": {
        "type": "object",
        "properties": {
          "slug": { "type": "string" },
          "url": { "type": "string", "format": "uri" },
          "name": { "type": ["string", "null"] },
          "file_count": { "type": "integer" },
          "redeploy_count": { "type": "integer" },
          "password_protected": { "type": "boolean" },
          "thumb": { "type": ["string", "null"], "format": "uri", "description": "Screenshot of the drop's root page (1280x800 WebP), taken a few minutes after each deploy. Null until captured, and for password-protected drops." },
          "created_at": { "type": "string", "format": "date-time" },
          "updated_at": { "type": "string", "format": "date-time" },
          "expires_at": { "type": ["string", "null"], "format": "date-time" },
          "source": { "type": ["string", "null"], "enum": ["landing", "dashboard", "api", "mcp", "chatgpt", "tools", "css-to-tailwind", "tailwind-to-css", "growth-verify", null], "description": "Creation channel, self-reported via the x-ship-source header. chatgpt marks pages published from the ship.page ChatGPT plugin." }
        }
      },
      "EditorFile": {
        "type": "object",
        "required": ["path", "bytes", "sha256", "mime"],
        "properties": {
          "path": { "type": "string", "example": "css/site.css" },
          "bytes": { "type": "integer" },
          "sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
          "mime": { "type": "string" }
        }
      },
      "EditorDraft": {
        "type": "object",
        "required": ["draft_rev", "updated_at", "files"],
        "properties": {
          "draft_rev": { "type": "integer", "description": "Send it back on the next draft write; it changes on every write." },
          "updated_at": { "type": "string", "format": "date-time" },
          "files": { "type": "array", "items": { "$ref": "#/components/schemas/EditorFile" } }
        }
      },
      "EditorTree": {
        "type": "object",
        "required": ["slug", "content_rev", "cap", "live", "draft", "pending", "imported"],
        "properties": {
          "slug": { "type": "string" },
          "content_rev": { "type": "integer", "description": "Changes on every publish, from the editor or the API. Publish with it as base_content_rev." },
          "cap": { "type": "object", "properties": { "files": { "type": "integer", "example": 200 }, "bytes": { "type": "integer", "example": 20971520 } } },
          "live": {
            "type": "object",
            "required": ["revision_id", "number", "bytes", "files"],
            "properties": {
              "revision_id": { "type": "string" },
              "number": { "type": "integer" },
              "bytes": { "type": "integer" },
              "files": { "type": "array", "items": { "$ref": "#/components/schemas/EditorFile" } }
            }
          },
          "draft": { "oneOf": [{ "$ref": "#/components/schemas/EditorDraft" }, { "type": "null" }] },
          "pending": { "type": "boolean", "description": "A publish is still being written out." },
          "imported": { "type": "boolean", "description": "True when this call imported the drop into the editor." }
        }
      },
      "EditorRevision": {
        "type": "object",
        "required": ["id", "number", "title", "source", "created_at", "bytes", "file_count", "live", "changes"],
        "properties": {
          "id": { "type": "string" },
          "number": { "type": "integer" },
          "title": { "type": ["string", "null"] },
          "source": { "type": "string", "enum": ["editor", "api", "mcp", "restore", "import"] },
          "created_at": { "type": "string", "format": "date-time" },
          "bytes": { "type": "integer" },
          "file_count": { "type": "integer" },
          "live": { "type": "boolean" },
          "changes": {
            "type": "object",
            "properties": { "added": { "type": "integer" }, "modified": { "type": "integer" }, "deleted": { "type": "integer" } }
          }
        }
      },
      "DropDetail": {
        "type": "object",
        "required": ["slug", "name", "url", "file_count", "bytes", "redeploy_count", "created_at", "updated_at", "expires_at", "source", "password_protected", "blocked", "thumb", "history", "live_version", "version_count"],
        "properties": {
          "slug": { "type": "string" },
          "name": { "type": ["string", "null"] },
          "url": { "type": "string", "format": "uri" },
          "file_count": { "type": "integer" },
          "bytes": { "type": ["integer", "null"], "description": "Total size of the live files; null for drops without version history." },
          "redeploy_count": { "type": "integer" },
          "created_at": { "type": "string", "format": "date-time" },
          "updated_at": { "type": "string", "format": "date-time" },
          "expires_at": { "type": ["string", "null"], "format": "date-time" },
          "source": { "type": ["string", "null"], "description": "Creation channel, self-reported via the x-ship-source header." },
          "password_protected": { "type": "boolean" },
          "blocked": { "type": "boolean", "description": "Taken down: its files can't be downloaded and its versions can't be restored." },
          "thumb": { "type": ["string", "null"], "format": "uri", "description": "Screenshot of the drop's root page (1280x800 WebP). Null until captured, and for password-protected or taken-down drops." },
          "history": { "type": "boolean", "description": "The drop keeps versions: true once it was opened in or published through the site editor." },
          "live_version": {
            "oneOf": [
              {
                "type": "object",
                "required": ["id", "number", "title", "source", "created_at"],
                "properties": {
                  "id": { "type": "string" },
                  "number": { "type": "integer" },
                  "title": { "type": ["string", "null"] },
                  "source": { "type": "string", "enum": ["editor", "api", "mcp", "restore", "import"] },
                  "created_at": { "type": "string", "format": "date-time" }
                }
              },
              { "type": "null" }
            ]
          },
          "version_count": { "type": "integer", "description": "Published versions kept: the live one plus earlier ones. 0 without history." },
          "forms": {
            "oneOf": [{ "$ref": "#/components/schemas/DropFormsSummary" }, { "type": "null" }],
            "description": "Form responses on the drop. Null when the scan found no form that saves responses."
          }
        }
      },
      "DropContentFile": {
        "type": "object",
        "required": ["path", "bytes", "mime"],
        "properties": { "path": { "type": "string" }, "bytes": { "type": "integer" }, "mime": { "type": "string" } }
      },
      "CustomDomain": {
        "type": "object",
        "required": [
          "id", "host", "address", "apex", "apexMain", "slug", "status", "records", "problem", "message", "apexOk", "apexReady", "apexProblem", "apexMessage",
          "frozen", "pausesAt", "endsAt", "dnsHost", "checkedAt", "liveAt", "createdAt"
        ],
        "properties": {
          "id": { "type": "string", "format": "uuid" },
          "host": { "type": "string", "description": "The name the CNAME goes on; www.<domain> for a registered domain.", "example": "docs.example.com" },
          "address": { "type": "string", "description": "Where the drop lives; the other name of a bare domain redirects here.", "example": "docs.example.com" },
          "apex": { "type": "boolean", "description": "A registered domain: the bare name is served through A and AAAA records." },
          "apexMain": { "type": "boolean", "description": "The bare name is the main address and www redirects to it." },
          "slug": { "type": ["string", "null"], "description": "The drop it shows; null once that drop is deleted." },
          "status": { "type": "string", "enum": ["waiting", "securing", "live", "moved", "removed"] },
          "records": {
            "type": "array",
            "description": "The DNS records to set, while the domain is active.",
            "items": {
              "type": "object",
              "required": ["type", "name", "value"],
              "properties": {
                "type": { "type": "string", "enum": ["CNAME", "A", "AAAA"] },
                "name": { "type": "string", "description": "Relative to the zone; @ is the zone itself.", "example": "docs" },
                "value": { "type": "string", "example": "4k5v4qbhn3.pagedns.com" }
              }
            }
          },
          "problem": { "type": ["string", "null"], "description": "Why it isn't live yet, or why it ended." },
          "message": { "type": ["string", "null"], "description": "The problem in a sentence." },
          "apexOk": { "type": ["boolean", "null"], "description": "Whether the bare name's A and AAAA records are right; null until checked or for subdomains." },
          "apexReady": { "type": ["boolean", "null"], "description": "Whether the bare name is served; null for subdomains." },
          "apexProblem": { "type": ["string", "null"] },
          "apexMessage": { "type": ["string", "null"] },
          "frozen": { "type": "boolean", "description": "Taken down with its drop: shows the removed page and can't be changed." },
          "pausesAt": { "type": ["string", "null"], "format": "date-time", "description": "When it stops showing the drop after the Team plan ended; null while Team is active." },
          "endsAt": { "type": ["string", "null"], "format": "date-time", "description": "When it is disconnected after the Team plan ended; null while Team is active." },
          "dnsHost": {
            "type": ["object", "null"],
            "description": "Where the domain's DNS is hosted, when we recognise it.",
            "required": ["name", "url", "cloudflare"],
            "properties": { "name": { "type": "string" }, "url": { "type": ["string", "null"], "format": "uri" }, "cloudflare": { "type": "boolean" } }
          },
          "checkedAt": { "type": ["string", "null"], "format": "date-time" },
          "liveAt": { "type": ["string", "null"], "format": "date-time" },
          "createdAt": { "type": "string", "format": "date-time" }
        }
      },
      "DeployForms": {
        "type": "object",
        "required": ["saving", "lines"],
        "properties": {
          "saving": { "type": "integer", "description": "Forms saving responses right now." },
          "lines": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/DeployFormLine" },
            "description": "One line per form a visitor fills in. Search, login and payment forms aren't listed, nor forms without an email or phone field unless they were switched on."
          }
        }
      },
      "DeployFormLine": {
        "type": "object",
        "required": ["id", "page", "label", "state"],
        "properties": {
          "id": { "type": "string", "description": "The form's page and key, like index.html#contact." },
          "page": { "type": "string", "description": "The HTML file the form is on, without a leading slash." },
          "label": { "type": "string", "description": "The form's heading or its submit button text." },
          "state": {
            "type": "string",
            "enum": ["saving", "claim", "script_off", "own_code", "external", "mailto", "ignored"],
            "description": "saving: responses are saved for the owner. claim: saving starts once an account claims the drop. script_off: the form needs the forms script, which is off on this drop (paid drops start with it off); turn it on with PUT /drops/{slug}/forms. own_code: the page sends the form itself, so it's left alone. external: it posts to another site. mailto: it opens an email. ignored: it carries data-ship-ignore."
          }
        }
      },
      "DropFormsSummary": {
        "type": "object",
        "required": ["saving", "total", "unread", "locked"],
        "properties": {
          "saving": { "type": "integer", "description": "Forms saving responses right now." },
          "total": { "type": "integer", "description": "Responses on the drop." },
          "unread": { "type": "integer" },
          "locked": { "type": "integer", "description": "Responses the account's plan doesn't show in full." }
        }
      },
      "FormResponse": {
        "type": "object",
        "required": ["id", "form", "form_label", "page", "kind", "created_at", "country", "read", "spam", "locked", "held", "fields"],
        "properties": {
          "id": { "type": "string" },
          "form": { "type": "string", "description": "The form's id, as in forms[].id." },
          "form_label": { "type": "string" },
          "page": { "type": "string", "description": "The HTML file the form is on." },
          "kind": {
            "type": "string",
            "enum": ["copy", "get", "native", "test"],
            "description": "native: a real POST the server stored. copy: copied by the forms script after the page's own code handled the submit. get: a GET form copied by the script. test: sent from the owner's test link."
          },
          "created_at": { "type": "string", "format": "date-time" },
          "country": { "type": ["string", "null"], "description": "The visitor's country code, when known." },
          "read": { "type": "boolean" },
          "spam": { "type": "boolean", "description": "Marked as spam, for example sent without a valid page token. Spam isn't counted or emailed and is deleted after 30 days." },
          "locked": {
            "type": "boolean",
            "description": "The account's plan doesn't show this response in full: fields carry their names and a short, scrubbed start of each value, never contact details."
          },
          "held": { "type": "boolean", "description": "Held until our abuse check clears the page version it came from; a held response has no fields." },
          "fields": {
            "type": "array",
            "items": { "type": "object", "required": ["name", "value"], "properties": { "name": { "type": "string" }, "value": { "type": "string" } } },
            "description": "What the visitor sent, in form order."
          }
        }
      },
      "DropFormSetting": {
        "type": "object",
        "required": ["id", "page", "label", "via", "off", "override", "on"],
        "properties": {
          "id": { "type": "string", "description": "The form's page and key, like index.html#contact." },
          "page": { "type": "string" },
          "label": { "type": "string" },
          "via": {
            "type": ["string", "null"],
            "enum": ["copy", "native", null],
            "description": "native: the server stores the form's POST. copy: the forms script copies the submit. Null when the form is never touched."
          },
          "off": {
            "type": ["string", "null"],
            "enum": ["external", "mailto", "search", "secret", "own_code", "no_contact", "ignored", null],
            "description": "Why the form is off by default; null when it's on. secret: it has a password or card field. own_code: the page sends it itself. no_contact: it has no email or phone field; switch it on with an override or data-ship-form. ignored: it carries data-ship-ignore."
          },
          "override": { "type": ["string", "null"], "enum": ["on", "off", null], "description": "The owner's choice; null follows the scan." },
          "on": { "type": "boolean", "description": "Whether the form saves responses." }
        }
      },
      "DropFormsSettings": {
        "type": "object",
        "required": ["capture", "alerts", "inject", "injects"],
        "properties": {
          "capture": { "type": "boolean", "description": "The drop saves form responses." },
          "alerts": { "type": "boolean", "description": "Email alerts for new responses." },
          "inject": { "type": ["boolean", "null"], "description": "The forms script on this drop: on, off, or null to follow the plan (on for free pages, off for paid ones)." },
          "injects": { "type": "boolean", "description": "Whether the forms script runs on this drop right now." }
        }
      },
      "FormResponsesPage": {
        "type": "object",
        "required": ["responses", "next_before", "summary", "free_reads", "forms", "settings"],
        "properties": {
          "responses": { "type": "array", "items": { "$ref": "#/components/schemas/FormResponse" }, "description": "Newest first." },
          "next_before": { "type": ["string", "null"], "description": "Pass as before for the next page; null on the last one." },
          "summary": { "$ref": "#/components/schemas/DropFormsSummary" },
          "free_reads": { "type": ["integer", "null"], "description": "Responses a free account reads in full on this drop; null when the owner reads everything." },
          "forms": { "type": "array", "items": { "$ref": "#/components/schemas/DropFormSetting" } },
          "settings": { "$ref": "#/components/schemas/DropFormsSettings" }
        }
      },
      "DropFormsState": {
        "type": "object",
        "required": ["forms", "settings"],
        "properties": {
          "forms": { "type": "array", "items": { "$ref": "#/components/schemas/DropFormSetting" } },
          "settings": { "$ref": "#/components/schemas/DropFormsSettings" }
        }
      },
      "DropFormsUpdate": {
        "type": "object",
        "description": "Send only what changes.",
        "properties": {
          "capture": { "type": "boolean", "description": "Save form responses on this drop." },
          "alerts": { "type": "boolean", "description": "Email alerts for new responses." },
          "inject": { "type": ["boolean", "null"], "description": "Turn the forms script on or off; null goes back to the plan's default." },
          "overrides": {
            "type": "object",
            "additionalProperties": { "type": ["string", "null"], "enum": ["on", "off", null] },
            "description": "Keyed by form id. off stops a form saving, on switches on a form that's off for having no email or phone field, null goes back to what the scan decided."
          }
        }
      },
      "FormResponseUpdate": {
        "type": "object",
        "description": "Send read, spam or both.",
        "properties": { "read": { "type": "boolean" }, "spam": { "type": "boolean" } }
      },
      "FormResponsesMarkRead": {
        "type": "object",
        "required": ["read"],
        "properties": {
          "read": { "type": "boolean", "const": true },
          "form": { "type": "string", "description": "Only this form's responses, by form id." }
        }
      },
      "FormResponsesUpdated": {
        "type": "object",
        "required": ["updated"],
        "properties": { "updated": { "type": "integer", "description": "Responses marked read." } }
      },
      "FormTestLink": {
        "type": "object",
        "required": ["url", "expires_at"],
        "properties": {
          "url": { "type": "string", "format": "uri", "description": "The live page with a signed test token." },
          "expires_at": { "type": "string", "format": "date-time" }
        }
      }
    },
    "responses": {
      "BadRequest": {
        "description": "Bad request — unparseable body, bad paths, invalid ttl/name, per-request file cap, invalid zip.",
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
      },
      "Unauthorized": {
        "description": "Missing or invalid credential.",
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
      },
      "PaymentRequired": {
        "description": "Subscriber-gated feature on a free account. The body's `hint` and `upgrade_url` tell the user how to upgrade.",
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
      },
      "Forbidden": {
        "description": "Not open to this account.",
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
      },
      "Unprocessable": {
        "description": "Well-formed but unusable input; the body's `code` says which.",
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
      },
      "Domain": {
        "description": "The custom domain as it stands.",
        "content": {
          "application/json": {
            "schema": { "type": "object", "required": ["domain"], "properties": { "domain": { "$ref": "#/components/schemas/CustomDomain" } } }
          }
        }
      },
      "NotFound": {
        "description": "Not found (also returned for resources owned by someone else).",
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
      },
      "Conflict": {
        "description": "Conflict with the resource's current state; the body's `code` says which.",
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
      },
      "PayloadTooLarge": {
        "description": "Payload too large — a non-zip body over 10 MB, a zip over the plan cap or past its 4× decompression ceiling, or the 10,000-file drop total.",
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
      },
      "Unavailable": {
        "description": "Required backend unavailable. Password creation and rotation fail closed when billing cannot be verified; retry later.",
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
      },
      "RateLimited": {
        "description": "Rate limited. Back off per the Retry-After header (60s).",
        "headers": {
          "Retry-After": { "schema": { "type": "integer", "example": 60 }, "description": "Seconds to wait before retrying." }
        },
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
      }
    }
  },
  "paths": {
    "/deploy": {
      "post": {
        "operationId": "deploy",
        "summary": "Deploy a drop (anonymous allowed)",
        "description": "Body format is picked by Content-Type: `text/html` (or any non-JSON/non-zip type) stores the raw body as index.html; `application/json` expects a files map; `application/zip` unpacks an archive (single root dir auto-stripped). Limits: 100 files/request anonymous+free, 10,000 paid; zip 25 MB free / 100 MB paid (4× decompression cap); non-zip bodies 10 MB. Rate: 10 deploys/min per IP anonymous and free, 120/min per account on paid plans; 429 responses carry Retry-After: 60. To password-protect a drop, send X-Ship-Password with encodeURIComponent(password) and an active paid Pro/Team credential. Never send a password in the query string or files body. Omitting the header on a live named redeploy preserves protection; recreating an expired or purged named drop requires sending the password again. A top-level JSON password property is rejected. The /_ship/ namespace is reserved and cannot be uploaded; an empty header is invalid. Protected reads return 401 until the visitor unlocks in a browser and are never cached. Password creation/rotation returns 503 if billing cannot be verified.",
        "security": [{}, { "bearerAuth": [] }],
        "parameters": [
          {
            "name": "X-Ship-Password",
            "in": "header",
            "schema": { "type": "string", "writeOnly": true },
            "description": "Optional encodeURIComponent(password). Decoded password: 8-128 Unicode characters, at most 512 UTF-8 bytes. Requires an active paid Pro/Team account. Omit to preserve protection on a live named redeploy; use DELETE /drops/{slug}/password to remove it."
          },
          {
            "name": "ttl",
            "in": "query",
            "schema": { "type": "integer", "minimum": 60 },
            "description": "Drop lifetime in seconds. Anonymous default/max: 604800 (7 days). Signed-in free default/max: 2592000 (30 days). A larger value deploys at the max and the response carries a hint saying so. Subscribers may set any value and default to no expiry."
          },
          {
            "name": "name",
            "in": "query",
            "schema": { "type": "string", "pattern": "^[a-z0-9][a-z0-9-]{0,40}$" },
            "description": "Named drop (subscribers only). Stable alias scoped to the account; redeploying the same name replaces content and keeps the URL."
          },
          {
            "name": "email",
            "in": "query",
            "schema": { "type": "string", "format": "email", "maxLength": 254 },
            "description": "Anonymous deploys only: the one-time claim link is mailed to this address, so the drop stays recoverable if the claim_token from the response is lost. Echoed back as claim_email. Ignored for authenticated deploys."
          },
          {
            "name": "agent",
            "in": "query",
            "schema": { "type": "string", "maxLength": 64 },
            "description": "Name of the AI agent or app publishing the drop, e.g. chatgpt, claude, cursor. Stored trimmed and lowercased; empty counts as not sent. AI agents: this is required; e.g. ChatGPT, Claude, etc."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "text/html": { "schema": { "type": "string" }, "example": "<h1>hello</h1>" },
            "application/json": { "schema": { "$ref": "#/components/schemas/FilesBody" } },
            "application/zip": { "schema": { "type": "string", "format": "binary" } }
          }
        },
        "responses": {
          "200": {
            "description": "Drop deployed.",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/DeployResponse" } } }
          },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "402": { "$ref": "#/components/responses/PaymentRequired" },
          "413": { "$ref": "#/components/responses/PayloadTooLarge" },
          "429": { "$ref": "#/components/responses/RateLimited" },
          "503": { "$ref": "#/components/responses/Unavailable" }
        }
      }
    },
    "/deploy/{slug}": {
      "post": {
        "operationId": "appendToDrop",
        "summary": "Append files to an existing drop (subscribers)",
        "description": "Adds files to a drop you own, up to 10,000 files per drop in total. Same body formats as POST /deploy. Existing password protection is preserved. Password input via query or X-Ship-Password is rejected; use the owner password endpoints to rotate it.",
        "security": [{ "bearerAuth": [] }],
        "parameters": [
          { "name": "slug", "in": "path", "required": true, "schema": { "type": "string" } }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "text/html": { "schema": { "type": "string" } },
            "application/json": { "schema": { "$ref": "#/components/schemas/FilesBody" } },
            "application/zip": { "schema": { "type": "string", "format": "binary" } }
          }
        },
        "responses": {
          "200": {
            "description": "Files appended.",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AppendResponse" } } }
          },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "402": { "$ref": "#/components/responses/PaymentRequired" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "413": { "$ref": "#/components/responses/PayloadTooLarge" },
          "429": { "$ref": "#/components/responses/RateLimited" }
        }
      }
    },
    "/config": {
      "get": {
        "operationId": "getConfig",
        "summary": "Public client configuration",
        "description": "Returns the currently active serve domain. The dashboard builds displayed drop URLs from this instead of hardcoding a domain; responses are cacheable (max-age 60s).",
        "responses": {
          "200": {
            "description": "Active client configuration.",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ClientConfig" } } }
          }
        }
      }
    },
    "/drops": {
      "get": {
        "operationId": "listDrops",
        "summary": "List your drops",
        "security": [{ "bearerAuth": [] }],
        "parameters": [
          { "name": "limit", "in": "query", "schema": { "type": "integer", "minimum": 1, "maximum": 500, "default": 100 } },
          { "name": "offset", "in": "query", "schema": { "type": "integer", "minimum": 0, "default": 0 } }
        ],
        "responses": {
          "200": {
            "description": "Drops, newest first.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["total", "drops"],
                  "properties": {
                    "total": { "type": "integer" },
                    "drops": { "type": "array", "items": { "$ref": "#/components/schemas/Drop" } }
                  }
                }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" }
        }
      }
    },
    "/drops/{slug}": {
      "get": {
        "operationId": "getDrop",
        "summary": "View one drop",
        "description": "Everything the dashboard shows about a drop you own, including its live version when it keeps history.",
        "security": [{ "bearerAuth": [] }],
        "parameters": [
          { "name": "slug", "in": "path", "required": true, "schema": { "type": "string" } }
        ],
        "responses": {
          "200": { "description": "The drop.", "content": { "application/json": { "schema": { "type": "object", "required": ["drop"], "properties": { "drop": { "$ref": "#/components/schemas/DropDetail" } } } } } },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "503": { "$ref": "#/components/responses/Unavailable" }
        }
      },
      "delete": {
        "operationId": "deleteDrop",
        "summary": "Delete a drop permanently",
        "description": "Takes the drop offline for good; it can't be restored, and its files are kept but no longer served. Deleted drops can stay edge-cached for up to 60s.",
        "security": [{ "bearerAuth": [] }],
        "parameters": [
          { "name": "slug", "in": "path", "required": true, "schema": { "type": "string" } }
        ],
        "responses": {
          "200": {
            "description": "Drop deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["deleted"],
                  "properties": { "deleted": { "type": "string" } }
                }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "503": { "$ref": "#/components/responses/Unavailable" }
        }
      }
    },
    "/drops/{slug}/password": {
      "parameters": [
        { "name": "slug", "in": "path", "required": true, "schema": { "type": "string" } }
      ],
      "put": {
        "operationId": "setDropPassword",
        "summary": "Set or rotate a drop password (Pro/Team)",
        "description": "Owner-only; requires an active paid Pro/Team subscription. Billing degradation returns 503 without changing protection. Passwords are never returned. Changing access cannot recall content already downloaded or copied.",
        "security": [{ "bearerAuth": [] }],
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PasswordBody" } } }
        },
        "responses": {
          "200": {
            "description": "Password set or rotated.",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PasswordResponse" } } }
          },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "402": { "$ref": "#/components/responses/PaymentRequired" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "429": { "$ref": "#/components/responses/RateLimited" },
          "503": { "$ref": "#/components/responses/Unavailable" }
        }
      },
      "delete": {
        "operationId": "removeDropPassword",
        "summary": "Remove a drop password",
        "description": "Owner-only, including after a paid plan lapses. Removes the gate so anyone with the URL can read the drop. No request body. Cancellation alone does not remove existing protection.",
        "security": [{ "bearerAuth": [] }],
        "responses": {
          "200": {
            "description": "Password removed; password_protected is false.",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PasswordResponse" } } }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "429": { "$ref": "#/components/responses/RateLimited" },
          "503": { "$ref": "#/components/responses/Unavailable" }
        }
      }
    },
    "/_ship/password": {
      "servers": [{
        "url": "https://{slug}.{domain}",
        "variables": {
          "slug": { "default": "your-drop", "description": "Use the slug from the deploy URL." },
          "domain": { "default": "ship.place", "description": "Use the serve domain from the deploy URL." }
        }
      }],
      "post": {
        "operationId": "unlockDrop",
        "summary": "Unlock a protected drop in the visitor's browser",
        "description": "Called on the drop's own HTTPS origin, not ship.page. The Origin header must match that exact origin. Submit JSON {password}; never put it in a URL. Success sets a host-only session cookie valid for 12 hours. Protected pages and assets require this cookie and bypass caching. An account API key does not replace the visitor cookie.",
        "parameters": [
          { "name": "Origin", "in": "header", "required": true, "schema": { "type": "string", "format": "uri" }, "description": "The exact HTTPS origin of the drop, with no path." }
        ],
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PasswordBody" } } }
        },
        "responses": {
          "200": {
            "description": "Unlocked. No password is returned; keep the cookie for subsequent requests to this host.",
            "headers": {
              "Set-Cookie": { "schema": { "type": "string" }, "description": "Host-only visitor session, valid for 12 hours." },
              "Cache-Control": { "schema": { "type": "string" }, "description": "No-store." }
            }
          },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "description": "Password not accepted; the drop remains locked." },
          "403": { "description": "Origin does not match the drop's exact origin." },
          "404": { "$ref": "#/components/responses/NotFound" },
          "429": { "$ref": "#/components/responses/RateLimited" },
          "503": { "$ref": "#/components/responses/Unavailable" }
        }
      }
    },
    "/drops/{slug}/stats": {
      "get": {
        "operationId": "getDropStats",
        "summary": "View stats for a drop",
        "description": "Pageview stats for a drop you own. Bots, crawlers and previews in the ship.page dashboard are excluded; views count page loads of HTML pages, not raw asset requests. Free accounts (access: locked) get the last 7 days: the totals, a daily series and the top referrers, pages and countries, with only the first entry of each list named. Pro (access: pro) gets a 90-day daily series and every name; pass days to narrow the daily series and the breakdowns. total, last_24h and last_7d always cover everything retained. Pageviews are retained for 90 days.",
        "security": [{ "bearerAuth": [] }],
        "parameters": [
          { "name": "slug", "in": "path", "required": true, "schema": { "type": "string" } },
          { "name": "days", "in": "query", "required": false, "description": "Pro only. Last N days for the daily series and the breakdowns, clamped to 1..window_days. Defaults to window_days.", "schema": { "type": "integer", "minimum": 1, "maximum": 90 } }
        ],
        "responses": {
          "200": {
            "description": "Drop stats.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["slug", "access", "total", "last_24h", "last_7d", "days", "daily", "top_referrers", "top_paths", "top_countries"],
                  "properties": {
                    "slug": { "type": "string" },
                    "access": { "type": "string", "enum": ["locked", "pro"], "description": "locked on free accounts: the last 7 days, only the first entry of each list named. pro: the whole window and every name." },
                    "total": { "type": "integer", "description": "All-time views within the 90-day retention window." },
                    "last_24h": { "type": "integer", "description": "Views in the last 24 hours." },
                    "last_7d": { "type": "integer", "description": "Views in the last 7 days." },
                    "window_days": { "type": "integer", "description": "Pro only. History window of the daily series: 90." },
                    "days": { "type": "integer", "description": "Days covered by daily and the breakdowns: 7 on free accounts, else the requested days clamped to 1..window_days." },
                    "daily": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": ["day", "views"],
                        "properties": {
                          "day": { "type": "string", "description": "YYYY-MM-DD (UTC)" },
                          "views": { "type": "integer" }
                        }
                      }
                    },
                    "top_referrers": {
                      "type": "array",
                      "description": "Up to 5 entries; 'direct' means no referrer, and links between pages of the drop don't count. Free accounts only get the first label.",
                      "items": {
                        "type": "object",
                        "required": ["label", "views"],
                        "properties": { "label": { "type": "string", "description": "Empty when locked." }, "views": { "type": "integer" }, "locked": { "type": "boolean", "description": "Free accounts: a real entry whose label is withheld." } }
                      }
                    },
                    "top_paths": {
                      "type": "array",
                      "description": "Up to 5 entries. Free accounts only get the first label.",
                      "items": {
                        "type": "object",
                        "required": ["label", "views"],
                        "properties": { "label": { "type": "string", "description": "Empty when locked." }, "views": { "type": "integer" }, "locked": { "type": "boolean", "description": "Free accounts: a real entry whose label is withheld." } }
                      }
                    },
                    "top_countries": {
                      "type": "array",
                      "description": "Up to 5 entries; label is an uppercase ISO 3166-1 alpha-2 code. Views without a known country are left out. Free accounts only get the first label.",
                      "items": {
                        "type": "object",
                        "required": ["label", "views"],
                        "properties": { "label": { "type": "string", "description": "Empty when locked." }, "views": { "type": "integer" }, "locked": { "type": "boolean", "description": "Free accounts: a real entry whose label is withheld." } }
                      }
                    },
                    "referrers": { "type": "integer", "description": "Free accounts only. Distinct referrers in the window." },
                    "paths": { "type": "integer", "description": "Free accounts only. Distinct paths in the window." },
                    "countries": { "type": "integer", "description": "Free accounts only. Distinct countries in the window." }
                  }
                }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/drops/{slug}/contents": {
      "parameters": [{ "name": "slug", "in": "path", "required": true, "schema": { "type": "string" } }],
      "get": {
        "operationId": "listDropContents",
        "summary": "List a drop's files",
        "description": "Every file the drop serves, sorted by path, with its size and MIME type. Also works for expired and taken-down drops, for whatever is still stored.",
        "security": [{ "bearerAuth": [] }],
        "responses": {
          "200": { "description": "Files.", "content": { "application/json": { "schema": { "type": "object", "required": ["files", "bytes"], "properties": { "files": { "type": "array", "items": { "$ref": "#/components/schemas/DropContentFile" } }, "bytes": { "type": "integer", "description": "Total size of the files." } } } } } },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "503": { "$ref": "#/components/responses/Unavailable" }
        }
      }
    },
    "/drops/{slug}/contents/{path}": {
      "parameters": [
        { "name": "slug", "in": "path", "required": true, "schema": { "type": "string" } },
        { "name": "path", "in": "path", "required": true, "description": "File path; URL-encode each segment and keep the slashes.", "schema": { "type": "string" } }
      ],
      "get": {
        "operationId": "getDropFile",
        "summary": "Download one file of a drop",
        "description": "Returns the raw bytes as an attachment (text files as text/plain, everything else as application/octet-stream), never rendered. X-Ship-Mime carries the type the drop serves the file with.",
        "security": [{ "bearerAuth": [] }],
        "responses": {
          "200": { "description": "File bytes.", "headers": { "X-Ship-Mime": { "schema": { "type": "string" }, "description": "MIME type the drop serves this file with." } }, "content": { "application/octet-stream": { "schema": { "type": "string", "format": "binary" } }, "text/plain": { "schema": { "type": "string" } } } },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "451": { "description": "The drop was taken down (blocked).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
          "503": { "$ref": "#/components/responses/Unavailable" }
        }
      }
    },
    "/drops/{slug}/archive": {
      "parameters": [{ "name": "slug", "in": "path", "required": true, "schema": { "type": "string" } }],
      "get": {
        "operationId": "downloadDropArchive",
        "summary": "Download a drop as a zip",
        "description": "Streams every file of the drop into a zip with the same paths, ready to deploy again.",
        "security": [{ "bearerAuth": [] }],
        "responses": {
          "200": { "description": "Zip archive, sent as an attachment named after the slug.", "content": { "application/zip": { "schema": { "type": "string", "format": "binary" } } } },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "description": "Not found, or the drop has no files left (not_found).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
          "451": { "description": "The drop was taken down (blocked).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
          "503": { "$ref": "#/components/responses/Unavailable" }
        }
      }
    },
    "/drops/{slug}/versions": {
      "parameters": [{ "name": "slug", "in": "path", "required": true, "schema": { "type": "string" } }],
      "get": {
        "operationId": "listDropVersions",
        "summary": "List a drop's versions",
        "description": "The 20 most recent published versions, newest first. Empty for drops without version history; listing never opens the drop in the editor.",
        "security": [{ "bearerAuth": [] }],
        "responses": {
          "200": { "description": "Versions.", "content": { "application/json": { "schema": { "type": "object", "required": ["versions"], "properties": { "versions": { "type": "array", "items": { "$ref": "#/components/schemas/EditorRevision" } } } } } } },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "503": { "$ref": "#/components/responses/Unavailable" }
        }
      }
    },
    "/drops/{slug}/versions/{id}/restore": {
      "parameters": [{ "name": "slug", "in": "path", "required": true, "schema": { "type": "string" } }, { "name": "id", "in": "path", "required": true, "schema": { "type": "string" } }],
      "post": {
        "operationId": "restoreDropVersion",
        "summary": "Make a past version live again (Pro/Team)",
        "description": "Publishes the version's files as a new live version with source restore. The expiry and any open editor draft stay as they are. Retrying with the same idempotency_key returns the first result; when the version's files equal the live ones, the live version comes back unchanged.",
        "security": [{ "bearerAuth": [] }],
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": { "type": "object", "required": ["idempotency_key"], "properties": { "idempotency_key": { "type": "string", "format": "uuid" } } } } }
        },
        "responses": {
          "200": { "description": "The live version.", "content": { "application/json": { "schema": { "type": "object", "required": ["version", "url"], "properties": { "version": { "type": "object", "required": ["id", "number"], "properties": { "id": { "type": "string" }, "number": { "type": "integer" } } }, "url": { "type": "string", "format": "uri" } } } } } },
          "409": { "description": "already_live: this version is the live one. busy: another publish is going live, retry after Retry-After. missing: some of the version's files are no longer stored.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "402": { "$ref": "#/components/responses/PaymentRequired" },
          "404": { "description": "Not found, also for drops without version history and versions that were never live or are no longer kept.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
          "410": { "description": "The drop has expired (expired).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
          "429": { "$ref": "#/components/responses/RateLimited" },
          "451": { "description": "The drop was taken down (blocked).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
          "503": { "$ref": "#/components/responses/Unavailable" }
        }
      }
    },
    "/drops/{slug}/claim": {
      "post": {
        "operationId": "claimDrop",
        "summary": "Claim an anonymously deployed drop",
        "description": "Attaches an anonymous drop to the authenticated account using the one-time claim token (spc_...) returned at deploy time. The token keeps working while the drop is live and after it expires, no matter how long ago that was. Without a token, a signed-in account whose verified email matches the one the drop was shipped with can claim it too. A successful claim gives the drop a 30-day signed-in-free lifetime; one that already expired joins the account expired (`paused: true`) until it's restored on Pro. Re-claiming a drop you already own returns 200.",
        "security": [{ "bearerAuth": [] }],
        "parameters": [
          { "name": "slug", "in": "path", "required": true, "schema": { "type": "string" } }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "claim_token": { "type": "string", "description": "The spc_ token returned by the anonymous deploy. Leave it out to claim by the account's verified email." }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Drop claimed (or already owned by the caller).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["slug", "claimed", "url"],
                  "properties": {
                    "slug": { "type": "string" },
                    "claimed": { "type": "boolean" },
                    "restored": { "type": "boolean", "description": "True when the claim revived an expired drop." },
                    "paused": { "type": "boolean", "description": "True when the drop had already expired and joined the account offline; restoring it needs Pro." },
                    "expires_at": { "type": ["string", "null"], "format": "date-time" },
                    "url": { "type": "string", "format": "uri" }
                  }
                }
              }
            }
          },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "403": { "description": "Invalid claim token.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
          "404": { "$ref": "#/components/responses/NotFound" },
          "409": { "description": "Drop state changed during the claim.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }
        }
      }
    },
    "/drops/{slug}/restore": {
      "post": {
        "operationId": "restoreDrop",
        "summary": "Restore an expired drop you own",
        "description": "Brings back an expired owned drop, however long ago it expired, and it doesn't expire while the account is on Pro. Restoring is part of Pro: free accounts get a 402 with an upgrade_url. A 200 with `restored: false` means the drop was never expired.",
        "security": [{ "bearerAuth": [] }],
        "parameters": [
          { "name": "slug", "in": "path", "required": true, "schema": { "type": "string" } }
        ],
        "responses": {
          "200": {
            "description": "Drop restored (or was never expired).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["slug", "restored", "expires_at", "url"],
                  "properties": {
                    "slug": { "type": "string" },
                    "restored": { "type": "boolean" },
                    "expires_at": { "type": ["string", "null"], "format": "date-time" },
                    "url": { "type": "string", "format": "uri" }
                  }
                }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "402": { "$ref": "#/components/responses/PaymentRequired" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "409": { "description": "Drop state changed concurrently, retry.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }
        }
      }
    },
    "/drops/{slug}/tree": {
      "parameters": [{ "name": "slug", "in": "path", "required": true, "schema": { "type": "string" } }],
      "get": {
        "operationId": "openEditor",
        "summary": "Open a drop in the site editor (Pro/Team)",
        "description": "Owner-only; requires an active Pro/Team subscription, like every editor route. Call this first: the first call imports the drop's live files (up to 200 files and 20 MB in total) and starts its revision history. Publishing through the API afterwards still works and shows up as a revision.",
        "security": [{ "bearerAuth": [] }],
        "responses": {
          "200": { "description": "Live files, your private draft and the content_rev to publish against.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/EditorTree" } } } },
          "409": { "description": "busy: an upload is still landing, retry after `retry-after` seconds. too_large / unsupported: the drop doesn't fit the editor; keep deploying it through the API.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "402": { "$ref": "#/components/responses/PaymentRequired" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "410": { "description": "The drop has expired (expired).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
          "429": { "$ref": "#/components/responses/RateLimited" },
          "503": { "$ref": "#/components/responses/Unavailable" }
        }
      }
    },
    "/drops/{slug}/files/{path}": {
      "parameters": [
        { "name": "slug", "in": "path", "required": true, "schema": { "type": "string" } },
        { "name": "path", "in": "path", "required": true, "description": "File path; URL-encode each segment and keep the slashes.", "schema": { "type": "string" } },
        { "name": "rev", "in": "query", "required": false, "description": "live (default), draft, or a revision id.", "schema": { "type": "string" } }
      ],
      "get": {
        "operationId": "getEditorFile",
        "summary": "Download one file of the live site, the draft or a revision",
        "description": "Returns the raw bytes as an attachment (text files as text/plain, everything else as application/octet-stream), never rendered.",
        "security": [{ "bearerAuth": [] }],
        "responses": {
          "200": { "description": "File bytes.", "content": { "application/octet-stream": { "schema": { "type": "string", "format": "binary" } }, "text/plain": { "schema": { "type": "string" } } } },
          "409": { "description": "busy: open the drop with GET /drops/{slug}/tree first.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "402": { "$ref": "#/components/responses/PaymentRequired" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "410": { "description": "The drop has expired (expired).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
          "429": { "$ref": "#/components/responses/RateLimited" },
          "503": { "$ref": "#/components/responses/Unavailable" }
        }
      }
    },
    "/drops/{slug}/blobs/{sha256}": {
      "parameters": [
        { "name": "slug", "in": "path", "required": true, "schema": { "type": "string" } },
        { "name": "sha256", "in": "path", "required": true, "description": "Lowercase hex SHA-256 of the body.", "schema": { "type": "string", "pattern": "^[a-f0-9]{64}$" } }
      ],
      "put": {
        "operationId": "uploadEditorBlob",
        "summary": "Upload file contents for a draft",
        "description": "Content-addressed: upload each new or changed file's bytes once, then reference its hash from PUT /drops/{slug}/draft. Up to 10 MB per file; uploading a hash the drop already has is a no-op.",
        "security": [{ "bearerAuth": [] }],
        "requestBody": { "required": true, "content": { "application/octet-stream": { "schema": { "type": "string", "format": "binary" } } } },
        "responses": {
          "200": { "description": "Already stored.", "content": { "application/json": { "schema": { "type": "object", "properties": { "sha256": { "type": "string" }, "bytes": { "type": "integer" } } } } } },
          "201": { "description": "Stored.", "content": { "application/json": { "schema": { "type": "object", "properties": { "sha256": { "type": "string" }, "bytes": { "type": "integer" } } } } } },
          "400": { "description": "hash_mismatch: the body doesn't hash to the path's sha256.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
          "409": { "description": "busy: open the drop with GET /drops/{slug}/tree first.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
          "413": { "description": "too_large: over 10 MB.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
          "507": { "description": "storage_full: this drop's or account's editor storage is full.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "402": { "$ref": "#/components/responses/PaymentRequired" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "410": { "description": "The drop has expired (expired).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
          "429": { "$ref": "#/components/responses/RateLimited" },
          "503": { "$ref": "#/components/responses/Unavailable" }
        }
      }
    },
    "/drops/{slug}/draft": {
      "parameters": [{ "name": "slug", "in": "path", "required": true, "schema": { "type": "string" } }],
      "put": {
        "operationId": "saveEditorDraft",
        "summary": "Save the private draft",
        "description": "Replaces the whole draft file list. Compare-and-swap: send the draft_rev you last saw, or 0 to start a draft. Drafts are never served; publish to go live.",
        "security": [{ "bearerAuth": [] }],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["draft_rev", "files"],
                "properties": {
                  "draft_rev": { "type": "integer" },
                  "files": {
                    "type": "array",
                    "maxItems": 200,
                    "items": { "type": "object", "required": ["path", "sha256"], "properties": { "path": { "type": "string" }, "sha256": { "type": "string" } } }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "description": "Draft saved.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/EditorDraft" } } } },
          "400": { "description": "bad_request (bad path) or unknown_blob: upload the hashes listed in `missing`, then retry.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
          "409": { "description": "draft_changed: the draft changed elsewhere. The body's `draft` is the server copy (null when it was published or discarded).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
          "413": { "description": "too_large: over 200 files or 20 MB.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "402": { "$ref": "#/components/responses/PaymentRequired" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "410": { "description": "The drop has expired (expired).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
          "429": { "$ref": "#/components/responses/RateLimited" },
          "503": { "$ref": "#/components/responses/Unavailable" }
        }
      },
      "delete": {
        "operationId": "discardEditorDraft",
        "summary": "Discard the draft",
        "description": "Discards the draft only if nobody saved since the draft_rev you pass.",
        "security": [{ "bearerAuth": [] }],
        "parameters": [{ "name": "draft_rev", "in": "query", "required": true, "description": "The draft_rev you are discarding.", "schema": { "type": "integer", "minimum": 1 } }],
        "responses": {
          "200": { "description": "Draft discarded.", "content": { "application/json": { "schema": { "type": "object", "properties": { "draft": { "type": "null" } } } } } },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "409": { "description": "draft_changed: the draft changed elsewhere. The body's `draft` is the server copy (null when it was published or discarded).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "402": { "$ref": "#/components/responses/PaymentRequired" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "410": { "description": "The drop has expired (expired).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
          "429": { "$ref": "#/components/responses/RateLimited" },
          "503": { "$ref": "#/components/responses/Unavailable" }
        }
      }
    },
    "/drops/{slug}/publish": {
      "parameters": [{ "name": "slug", "in": "path", "required": true, "schema": { "type": "string" } }],
      "post": {
        "operationId": "publishEditorDraft",
        "summary": "Publish the draft",
        "description": "Makes the draft live at the drop's URL, or with as_new: true publishes it to a new link and keeps this drop unchanged. Safe to retry: reuse the same idempotency_key until you get a 200 or a 4xx.",
        "security": [{ "bearerAuth": [] }],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["draft_rev", "base_content_rev", "idempotency_key"],
                "properties": {
                  "draft_rev": { "type": "integer" },
                  "base_content_rev": { "type": "integer", "description": "content_rev from GET /drops/{slug}/tree." },
                  "title": { "type": ["string", "null"], "description": "Shown in the revision history; trimmed to 120 characters." },
                  "idempotency_key": { "type": "string", "format": "uuid" },
                  "as_new": { "type": "boolean", "default": false }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Published.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["slug", "url", "revision", "content_rev", "as_new"],
                  "properties": {
                    "slug": { "type": "string" },
                    "url": { "type": "string", "format": "uri" },
                    "revision": { "type": "object", "properties": { "id": { "type": "string" }, "number": { "type": "integer" } } },
                    "content_rev": { "type": "integer" },
                    "as_new": { "type": "boolean" }
                  }
                }
              }
            }
          },
          "400": { "description": "bad_request or unknown_blob: upload the hashes listed in `missing`, then retry.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
          "409": { "description": "content_changed: the site changed since the draft started (body has the new content_rev). draft_changed: the draft moved on. publish_in_progress: retry the same idempotency_key in 5 s.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
          "413": { "description": "too_large: over 200 files or 20 MB.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "402": { "$ref": "#/components/responses/PaymentRequired" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "410": { "description": "The drop has expired (expired).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
          "429": { "$ref": "#/components/responses/RateLimited" },
          "503": { "description": "publish_incomplete or backend_unavailable: retry the same idempotency_key in 5 s.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }
        }
      }
    },
    "/drops/{slug}/revisions": {
      "parameters": [{ "name": "slug", "in": "path", "required": true, "schema": { "type": "string" } }],
      "get": {
        "operationId": "listEditorRevisions",
        "summary": "List published revisions",
        "description": "The 20 most recent published revisions, newest first, from the editor or the API.",
        "security": [{ "bearerAuth": [] }],
        "responses": {
          "200": { "description": "Revisions.", "content": { "application/json": { "schema": { "type": "object", "properties": { "revisions": { "type": "array", "items": { "$ref": "#/components/schemas/EditorRevision" } } } } } } },
          "409": { "description": "busy: open the drop with GET /drops/{slug}/tree first.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "402": { "$ref": "#/components/responses/PaymentRequired" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "410": { "description": "The drop has expired (expired).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
          "429": { "$ref": "#/components/responses/RateLimited" },
          "503": { "$ref": "#/components/responses/Unavailable" }
        }
      }
    },
    "/drops/{slug}/revisions/{id}": {
      "parameters": [{ "name": "slug", "in": "path", "required": true, "schema": { "type": "string" } }, { "name": "id", "in": "path", "required": true, "schema": { "type": "string" } }],
      "get": {
        "operationId": "getEditorRevision",
        "summary": "Get one revision with its file list",
        "security": [{ "bearerAuth": [] }],
        "responses": {
          "200": {
            "description": "Revision and files.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "revision": { "$ref": "#/components/schemas/EditorRevision" },
                    "files": { "type": "array", "items": { "$ref": "#/components/schemas/EditorFile" } }
                  }
                }
              }
            }
          },
          "409": { "description": "busy: open the drop with GET /drops/{slug}/tree first.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "402": { "$ref": "#/components/responses/PaymentRequired" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "410": { "description": "The drop has expired (expired).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
          "429": { "$ref": "#/components/responses/RateLimited" },
          "503": { "$ref": "#/components/responses/Unavailable" }
        }
      }
    },
    "/drops/{slug}/revisions/{id}/restore": {
      "parameters": [{ "name": "slug", "in": "path", "required": true, "schema": { "type": "string" } }, { "name": "id", "in": "path", "required": true, "schema": { "type": "string" } }],
      "post": {
        "operationId": "restoreEditorRevision",
        "summary": "Load a revision into the draft",
        "description": "Replaces the draft with the revision's files; nothing goes live until you publish. Send the current draft_rev (0 when there is no draft).",
        "security": [{ "bearerAuth": [] }],
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": { "type": "object", "required": ["draft_rev"], "properties": { "draft_rev": { "type": "integer" } } } } }
        },
        "responses": {
          "200": { "description": "The new draft.", "content": { "application/json": { "schema": { "type": "object", "properties": { "draft": { "$ref": "#/components/schemas/EditorDraft" } } } } } },
          "409": { "description": "draft_changed: the draft changed elsewhere. The body's `draft` is the server copy (null when it was published or discarded).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "402": { "$ref": "#/components/responses/PaymentRequired" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "410": { "description": "The drop has expired (expired).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
          "429": { "$ref": "#/components/responses/RateLimited" },
          "503": { "$ref": "#/components/responses/Unavailable" }
        }
      }
    },
    "/drops/{slug}/responses": {
      "parameters": [{ "name": "slug", "in": "path", "required": true, "schema": { "type": "string" } }],
      "get": {
        "operationId": "listFormResponses",
        "summary": "List a drop's form responses",
        "description": "Owner-only. Newest first, with the drop's forms and form settings. On a free account the drop's first response reads in full and the rest come back locked; Pro and Team read everything. A page pass doesn't unlock responses.",
        "security": [{ "bearerAuth": [] }],
        "parameters": [
          { "name": "before", "in": "query", "schema": { "type": "string" }, "description": "next_before from the previous page." },
          { "name": "limit", "in": "query", "schema": { "type": "integer", "minimum": 1 }, "description": "Responses per page." },
          { "name": "form", "in": "query", "schema": { "type": "string" }, "description": "Only this form's responses, by form id (page#key, like index.html#contact)." },
          { "name": "spam", "in": "query", "schema": { "type": "string", "enum": ["1"] }, "description": "1 lists only the responses marked as spam. Without it, spam is left out." }
        ],
        "responses": {
          "200": { "description": "A page of responses.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FormResponsesPage" } } } },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "503": { "$ref": "#/components/responses/Unavailable" }
        }
      },
      "patch": {
        "operationId": "markFormResponsesRead",
        "summary": "Mark responses read",
        "description": "Owner-only. Marks every response on the drop read, or only one form's.",
        "security": [{ "bearerAuth": [] }],
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FormResponsesMarkRead" } } }
        },
        "responses": {
          "200": { "description": "How many responses were marked read.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FormResponsesUpdated" } } } },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "503": { "$ref": "#/components/responses/Unavailable" }
        }
      }
    },
    "/drops/{slug}/responses/{id}": {
      "parameters": [{ "name": "slug", "in": "path", "required": true, "schema": { "type": "string" } }, { "name": "id", "in": "path", "required": true, "schema": { "type": "string" } }],
      "patch": {
        "operationId": "updateFormResponse",
        "summary": "Mark a response read, unread or spam",
        "description": "Owner-only.",
        "security": [{ "bearerAuth": [] }],
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FormResponseUpdate" } } }
        },
        "responses": {
          "200": { "description": "The response as it is now.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FormResponse" } } } },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "503": { "$ref": "#/components/responses/Unavailable" }
        }
      },
      "delete": {
        "operationId": "deleteFormResponse",
        "summary": "Delete a response",
        "description": "Owner-only. No request body.",
        "security": [{ "bearerAuth": [] }],
        "responses": {
          "204": { "description": "Deleted." },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "503": { "$ref": "#/components/responses/Unavailable" }
        }
      }
    },
    "/drops/{slug}/responses.csv": {
      "parameters": [{ "name": "slug", "in": "path", "required": true, "schema": { "type": "string" } }],
      "get": {
        "operationId": "exportFormResponses",
        "summary": "Export a drop's form responses as CSV (Pro/Team)",
        "description": "Owner-only; requires an active Pro or Team plan. Free accounts get 402 subscription_required.",
        "security": [{ "bearerAuth": [] }],
        "responses": {
          "200": { "description": "The responses as a CSV file.", "content": { "text/csv": { "schema": { "type": "string" } } } },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "402": { "$ref": "#/components/responses/PaymentRequired" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "503": { "$ref": "#/components/responses/Unavailable" }
        }
      }
    },
    "/drops/{slug}/forms": {
      "parameters": [{ "name": "slug", "in": "path", "required": true, "schema": { "type": "string" } }],
      "put": {
        "operationId": "updateDropForms",
        "summary": "Change a drop's form settings",
        "description": "Owner-only. Turns saving, email alerts or the forms script on or off, and switches single forms on or off. The drop's files never change.",
        "security": [{ "bearerAuth": [] }],
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": { "$ref": "#/components/schemas/DropFormsUpdate" } } }
        },
        "responses": {
          "200": { "description": "The drop's forms and settings after the change.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/DropFormsState" } } } },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "503": { "$ref": "#/components/responses/Unavailable" }
        }
      }
    },
    "/drops/{slug}/forms/test": {
      "parameters": [{ "name": "slug", "in": "path", "required": true, "schema": { "type": "string" } }],
      "post": {
        "operationId": "createFormTestLink",
        "summary": "Get a test link for a drop's forms",
        "description": "Owner-only. A link to the live page for sending its forms yourself: up to 3 responses in the next 10 minutes are marked as tests, which are always readable and never counted.",
        "security": [{ "bearerAuth": [] }],
        "responses": {
          "200": { "description": "The test link.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FormTestLink" } } } },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "409": { "description": "not_saving: nothing on the drop saves responses right now (saving is off, or no form saves).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
          "503": { "$ref": "#/components/responses/Unavailable" }
        }
      }
    },
    "/keys": {
      "post": {
        "operationId": "mintKey",
        "summary": "Mint an sp_ API key",
        "description": "Requires a Firebase ID token (sign in at ship.page). The key is shown once — store it.",
        "security": [{ "bearerAuth": [] }],
        "responses": {
          "201": {
            "description": "Key minted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["accountId", "apiKey", "keyId", "note"],
                  "properties": {
                    "accountId": { "type": "string" },
                    "apiKey": { "type": "string", "description": "sp_… key, shown once." },
                    "keyId": { "type": "string", "description": "SHA-256 of the key." },
                    "note": { "type": "string" }
                  }
                }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "429": { "$ref": "#/components/responses/RateLimited" }
        }
      }
    },
    "/billing/me": {
      "get": {
        "operationId": "billingMe",
        "summary": "Plan and subscription state",
        "security": [{ "bearerAuth": [] }],
        "responses": {
          "200": {
            "description": "Entitlements for the account.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["accountId", "plan", "activeSubscription"],
                  "properties": {
                    "accountId": { "type": "string" },
                    "plan": { "type": "string", "enum": ["free", "pro", "team"] },
                    "activeSubscription": { "type": "boolean" },
                    "currentPeriodEnd": { "type": ["string", "null"], "format": "date-time" },
                    "cancelAt": { "type": ["string", "null"], "format": "date-time" },
                    "portalAvailable": { "type": "boolean" }
                  }
                }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" }
        }
      }
    },
    "/billing/checkout": {
      "post": {
        "operationId": "billingCheckout",
        "summary": "Create a Stripe checkout session",
        "security": [{ "bearerAuth": [] }],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "plan": { "type": "string", "enum": ["pro", "team"], "default": "pro" }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Redirect the user to `url`.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["url", "alreadySubscribed"],
                  "properties": {
                    "url": { "type": "string", "format": "uri" },
                    "alreadySubscribed": { "type": "boolean" }
                  }
                }
              }
            }
          },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" }
        }
      }
    },
    "/billing/portal": {
      "post": {
        "operationId": "billingPortal",
        "summary": "Create a Stripe customer portal session",
        "security": [{ "bearerAuth": [] }],
        "responses": {
          "200": {
            "description": "Redirect the user to `url`.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["url"],
                  "properties": { "url": { "type": "string", "format": "uri" } }
                }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" }
        }
      }
    },
    "/links": {
      "get": {
        "operationId": "listLinks",
        "summary": "List your custom subdomains",
        "security": [{ "bearerAuth": [] }],
        "responses": {
          "200": {
            "description": "Every link on the account, oldest first.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["links", "limit"],
                  "properties": {
                    "links": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": ["name", "url", "slug", "status", "pauses_at", "created_at"],
                        "properties": {
                          "name": { "type": "string", "example": "acme" },
                          "url": { "type": "string", "format": "uri", "example": "https://acme.ship.place/" },
                          "slug": { "type": ["string", "null"], "description": "The drop it shows; null when unpointed." },
                          "status": { "type": "string", "enum": ["live", "unpointed", "paused", "frozen"] },
                          "pauses_at": { "type": ["string", "null"], "format": "date-time", "description": "When the link pauses after the paid plan ended (in the past once paused); null while the plan is active." },
                          "created_at": { "type": "string", "format": "date-time" }
                        }
                      }
                    },
                    "limit": { "type": "integer", "description": "Names the plan holds: 5 on Pro, 25 on Team, 0 without a plan.", "example": 5 }
                  }
                }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "503": { "$ref": "#/components/responses/Unavailable" }
        }
      },
      "post": {
        "operationId": "claimLink",
        "summary": "Claim a custom subdomain (Pro plan)",
        "description": "Claims https://<name>.ship.place/ and optionally points it at a live drop you own. Names: 3-40 chars of [a-z0-9-], starting and ending with a letter or digit, no double hyphens, not an existing drop slug and not shaped like a generated one (word-word-xxxxx). Infrastructure and service words, brand names and lookalikes, and credential bait are reserved; check with GET /links/check. Up to 5 per account on Pro, 25 on Team. Requires a verified Pro or Team subscription: unverifiable billing returns 503, never a claim. Error codes: 400 invalid_link_name, link_name_reserved, invalid_request; 402 subscription_required; 404 drop_not_found; 409 link_name_taken, link_exists (already yours, use PATCH), link_limit_reached; 429 rate_limited; 503 backend_unavailable.",
        "security": [{ "bearerAuth": [] }],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["name"],
                "properties": {
                  "name": { "type": "string", "minLength": 3, "maxLength": 40, "pattern": "^[a-z0-9][a-z0-9-]{1,38}[a-z0-9]$", "example": "acme" },
                  "slug": { "type": ["string", "null"], "description": "Drop slug or drop URL to show. Omit to claim now and point later.", "example": "vivid-otter-a1b2c" }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Name claimed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["name", "slug", "url"],
                  "properties": {
                    "name": { "type": "string", "example": "acme" },
                    "slug": { "type": ["string", "null"], "description": "The drop it shows; null when unpointed.", "example": "vivid-otter-a1b2c" },
                    "url": { "type": "string", "format": "uri", "example": "https://acme.ship.place/" }
                  }
                }
              }
            }
          },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "402": { "$ref": "#/components/responses/PaymentRequired" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "409": { "$ref": "#/components/responses/Conflict" },
          "429": { "$ref": "#/components/responses/RateLimited" },
          "503": { "$ref": "#/components/responses/Unavailable" }
        }
      }
    },
    "/links/check": {
      "get": {
        "operationId": "checkLinkName",
        "summary": "Check whether a custom subdomain name is free",
        "description": "Auth optional; rate limited per IP. The name is trimmed and lowercased. When available is false, reason is invalid (breaks the format rules), reserved, taken or mine. Signed-in callers get mine for a name their account already holds (PATCH /links/{name} points it elsewhere), and a name they released is free to them while it's held back from everyone else. An invalid key checks as no key.",
        "security": [{}, { "bearerAuth": [] }],
        "parameters": [
          { "name": "name", "in": "query", "required": true, "schema": { "type": "string" }, "example": "acme" }
        ],
        "responses": {
          "200": {
            "description": "Whether the name can be claimed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["name", "available"],
                  "properties": {
                    "name": { "type": "string", "example": "acme" },
                    "available": { "type": "boolean" },
                    "reason": { "type": "string", "enum": ["invalid", "reserved", "taken", "mine"], "description": "Present when available is false." }
                  }
                }
              }
            }
          },
          "429": { "$ref": "#/components/responses/RateLimited" },
          "503": { "$ref": "#/components/responses/Unavailable" }
        }
      }
    },
    "/links/{name}": {
      "patch": {
        "operationId": "pointLink",
        "summary": "Point a custom subdomain at another drop",
        "description": "Send a drop slug or drop URL; visitors see the new drop within about 10 seconds and the drops themselves are untouched. A null slug unpoints the link: the name stays yours and serves 404. Requires an active Pro or Team plan. Error codes: 400 invalid_request; 402 subscription_required; 404 not_found (no such link on this account), drop_not_found; 409 link_frozen; 429 rate_limited; 503 backend_unavailable.",
        "security": [{ "bearerAuth": [] }],
        "parameters": [
          { "name": "name", "in": "path", "required": true, "schema": { "type": "string" }, "example": "acme" }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["slug"],
                "properties": {
                  "slug": { "type": ["string", "null"], "description": "Drop slug or drop URL to show; null unpoints.", "example": "quiet-heron-k3m9p" }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Link repointed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["name", "slug", "url"],
                  "properties": {
                    "name": { "type": "string", "example": "acme" },
                    "slug": { "type": ["string", "null"], "description": "The drop it shows; null when unpointed.", "example": "vivid-otter-a1b2c" },
                    "url": { "type": "string", "format": "uri", "example": "https://acme.ship.place/" }
                  }
                }
              }
            }
          },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "402": { "$ref": "#/components/responses/PaymentRequired" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "409": { "$ref": "#/components/responses/Conflict" },
          "429": { "$ref": "#/components/responses/RateLimited" },
          "503": { "$ref": "#/components/responses/Unavailable" }
        }
      },
      "delete": {
        "operationId": "releaseLink",
        "summary": "Release a custom subdomain",
        "description": "Frees the name; for 30 days only you can claim it again. Works without an active plan. Error codes: 404 not_found; 409 link_frozen (taken down with its page); 429 rate_limited; 503 backend_unavailable.",
        "security": [{ "bearerAuth": [] }],
        "parameters": [
          { "name": "name", "in": "path", "required": true, "schema": { "type": "string" }, "example": "acme" }
        ],
        "responses": {
          "200": {
            "description": "Name released.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["released"],
                  "properties": { "released": { "type": "string", "example": "acme" } }
                }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "409": { "$ref": "#/components/responses/Conflict" },
          "429": { "$ref": "#/components/responses/RateLimited" },
          "503": { "$ref": "#/components/responses/Unavailable" }
        }
      }
    },
    "/domains": {
      "get": {
        "operationId": "listDomains",
        "summary": "List your custom domains",
        "description": "Every domain on the account that hasn't been dismissed, newest first. `limit` is 10 with an active Team plan, else 0; `bareDomains` says whether bare domains (example.com) can be added right now. Works without Team, so a lapsed account can still see and remove its domains. Error codes: 403 domain_forbidden (custom domains aren't open to this account and it holds none); 503 domains_unavailable, backend_unavailable.",
        "security": [{ "bearerAuth": [] }],
        "responses": {
          "200": {
            "description": "The account's domains.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["domains", "limit", "bareDomains"],
                  "properties": {
                    "domains": { "type": "array", "items": { "$ref": "#/components/schemas/CustomDomain" } },
                    "limit": { "type": "integer", "example": 10 },
                    "bareDomains": { "type": "boolean" }
                  }
                }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "403": { "$ref": "#/components/responses/Forbidden" },
          "503": { "$ref": "#/components/responses/Unavailable" }
        }
      },
      "post": {
        "operationId": "addDomain",
        "summary": "Add a custom domain (Team plan)",
        "description": "Connects a domain you own to a live drop on your account. A subdomain (docs.example.com) needs one CNAME record. A registered domain lives on www with a CNAME, and its bare name gets A and AAAA records; the name you typed is the main address and the other redirects to it. The response lists the exact records. The domain goes live once DNS proves the CNAME and the certificate is issued: poll POST /domains/{id}/check. Up to 10 per account, and any number can show the same drop. Adding a domain you already have returns it with 200. Error codes: 400 invalid_request; 402 subscription_required; 403 domain_forbidden; 404 not_found (no live drop with that slug on this account); 409 domain_limit; 422 domain_invalid; 429 rate_limited; 503 domains_unavailable, backend_unavailable.",
        "security": [{ "bearerAuth": [] }],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["domain", "slug"],
                "properties": {
                  "domain": { "type": "string", "maxLength": 300, "example": "docs.example.com" },
                  "slug": { "type": "string", "description": "Drop slug or drop URL to show.", "example": "vivid-otter-a1b2c" }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "$ref": "#/components/responses/Domain" },
          "201": { "$ref": "#/components/responses/Domain" },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "402": { "$ref": "#/components/responses/PaymentRequired" },
          "403": { "$ref": "#/components/responses/Forbidden" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "409": { "$ref": "#/components/responses/Conflict" },
          "422": { "$ref": "#/components/responses/Unprocessable" },
          "429": { "$ref": "#/components/responses/RateLimited" },
          "503": { "$ref": "#/components/responses/Unavailable" }
        }
      }
    },
    "/domains/{id}/check": {
      "post": {
        "operationId": "checkDomain",
        "summary": "Check a custom domain's DNS and certificate now",
        "description": "Looks up DNS and the certificate right away instead of waiting for the next background check, and returns the domain as it stands. Cloudflare is asked at most once per 10 seconds per domain. Error codes: 404 not_found; 429 rate_limited; 503 domains_unavailable, backend_unavailable.",
        "security": [{ "bearerAuth": [] }],
        "parameters": [{ "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }],
        "responses": {
          "200": { "$ref": "#/components/responses/Domain" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "429": { "$ref": "#/components/responses/RateLimited" },
          "503": { "$ref": "#/components/responses/Unavailable" }
        }
      }
    },
    "/domains/{id}": {
      "patch": {
        "operationId": "pointDomain",
        "summary": "Point a custom domain at another drop",
        "description": "Visitors see the new drop within about 10 seconds; the drops themselves are untouched. Requires an active Team plan. Error codes: 400 invalid_request; 402 subscription_required; 404 not_found (no such domain, or no live drop with that slug on this account); 409 domain_frozen; 429 rate_limited; 503 domains_unavailable, backend_unavailable.",
        "security": [{ "bearerAuth": [] }],
        "parameters": [{ "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["slug"],
                "properties": { "slug": { "type": "string", "description": "Drop slug or drop URL to show.", "example": "quiet-heron-k3m9p" } }
              }
            }
          }
        },
        "responses": {
          "200": { "$ref": "#/components/responses/Domain" },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "402": { "$ref": "#/components/responses/PaymentRequired" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "409": { "$ref": "#/components/responses/Conflict" },
          "429": { "$ref": "#/components/responses/RateLimited" },
          "503": { "$ref": "#/components/responses/Unavailable" }
        }
      },
      "delete": {
        "operationId": "removeDomain",
        "summary": "Remove a custom domain",
        "description": "Disconnects the domain and takes it off the list; an ended domain is just dismissed. Works without an active Team plan. Error codes: 404 not_found; 409 domain_frozen (taken down with its page); 429 rate_limited; 503 domains_unavailable, backend_unavailable.",
        "security": [{ "bearerAuth": [] }],
        "parameters": [{ "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }],
        "responses": {
          "204": { "description": "Domain removed." },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "409": { "$ref": "#/components/responses/Conflict" },
          "429": { "$ref": "#/components/responses/RateLimited" },
          "503": { "$ref": "#/components/responses/Unavailable" }
        }
      }
    },
    "/mcp": {
      "post": {
        "operationId": "mcp",
        "summary": "MCP server (JSON-RPC 2.0, stateless)",
        "description": "Streamable-HTTP-free, stateless MCP endpoint (spec 2026-07-28). Methods: `server/discover`, `tools/list`, `tools/call`, plus legacy `initialize`. Tools: `deploy_html`, `deploy_files`, `append_files`, `list_drops`, `claim_drop`, `restore_drop`, `delete_drop`, `set_drop_password`, `remove_drop_password`, `get_limits`, `get_account`. Auth is optional pass-through: send `Authorization: Bearer sp_…` to act as an account, omit for anonymous deploys. deploy_html and deploy_files accept an optional password string for active paid Pro/Team accounts; it is sent as the encoded X-Ship-Password header, never a query parameter. set_drop_password takes slug + password; remove_drop_password takes slug and works even after a plan lapses. Client config: `\"ship.page\": { \"url\": \"https://ship.page/mcp\" }`.",
        "security": [{}, { "bearerAuth": [] }],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["jsonrpc", "method", "id"],
                "properties": {
                  "jsonrpc": { "type": "string", "const": "2.0" },
                  "id": { "oneOf": [{ "type": "string" }, { "type": "integer" }] },
                  "method": { "type": "string", "enum": ["initialize", "server/discover", "tools/list", "tools/call"] },
                  "params": { "type": "object" }
                }
              },
              "example": {
                "jsonrpc": "2.0",
                "id": 1,
                "method": "tools/call",
                "params": { "name": "deploy_html", "arguments": { "html": "<h1>hello</h1>" } }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON-RPC 2.0 response envelope (`result` or `error`).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["jsonrpc", "id"],
                  "properties": {
                    "jsonrpc": { "type": "string", "const": "2.0" },
                    "id": { "oneOf": [{ "type": "string" }, { "type": "integer" }, { "type": "null" }] },
                    "result": {},
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": { "type": "integer" },
                        "message": { "type": "string" },
                        "data": {}
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
