{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/squirrelscan-com/json-schema/squirrelscan-com-organization-detail-schema.json",
  "title": "OrganizationDetail",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/squirrelscan-com-openapi.json#/components/schemas/OrganizationDetail",
  "type": "object",
  "required": [
    "organization",
    "plan",
    "role"
  ],
  "properties": {
    "organization": {
      "type": "object",
      "required": [
        "id",
        "name",
        "slug",
        "planId"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "slug": {
          "type": "string"
        },
        "planId": {
          "type": "string"
        },
        "createdAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "updatedAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        }
      },
      "additionalProperties": true
    },
    "members": {
      "type": "array",
      "description": "Members of the organization. Returned only to a signed-in caller who is a member (others get 404). Omitted for API keys: a key acts for the organization, not as one of its people, and can outlive the member who made it.",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "userId": {
            "type": "string"
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "admin",
              "editor",
              "viewer",
              "billing"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "userName": {
            "type": [
              "string",
              "null"
            ]
          },
          "userEmail": {
            "type": [
              "string",
              "null"
            ],
            "format": "email",
            "description": "PII — a fellow member's email address. Intentionally exposed so org members can see their teammates (the dashboard team view renders it); access is gated by the membership check above. Treat as sensitive: do not log, cache publicly, or surface outside an authenticated org-member context."
          },
          "userAvatarUrl": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      }
    },
    "plan": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "maxMembers": {
          "type": "integer"
        },
        "monthlyCredits": {
          "type": "integer"
        },
        "signupGrantCredits": {
          "type": "integer"
        }
      }
    },
    "role": {
      "type": "string",
      "enum": [
        "owner",
        "admin",
        "editor",
        "viewer",
        "billing"
      ],
      "description": "The caller's role in the organization. An API key reports admin; what it may do is set by its scopes."
    }
  }
}