{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/xfa-tech/json-schema/xfa-tech-organization-response-schema.json",
  "title": "OrganizationResponse",
  "x-generated": "2026-11-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/xfa-tech-openapi.yml#/components/schemas/OrganizationResponse",
  "type": "object",
  "properties": {
    "awareness_schedule": {
      "$ref": "#/$defs/AwarenessSchedule"
    },
    "organization_id": {
      "type": "string",
      "description": "ID of Organization"
    },
    "name": {
      "type": "string",
      "description": "Name of Organization"
    },
    "address": {
      "type": "string",
      "description": "Address of Organization"
    },
    "zip_code": {
      "type": "string",
      "description": "Zip Code of Organization"
    },
    "city": {
      "type": "string",
      "description": "City of Organization"
    },
    "country": {
      "type": "string",
      "description": "Country of Organization"
    },
    "vat": {
      "type": "string",
      "description": "VAT of Organization"
    },
    "tax_number": {
      "type": "string",
      "description": "Tax Number of Organization"
    },
    "phone_number": {
      "type": "string",
      "description": "Phone Number of Organization"
    },
    "billing_email": {
      "type": "string",
      "description": "Billing Email of Organization"
    },
    "billing_name": {
      "type": "string",
      "description": "Billing Name of Organization"
    },
    "billing_first_name": {
      "type": "string",
      "description": "Billing First Name of Organization"
    },
    "billing_last_name": {
      "type": "string",
      "description": "Billing Last Name of Organization"
    },
    "deleted": {
      "type": "boolean",
      "description": "Whether the organization is deleted"
    },
    "deleted_at": {
      "type": "string",
      "format": "date-time",
      "description": "UTC time of the delete. Absent when not deleted, and for organizations deleted before this field existed."
    },
    "logo_url": {
      "type": "string",
      "description": "URL of the logo"
    },
    "notify_no_managed_devices": {
      "type": "boolean",
      "description": "Notify no managed devices"
    },
    "notify_no_desktop_devices": {
      "type": "boolean",
      "description": "Notify no desktop devices"
    },
    "notify_no_mobile_devices": {
      "type": "boolean",
      "description": "Notify no mobile devices"
    },
    "notify_discovered_devices": {
      "type": "boolean",
      "description": "Notify discovered devices"
    },
    "notify_discovered_devices_frequency_in_days": {
      "type": "integer",
      "description": "Frequency of notification for discovered devices"
    },
    "invite_discovered_devices": {
      "type": "boolean",
      "description": "Invite discovered devices"
    },
    "default_language": {
      "$ref": "#/$defs/Language"
    },
    "self_invite_enabled": {
      "type": "boolean",
      "description": "Allow verified native app users to request self-invite when eligible"
    },
    "my_account_disabled": {
      "type": "boolean",
      "description": "End-user self-service (My account) is read-only: users can still sign in to My account and see their sign-in methods and devices, but cannot change them. False (the default) means self-service is on. Organization administrators change it."
    },
    "require_verified_domains": {
      "type": "boolean",
      "description": "Only domains with proven ownership admit IdP sign-in, onboarding and import. False (the default) means every domain counts. The list carries the switch only; the domains and verified_domains arrays are on GET /organizations/{organizationId}/full."
    },
    "last_active_at": {
      "type": "string",
      "format": "date-time",
      "readOnly": true,
      "description": "When (RFC 3339, UTC) any administrator of this organization last used the dashboard; XFA system administrators do not count. Set by organizations-service; absent until the first visit (XFA-3989)."
    },
    "last_active_by": {
      "type": "string",
      "readOnly": true,
      "description": "The email of the administrator whose visit set last_active_at, written together with it by organizations-service. Never XFA staff. Absent until the first visit, and for times recorded before this field existed (XFA-3989)."
    },
    "notify_unsafe_devices": {
      "type": "boolean",
      "description": "Notify unsafe devices"
    },
    "notify_unsafe_devices_frequency_in_days": {
      "type": "integer",
      "description": "Frequency of notification for unsafe devices"
    },
    "slack_enabled": {
      "type": "boolean",
      "description": "Enable Slack DMs for device risk notifications"
    },
    "slack_notify_unsafe_devices": {
      "type": "boolean",
      "description": "Send Slack DMs to users about unsafe devices"
    },
    "slack_notify_discovered_devices": {
      "type": "boolean",
      "description": "Send Slack DMs to users about discovered devices"
    },
    "slack_invite_discovered_devices": {
      "type": "boolean",
      "description": "Send invitation Slack DMs to users with discovered devices"
    },
    "manual_invite_send_slack": {
      "type": "boolean",
      "description": "Last-used Slack toggle state in the manual Invite users popup."
    },
    "teams_notify_unsafe_devices": {
      "type": "boolean",
      "description": "Send Teams DMs to users about unsafe devices"
    },
    "teams_notify_discovered_devices": {
      "type": "boolean",
      "description": "Send Teams DMs to users about discovered devices"
    },
    "teams_invite_discovered_devices": {
      "type": "boolean",
      "description": "Send invitation Teams DMs to users with discovered devices"
    },
    "manual_invite_send_teams": {
      "type": "boolean",
      "description": "Last-used Microsoft Teams toggle state in the manual Invite users popup."
    },
    "notify_breach_people": {
      "type": "boolean",
      "description": "Breach alerts: email each address at a monitored domain that turns up in a breach HIBP added after the domain was verified. Absent means off; off by default for every organization."
    },
    "notify_only_groups": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "id": {
            "type": "string"
          }
        }
      }
    },
    "default_policy_id": {
      "type": "string",
      "description": "Default Policy ID of Organization"
    },
    "use_user_agent_and_client_hints": {
      "type": "boolean",
      "description": "Use user-agent and client hints from browser to complete checks"
    },
    "use_discovery_data": {
      "type": "boolean",
      "description": "Use Discovery data to complete checks"
    },
    "google_chrome_device_trust": {
      "type": "boolean",
      "description": "Google Chrome device trust"
    },
    "microsoft_edge_device_trust": {
      "type": "object",
      "properties": {
        "tenant_id": {
          "type": "string",
          "description": "Tenant ID for device trust"
        },
        "client_id": {
          "type": "string",
          "description": "Client ID for device trust"
        }
      }
    },
    "feature_flags": {
      "type": "array",
      "description": "Feature flags enabled for this organization",
      "items": {
        "$ref": "#/$defs/FeatureFlag"
      }
    },
    "getting_started_state": {
      "type": "string",
      "description": "JSON blob owned by the dashboard's Getting Started journey; opaque to the backend."
    },
    "referred_by": {
      "type": "string",
      "description": "Email of the dashboard user whose referral code this organization signed up with, if any."
    },
    "timestamp": {
      "type": "string",
      "format": "date-time",
      "description": "Created timestamp of the organization"
    },
    "active_users": {
      "$ref": "#/$defs/ActiveUsers"
    },
    "invoice": {
      "$ref": "#/$defs/Invoice"
    },
    "settings": {
      "$ref": "#/$defs/Settings"
    }
  },
  "required": [
    "organization_id",
    "name",
    "address",
    "zip_code",
    "city",
    "country",
    "vat",
    "tax_number",
    "phone_number",
    "billing_email",
    "timestamp"
  ],
  "$defs": {
    "ActiveUsers": {
      "type": "object",
      "properties": {
        "current_insight": {
          "type": "integer",
          "description": "Current insight users count"
        },
        "last_insight": {
          "type": "integer",
          "description": "Last insight users count"
        },
        "current_connect": {
          "type": "integer",
          "description": "Current connect users count"
        },
        "last_connect": {
          "type": "integer",
          "description": "Last connect users count"
        },
        "current_user_count": {
          "type": "integer",
          "description": "Current total users count"
        },
        "last_user_count": {
          "type": "integer",
          "description": "Last total users count"
        },
        "current_verifications": {
          "type": "integer",
          "deprecated": true,
          "description": "Enforcement verifications this month: warned + blocked + secure sign-ins + snoozed. Use verification_periods.calendar_month.current.verifications."
        },
        "last_verifications": {
          "type": "integer",
          "deprecated": true,
          "description": "Enforcement verifications last month. Use verification_periods.calendar_month.previous.verifications."
        },
        "current_granted": {
          "type": "integer",
          "description": "Sign-ins an administrator manually granted this month. Not counted as verifications."
        },
        "last_granted": {
          "type": "integer",
          "description": "Sign-ins an administrator manually granted last month"
        },
        "lifetime_verifications": {
          "type": "integer",
          "description": "Enforcement verifications since counting started (2025-01-28; secure sign-ins only since 2026-01-26), so a floor"
        },
        "year_verifications": {
          "type": "integer",
          "description": "Enforcement verifications since 1 January of the current year (UTC)"
        },
        "last_7_days_verifications": {
          "type": "integer",
          "deprecated": true,
          "description": "Enforcement verifications over the 7 full days before today (UTC). Use verification_periods.rolling_7_days.current.verifications."
        },
        "verification_periods": {
          "$ref": "#/$defs/VerificationPeriods"
        },
        "discovery_connections": {
          "type": "integer",
          "description": "Discovery connections of the organization. Absent when unknown, which is not the same as 0."
        },
        "enforcement_connections": {
          "type": "integer",
          "description": "Enforcement connections of the organization. Absent when unknown, which is not the same as 0."
        },
        "enforcement_connections_changed_at": {
          "type": "string",
          "format": "date-time",
          "description": "When the organization's set of sign-in checks (enforcement connections) last changed (count, types or which connections, deletions included), in UTC. Absent when unknown."
        },
        "discovery_connections_changed_at": {
          "type": "string",
          "format": "date-time",
          "description": "When the organization's set of Discovery connections last changed (count, types or which connections, deletions included), in UTC. Absent when unknown."
        },
        "discovery_connection_types": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Distinct types of the Discovery connections, sorted: the application type (Google, Microsoft, OktaDiscovery). Absent when unknown; empty when there are none."
        },
        "enforcement_connection_types": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Distinct types of the enforcement connections, sorted: the application type (for example MicrosoftEAM, Okta, Onelogin, PingIdentity, Keycloak, IdP), or for an untyped application onePassword (an OpenID Connect application that allows 1Password's onepassword:// redirect URI), oidc, samlApplication or custom. Absent when unknown; empty when there are none."
        },
        "discovery_connection_types_with_errors": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Distinct types of the Discovery connections with at least one connection in error (a non-empty last sync error), sorted: a subset of discovery_connection_types. Absent when unknown, as for discovery_connection_types and also when the snapshot predates it; empty when none is in error."
        }
      }
    },
    "AwarenessAutomationSchedule": {
      "type": "object",
      "required": [
        "next_run_at"
      ],
      "properties": {
        "next_run_at": {
          "type": "string",
          "format": "date-time",
          "description": "Next scheduled Awareness evaluation, in UTC; actual delivery is conditional."
        }
      }
    },
    "AwarenessSchedule": {
      "type": "object",
      "readOnly": true,
      "description": "Next nominal hourly Awareness evaluation in production (minute 30, UTC), not a guaranteed delivery time. Recipient cooldowns, scope, billing and channel availability are checked at execution. Absent outside production or when all automations are disabled. Reload to refresh expired times. Risk alerts currently require notify_unsafe_devices, including Slack/Teams.",
      "properties": {
        "auto_invite": {
          "$ref": "#/$defs/AwarenessAutomationSchedule"
        },
        "setup_reminder": {
          "$ref": "#/$defs/AwarenessAutomationSchedule"
        },
        "risk_alert": {
          "$ref": "#/$defs/AwarenessAutomationSchedule"
        }
      }
    },
    "FeatureFlag": {
      "type": "string",
      "description": "An organization feature flag. Values are validated by xfa-organizations-service (`FeatureFlag.IsValid()`), which is the single source of truth; this contract is intentionally left open so that adding a new flag does not require an xfa-api change. Currently known values: phishing_lab, runaway_ai, edr-detection, safe_browsing, slack, teams, self_invite, mem_export, unattended_remote_access, aikido_enabled, application_checks_enabled, idp, play_protect, mdm_enrollment, passkeys, admin_mfa_approval."
    },
    "Invoice": {
      "type": "object",
      "properties": {
        "number": {
          "type": "string",
          "description": "Invoice number"
        },
        "date": {
          "type": "string",
          "format": "date",
          "description": "Invoice date"
        },
        "amount": {
          "type": "number",
          "format": "float",
          "description": "Invoice amount"
        }
      }
    },
    "Language": {
      "type": "string",
      "description": "Language for end-user emails when the recipient has not picked one; a user's own choice always wins. The set mirrors the email templates shipped by xfa-notification-service. An empty string is the canonical way to clear the organization default, on both PUT and PATCH, so the whole organization can be saved in one request; xfa-organizations-service stores it as an absent attribute.",
      "enum": [
        "",
        "en",
        "nl",
        "fr",
        "de",
        "es"
      ]
    },
    "Settings": {
      "type": "object",
      "properties": {
        "organization_id": {
          "type": "string",
          "description": "ID of the organization"
        },
        "insight_price": {
          "type": "number",
          "format": "float",
          "description": "Price for insight"
        },
        "connect_price": {
          "type": "number",
          "format": "float",
          "description": "Price for connect"
        },
        "free_devices": {
          "type": "integer",
          "description": "Number of free devices"
        },
        "trial_end_date": {
          "type": "string",
          "format": "date",
          "description": "End date of the trial period"
        },
        "per_user_price": {
          "type": "number",
          "format": "float",
          "description": "Price per user"
        },
        "blocked_access": {
          "type": "boolean",
          "description": "Whether access is blocked"
        },
        "TerminatedAt": {
          "type": "string",
          "format": "date-time",
          "readOnly": true,
          "description": "When (RFC 3339) the subscription was ended at once because the organization was deleted (XFA-4137). Server-managed; absent unless terminated."
        },
        "TerminatedReason": {
          "type": "string",
          "readOnly": true,
          "description": "Why the subscription was terminated (XFA-4137). Server-managed; absent unless terminated."
        }
      }
    },
    "VerificationPeriod": {
      "type": "object",
      "description": "One period's verifications and, where counted, its users. Both user counts are absent on 7-day periods, which do not count users, and on a previous period until it is known: statistics reads those back from the snapshot it stored then, so they appear from 30 days after its deploy. A 0 is a real 0.",
      "required": [
        "verifications"
      ],
      "properties": {
        "verifications": {
          "type": "integer",
          "description": "Enforcement verifications in the period: warned + blocked + secure sign-ins + snoozed. Manual grants are not verifications."
        },
        "users_with_verified_devices": {
          "type": "integer",
          "description": "Users whose XFA app checked in (not skipped) during the same period."
        },
        "users_in_scope": {
          "type": "integer",
          "description": "Users in scope: the people who should be verifying with XFA in the period. The unique users who verified a device or skipped enforcement in the period, or were invited in the 30 days up to the period's end. Discovered accounts nobody invited in those 30 days are not in scope. Users whose only devices are unsupported are in scope only through an invitation. The divisor for verifications per user."
        },
        "active_users": {
          "type": "integer",
          "description": "Every user active in the period, for verifications against all users: how far the rollout is. Absent on 7-day periods, and when statistics could not count the period (unknown, not 0)."
        },
        "active_devices": {
          "type": "integer",
          "description": "Every device active in the period. Absent on 7-day periods, and when statistics could not count the period (unknown, not 0)."
        },
        "verified_devices": {
          "type": "integer",
          "description": "Devices of the organization's default policy with a verified check-in in the period. Only on the rolling 30 days; on the previous 30 days absent until known (statistics reads it back from the snapshot stored then)."
        },
        "unverified_devices": {
          "type": "integer",
          "description": "Devices of the default policy seen unverified in the period. Only on the rolling 30 days; on the previous 30 days absent until known."
        },
        "compliant_devices": {
          "type": "integer",
          "description": "Devices seen in the period that comply with the default policy. Only on the rolling 30 days; on the previous 30 days absent until known."
        },
        "incompliant_devices": {
          "type": "integer",
          "description": "Devices seen in the period that do not comply with the default policy. Only on the rolling 30 days; on the previous 30 days absent until known."
        }
      }
    },
    "VerificationPeriodPair": {
      "type": "object",
      "description": "A period and the one of the same length right before it.",
      "required": [
        "current",
        "previous"
      ],
      "properties": {
        "current": {
          "$ref": "#/$defs/VerificationPeriod"
        },
        "previous": {
          "$ref": "#/$defs/VerificationPeriod"
        }
      }
    },
    "VerificationPeriods": {
      "type": "object",
      "description": "Verifications and users per period, each next to the period of the same\nlength right before it. Rolling\nverifications cover full UTC days before today; rolling user counts run from\nmidnight UTC 30 days ago until now, today included (the statistics service\nkeeps only each device's latest check-in), so per user divides 30 days of\nverifications by up to 31 days of users. Absent when the\norganization has no shadow snapshot, when the snapshot predates these\ncounts, or when counting its users failed: a missing figure is never sent\nas 0.\n\n- calendar_month: this calendar month so far (UTC) and last month.\n- rolling_30_days: the 30 full days before today and the 30 before those\n  (users: today included, see above).\n- rolling_7_days: the 7 full days before today and the 7 before those,\n  without user counts.\n",
      "required": [
        "calendar_month",
        "rolling_30_days",
        "rolling_7_days"
      ],
      "properties": {
        "calendar_month": {
          "$ref": "#/$defs/VerificationPeriodPair"
        },
        "rolling_30_days": {
          "$ref": "#/$defs/VerificationPeriodPair"
        },
        "rolling_7_days": {
          "$ref": "#/$defs/VerificationPeriodPair"
        }
      }
    }
  }
}