{
  "openapi": "3.1.0",
  "info": {
    "title": "Curtain API",
    "version": "1.0.0",
    "summary": "Seal URLs into private curtain:// links and issue anonymous Agent Ghost plug keys.",
    "x-status": "planned",
    "description": "PLANNED / PREVIEW — these endpoints are in development and not yet callable. Embedding Agent Ghost is free and anonymous for developers; end users pay Curtain directly per use. Plug keys are publishable (safe in client code). See https://curtainbrowser.com/llms-full.txt for the full integration guide.",
    "contact": { "name": "Curtain", "url": "https://curtainbrowser.com" }
  },
  "servers": [{ "url": "https://api.curtainbrowser.com", "description": "Production" }],
  "paths": {
    "/v1/plugs": {
      "post": {
        "operationId": "createPlug",
        "summary": "Create an anonymous, publishable Agent Ghost plug key",
        "description": "No auth, no signup. Returns a publishable plug key and a ready-to-paste embed snippet. Anonymous keys cannot be recovered — store them.",
        "security": [],
        "responses": {
          "200": {
            "description": "Plug created",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Plug" }, "example": { "plug": "plug_live_9f2b7c", "embed": "<script src=\"https://cdn.curtainbrowser.com/agent.js\" data-plug=\"plug_live_9f2b7c\"></script>" } } }
          }
        }
      }
    },
    "/v1/seal": {
      "post": {
        "operationId": "sealUrl",
        "summary": "Seal a URL into a private curtain:// token",
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SealRequest" }, "example": { "url": "https://your-app.com/data", "expiresIn": "24h" } } }
        },
        "responses": {
          "200": { "description": "Sealed", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SealResponse" }, "example": { "sealedLink": "curtain://sealed/a1b2c3d4e5f6", "id": "ct_9f2b7c", "expiresAt": "2024-12-31T23:59:59Z" } } } }
        }
      }
    },
    "/v1/status/{id}": {
      "get": {
        "operationId": "getStatus",
        "summary": "Get the status of a sealed link",
        "parameters": [{ "name": "id", "in": "path", "required": true, "schema": { "type": "string" } }],
        "responses": {
          "200": { "description": "Status", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Status" }, "example": { "id": "ct_9f2b7c", "active": true, "opens": 12, "expiresAt": "2024-12-31T23:59:59Z" } } } }
        }
      }
    },
    "/v1/revoke/{id}": {
      "delete": {
        "operationId": "revokeLink",
        "summary": "Permanently revoke a sealed link",
        "parameters": [{ "name": "id", "in": "path", "required": true, "schema": { "type": "string" } }],
        "responses": {
          "200": { "description": "Revoked", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "revoked": { "type": "boolean" } } }, "example": { "id": "ct_9f2b7c", "revoked": true } } } }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "plugKey": { "type": "apiKey", "in": "header", "name": "X-Curtain-Plug", "description": "Publishable plug key (plug_live_...). Safe in client code." }
    },
    "schemas": {
      "Plug": { "type": "object", "properties": { "plug": { "type": "string", "example": "plug_live_9f2b7c" }, "embed": { "type": "string" } }, "required": ["plug", "embed"] },
      "SealRequest": { "type": "object", "required": ["url"], "properties": { "url": { "type": "string", "format": "uri" }, "expiresIn": { "type": "string", "description": "e.g. 24h, 7d" }, "passphrase": { "type": "string" } } },
      "SealResponse": { "type": "object", "properties": { "sealedLink": { "type": "string" }, "id": { "type": "string" }, "expiresAt": { "type": "string", "format": "date-time" } }, "required": ["sealedLink", "id"] },
      "Status": { "type": "object", "properties": { "id": { "type": "string" }, "active": { "type": "boolean" }, "opens": { "type": "integer" }, "expiresAt": { "type": "string", "format": "date-time" } } }
    }
  }
}
