{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/elaichi-ai/json-schema/elaichi-ai-role-schema.json",
  "title": "Role",
  "x-generated": "2026-11-06",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/elaichi-ai-openapi.json#/components/schemas/Role",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Role id (`role_…`)."
    },
    "name": {
      "type": "string"
    },
    "description": {
      "type": [
        "string",
        "null"
      ]
    },
    "is_system": {
      "type": "boolean",
      "description": "Predefined roles ship with every organization and cannot be edited away."
    },
    "seat_class": {
      "type": "string",
      "enum": [
        "billable",
        "free_admin"
      ],
      "description": "Whether members holding only this role count toward billable seats."
    },
    "permissions": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Every permission the role holds, including any `GET /permission` does not list for this organization (for example the Apps permissions while Apps are unavailable). `PATCH /role/{id}` replaces this list wholesale, so send back the entries you did not mean to remove."
    },
    "permission_count": {
      "type": "integer",
      "description": "How many of `permissions` `GET /permission` lists for this organization: the number to show beside the role. Can be lower than `permissions.length`."
    },
    "member_count": {
      "type": "integer",
      "description": "How many members hold this role right now. `GET /member?role_id={id}` lists them; while it is above zero, `DELETE /role/{id}` needs `reassign_to` (or, on `POST /role/{id}/delete`, `reassign_to` and/or a `reassignments` entry for every holder)."
    },
    "pending_invite_count": {
      "type": "integer",
      "description": "Pending invites issued for this role. Present only on roles you can manage. While above zero, `DELETE /role/{id}` and `POST /role/{id}/delete` need `reassign_to`, which re-points them."
    },
    "group_mapping_count": {
      "type": "integer",
      "description": "SCIM group mappings that assign this role. Present only on roles you can manage. While above zero, `DELETE /role/{id}` is refused (`409 role_mapped`) until the mappings change."
    },
    "can_reassign_holders": {
      "type": "boolean",
      "description": "Whether you may move this role's holders and pending invites to another role (`DELETE /role/{id}?reassign_to=` or `POST /role/{id}/delete`): you hold `member:manage` and do not hold this role yourself."
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}