{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/elaichi-ai/json-schema/elaichi-ai-member-schema.json",
  "title": "Member",
  "description": "One organization membership, enriched with the global user profile.",
  "x-generated": "2026-11-06",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/elaichi-ai-openapi.json#/components/schemas/Member",
  "type": "object",
  "properties": {
    "user_id": {
      "type": "string",
      "description": "User id (`usr_…`). A membership has no id of its own."
    },
    "status": {
      "type": "string",
      "description": "Only `active` members can act in the organization."
    },
    "via": {
      "type": [
        "string",
        "null"
      ],
      "description": "How they joined — invite, verified domain, SCIM, and so on."
    },
    "joined_at": {
      "type": "string",
      "format": "date-time"
    },
    "roles": {
      "type": "array",
      "description": "Roles held. Replace the whole set with `PATCH /member/{userId}`.",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Role id (`role_…`)."
          },
          "name": {
            "type": "string"
          },
          "is_system": {
            "type": "boolean"
          },
          "seat_class": {
            "type": "string",
            "enum": [
              "billable",
              "free_admin"
            ]
          }
        }
      }
    },
    "teams": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Team id (`team_…`)."
          },
          "name": {
            "type": "string"
          }
        }
      }
    },
    "user": {
      "type": [
        "object",
        "null"
      ],
      "description": "Global profile. Null when the profile row could not be resolved.",
      "properties": {
        "id": {
          "type": "string"
        },
        "email": {
          "type": "string",
          "format": "email"
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        },
        "avatar_url": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    }
  }
}