{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/vertesiahq/json-schema/vertesiahq-account-schema.json",
  "title": "Account",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/vertesiahq-accounts-api-openapi.yml#/components/schemas/Account",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "namespace": {
      "type": "string",
      "description": "Public DNS-label-compatible identifier used by organization app domains."
    },
    "app_access_message": {
      "type": "string",
      "maxLength": 1000,
      "description": "Plain-text instructions shown when a signed-in user has no application access."
    },
    "email_domains": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "onboarding": {
      "type": "object",
      "properties": {
        "completed": {
          "type": "boolean"
        },
        "completed_at": {
          "type": "string",
          "format": "date-time"
        }
      },
      "required": [
        "completed"
      ],
      "additionalProperties": false
    },
    "datacenter": {
      "type": "string"
    },
    "account_type": {
      "$ref": "#/$defs/AccountType"
    },
    "billing": {
      "$ref": "#/$defs/AccountBilling"
    },
    "quota_tier": {
      "$ref": "#/$defs/QuotaTier",
      "description": "Quota/rate-limit tier. Unset → the deployment default tier (env `QUOTA_BASE_TIER`)."
    },
    "feature_flags": {
      "type": "object",
      "additionalProperties": true,
      "description": "Ops-managed per-account feature flags. Untyped by design so operators can add / remove temporary rollout gates without a schema change. Keys are enumerated in the admin UI from a hardcoded registry (studio-server) — flags not in that registry are ignored. Not modifiable through the public account API; admin API only."
    },
    "created_by": {
      "type": "string"
    },
    "updated_by": {
      "type": "string"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    }
  },
  "required": [
    "id",
    "name",
    "email_domains",
    "onboarding",
    "datacenter",
    "account_type",
    "billing",
    "created_by",
    "updated_by",
    "created_at",
    "updated_at"
  ],
  "additionalProperties": false,
  "$defs": {
    "AccountBilling": {
      "type": "object",
      "properties": {
        "method": {
          "$ref": "#/$defs/BillingMethod"
        },
        "stripe_customer_id": {
          "type": "string"
        }
      },
      "required": [
        "method"
      ],
      "additionalProperties": false
    },
    "AccountType": {
      "type": "string",
      "enum": [
        "vertesia",
        "partner",
        "free",
        "customer",
        "prospect",
        "unknown"
      ]
    },
    "BillingMethod": {
      "type": "string",
      "enum": [
        "stripe",
        "invoice"
      ]
    },
    "QuotaTier": {
      "type": "string",
      "enum": [
        "standard",
        "enterprise"
      ],
      "description": "Quota/rate-limit tier assigned to an account. Code-defined tiers live in `@dglabs/quota` (`QUOTA_TIERS`); these names must match its keys.\n- `standard` — protective baseline limits (the default for most accounts).\n- `enterprise` — high limits for contracted customers / internal / partners.\n\nAn account with no explicit `quota_tier` derives its tier from its `account_type`."
    }
  }
}