{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/domani-run/json-schema/domani-run-account-info-schema.json",
  "title": "AccountInfo",
  "x-generated": "2026-11-05",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/domani-run-openapi.json#/components/schemas/AccountInfo",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "email": {
      "type": "string",
      "format": "email"
    },
    "plan": {
      "type": "string",
      "description": "Active personal Domani plan key"
    },
    "workspace_plans": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Distinct active Mailzero plan keys on workspaces the user can access"
    },
    "has_payment_method": {
      "type": "boolean",
      "description": "Whether the user has a card on file (required before buying domains)"
    },
    "preferred_payment_method": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "card",
        "usdc"
      ]
    },
    "preferred_locale": {
      "type": "string",
      "enum": [
        "en",
        "fr",
        "es",
        "pt-BR",
        "ja",
        "zh-Hans",
        "it"
      ],
      "description": "Locale used by Domani interfaces and transactional communications"
    },
    "has_contact": {
      "type": "boolean",
      "description": "Whether the user has set WHOIS contact info. Optional for purchases (until it is set, Domani's contact holds new domains on the user's behalf), required before transferring a domain in."
    },
    "contact": {
      "$ref": "#/$defs/RegistrantContact",
      "description": "Registrant contact info (null if not set)"
    },
    "referral_code": {
      "type": "string",
      "description": "Your unique referral code"
    },
    "referral_rate": {
      "type": "integer",
      "description": "Commission percentage on referred purchases"
    },
    "balance": {
      "type": "number",
      "description": "Marketplace credit balance in USD (earned from sales)"
    },
    "domain_count": {
      "type": "integer",
      "description": "Number of domains owned"
    },
    "token_count": {
      "type": "integer",
      "description": "Number of active API tokens"
    },
    "features": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Feature flags enabled for this account (GA features plus the preview features granted to the user), e.g. mailzero_assistant"
    },
    "can_manage_assistant": {
      "type": "boolean",
      "description": "Whether the calling token has the assistant:read scope. Independent of `features`: a feature flag says the account is eligible for the assistant, this says whether this specific token (full access, or a scoped CLI/OAuth/delegated token) may read or change its settings."
    },
    "is_admin": {
      "type": "boolean"
    },
    "mailbox_entitlement": {
      "type": "object",
      "description": "Custom-domain mailbox room on the account's personal workspace. Its own plan, not `plan` above: a workspace can carry its own Mailzero subscription while the user's own plan stays free.",
      "properties": {
        "plan_key": {
          "type": "string",
          "description": "The plan governing mailboxes on the personal workspace (its own subscription if any, else the user's plan)."
        },
        "mailbox_limit": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Custom-domain mailboxes the plan allows. null is unlimited."
        },
        "mailbox_limit_reached": {
          "type": "boolean",
          "description": "True once the personal workspace is at its plan's mailbox limit."
        },
        "mailbox_upgrade_plan": {
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "key": {
              "type": "string"
            },
            "name": {
              "type": "string"
            },
            "priceUsd": {
              "type": "number"
            },
            "mailboxes": {
              "type": [
                "integer",
                "null"
              ]
            }
          },
          "description": "The cheapest plan that would give room for another mailbox. null when already unlimited."
        }
      },
      "required": [
        "plan_key",
        "mailbox_limit",
        "mailbox_limit_reached",
        "mailbox_upgrade_plan"
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  },
  "required": [
    "id",
    "email",
    "plan",
    "workspace_plans",
    "has_payment_method",
    "preferred_payment_method",
    "preferred_locale",
    "has_contact",
    "referral_code",
    "referral_rate",
    "domain_count",
    "token_count",
    "mailbox_entitlement",
    "created_at"
  ],
  "$defs": {
    "RegistrantContact": {
      "type": "object",
      "description": "WHOIS registrant contact information required for domain registration (ICANN requirement)",
      "properties": {
        "first_name": {
          "type": "string",
          "description": "First name"
        },
        "last_name": {
          "type": "string",
          "description": "Last name"
        },
        "org_name": {
          "type": [
            "string",
            "null"
          ],
          "description": "Organization name (optional)"
        },
        "address1": {
          "type": "string",
          "description": "Street address line 1"
        },
        "address2": {
          "type": [
            "string",
            "null"
          ],
          "description": "Street address line 2 (optional)"
        },
        "city": {
          "type": "string",
          "description": "City"
        },
        "state": {
          "type": "string",
          "description": "State or province"
        },
        "postal_code": {
          "type": "string",
          "description": "Postal/ZIP code"
        },
        "country": {
          "type": "string",
          "description": "ISO 3166-1 alpha-2 country code (e.g. US, GB, FR)"
        },
        "phone": {
          "type": "string",
          "description": "Phone in +CC.NUMBER format (e.g. +1.5551234567)"
        },
        "email": {
          "type": "string",
          "format": "email",
          "description": "Contact email address"
        }
      },
      "required": [
        "first_name",
        "last_name",
        "address1",
        "city",
        "state",
        "postal_code",
        "country",
        "phone",
        "email"
      ]
    }
  }
}