{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/leanscale-team/json-schema/leanscale-team-access-response-schema.json",
  "title": "AccessResponse",
  "x-generated": "2026-11-15",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/leanscale-team-openapi.yml#/components/schemas/AccessResponse",
  "type": "object",
  "required": [
    "ok",
    "key"
  ],
  "properties": {
    "ok": {
      "type": "boolean",
      "const": true
    },
    "key": {
      "type": "string",
      "pattern": "^ls_pk_[A-Za-z0-9]+$",
      "description": "The access key. Send as a bearer token to /mcp."
    },
    "tier": {
      "type": "string",
      "enum": [
        "public",
        "internal"
      ],
      "description": "What the key can reach."
    },
    "returning": {
      "type": "boolean",
      "description": "Present and true when this email already had a key."
    },
    "stats": {
      "$ref": "#/$defs/CorpusStats"
    }
  },
  "$defs": {
    "CorpusStats": {
      "type": "object",
      "description": "Live corpus counts. Distinct parents on the public tier.",
      "properties": {
        "documents": {
          "type": "integer",
          "description": "Searchable passages."
        },
        "characters": {
          "type": "integer"
        },
        "playbooks": {
          "type": "integer"
        },
        "studies": {
          "type": "integer"
        },
        "caseStudies": {
          "type": "integer"
        },
        "episodes": {
          "type": "integer"
        },
        "docs": {
          "type": "integer"
        }
      }
    }
  }
}