{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/commsharbor/json-schema/commsharbor-identity-schema.json",
  "title": "Identity",
  "description": "Who the current credential resolves to. Read this before a write when you are not sure which organization is active.",
  "x-generated": "2026-11-09",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/commsharbor-context-api-openapi.yml#/components/schemas/Identity",
  "type": "object",
  "properties": {
    "kind": {
      "type": "string",
      "description": "How the identity was resolved."
    },
    "organizationId": {
      "type": "string",
      "description": "The active organization."
    },
    "userId": {
      "type": "string",
      "description": "The person, when a session is in play."
    },
    "email": {
      "type": "string",
      "description": "The person's e-mail, on a session."
    },
    "sessionId": {
      "type": "string",
      "description": "Session identifier, on a session."
    },
    "role": {
      "type": "string",
      "description": "Role inside that organization; sessions only."
    },
    "organization": {
      "type": "object",
      "description": "`{ id, name, slug }` of the active organization; sessions only."
    },
    "apiKeyId": {
      "type": "string",
      "description": "Which key answered, on an API key."
    },
    "scopes": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Granted scopes; present on an API key, which carries its own narrower set."
    }
  },
  "required": [
    "kind",
    "organizationId"
  ]
}