{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/hg-insights/json-schema/hg-insights-companies-enrich-request-schema.json",
  "title": "CompaniesEnrichRequest",
  "description": "Request to enrich company data with firmographics, spend, and technographics",
  "x-generated": "2026-12-03",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/hg-insights-openapi.yaml#/components/schemas/CompaniesEnrichRequest",
  "additionalProperties": false,
  "properties": {
    "companies": {
      "$ref": "#/$defs/CompaniesFilter"
    },
    "contracts": {
      "$ref": "#/$defs/ContractsSubBody"
    },
    "fields": {
      "description": "Which data categories to include in the response",
      "items": {
        "$ref": "#/$defs/FieldGroups"
      },
      "minItems": 1,
      "type": "array",
      "x-struct": null,
      "x-validate": null
    },
    "filters": {
      "$ref": "#/$defs/EnrichFilters"
    },
    "pagination": {
      "$ref": "#/$defs/RequestPagination"
    }
  },
  "required": [
    "companies",
    "fields"
  ],
  "type": "object",
  "x-struct": "Elixir.TalariaWeb.Schemas.V2.Companies.Enrich.Request",
  "x-validate": "Elixir.TalariaWeb.Schemas.V2.Companies.Enrich.Request",
  "$defs": {
    "AiSpendFilters": {
      "additionalProperties": false,
      "description": "Filters for AI spend data",
      "properties": {
        "categories": {
          "$ref": "#/$defs/IdFilter"
        }
      },
      "title": "AiSpendFilters",
      "type": "object",
      "x-struct": "Elixir.TalariaWeb.Schemas.V2.Companies.Enrich.AiSpendFilters",
      "x-validate": null
    },
    "CompaniesFilter": {
      "additionalProperties": false,
      "description": "Filter companies by IDs or domains (mutually exclusive)",
      "properties": {
        "domains": {
          "description": "Array of company domains (e.g., example.com)",
          "items": {
            "type": "string",
            "x-struct": null,
            "x-validate": null
          },
          "maxItems": 25,
          "minItems": 1,
          "type": "array",
          "x-struct": null,
          "x-validate": null
        },
        "ids": {
          "description": "Array of hex-encoded company IDs",
          "items": {
            "$ref": "#/$defs/HexId"
          },
          "maxItems": 25,
          "minItems": 1,
          "type": "array",
          "x-struct": null,
          "x-validate": null
        }
      },
      "title": "CompaniesFilter",
      "type": "object",
      "x-struct": "Elixir.TalariaWeb.Schemas.V2.Companies.Enrich.CompaniesFilter",
      "x-validate": "Elixir.TalariaWeb.Schemas.V2.Companies.Enrich.CompaniesFilter"
    },
    "ContractsSubBody": {
      "additionalProperties": false,
      "description": "Configuration for contracts data in enrich request",
      "properties": {
        "filters": {
          "additionalProperties": false,
          "description": "Filters for contracts data",
          "properties": {
            "active_only": {
              "default": false,
              "description": "When true, return only active contracts",
              "type": "boolean",
              "x-struct": null,
              "x-validate": null
            },
            "vendor_names": {
              "description": "Filter by vendor names (max 10)",
              "items": {
                "type": "string",
                "x-struct": null,
                "x-validate": null
              },
              "maxItems": 10,
              "type": "array",
              "x-struct": null,
              "x-validate": null
            }
          },
          "type": "object",
          "x-struct": null,
          "x-validate": null
        },
        "limit": {
          "default": 10,
          "description": "Maximum number of contracts per company",
          "maximum": 100,
          "minimum": 1,
          "type": "integer",
          "x-struct": null,
          "x-validate": null
        },
        "offset": {
          "default": 0,
          "description": "Number of contracts to skip",
          "minimum": 0,
          "type": "integer",
          "x-struct": null,
          "x-validate": null
        }
      },
      "title": "ContractsSubBody",
      "type": "object",
      "x-struct": "Elixir.TalariaWeb.Schemas.V2.Companies.Enrich.ContractsSubBody",
      "x-validate": null
    },
    "CountryFilter": {
      "additionalProperties": false,
      "description": "Filter by country",
      "properties": {
        "codes": {
          "description": "Array of ISO 3166-1 alpha-2 country codes (e.g., US, GB, DE)",
          "items": {
            "maxLength": 2,
            "minLength": 2,
            "type": "string",
            "x-struct": null,
            "x-validate": null
          },
          "maxItems": 249,
          "minItems": 1,
          "type": "array",
          "x-struct": null,
          "x-validate": null
        }
      },
      "title": "CountryFilter",
      "type": "object",
      "x-struct": "Elixir.TalariaWeb.Schemas.V2.Companies.Enrich.TechnographicsFilters.CountryFilter",
      "x-validate": null
    },
    "EnrichFilters": {
      "additionalProperties": false,
      "description": "Filters for enrich request",
      "properties": {
        "ai_spend": {
          "$ref": "#/$defs/AiSpendFilters"
        },
        "mentions": {
          "$ref": "#/$defs/MentionsFilters"
        },
        "spend": {
          "$ref": "#/$defs/SpendFilters"
        },
        "technographics": {
          "$ref": "#/$defs/TechnographicsFilters"
        }
      },
      "title": "EnrichFilters",
      "type": "object",
      "x-struct": "Elixir.TalariaWeb.Schemas.V2.Companies.Enrich.Filters",
      "x-validate": null
    },
    "FieldGroups": {
      "description": "Data categories to include in the response",
      "enum": [
        "firmographics",
        "spend",
        "ai_spend",
        "technographics",
        "contracts",
        "ai_maturity",
        "cloud_maturity",
        "mentions",
        "statistics",
        "market_benchmarks"
      ],
      "title": "FieldGroups",
      "type": "string",
      "x-struct": "Elixir.TalariaWeb.Schemas.V2.Companies.Enrich.FieldGroups",
      "x-validate": null
    },
    "HexId": {
      "description": "Hexadecimal identifier (unsigned 128-bit base 16 integer)",
      "title": "HexId",
      "type": "string",
      "x-struct": "Elixir.TalariaWeb.Schemas.V2.Id",
      "x-validate": "Elixir.TalariaWeb.Schemas.V2.Id"
    },
    "IdFilter": {
      "additionalProperties": false,
      "description": "Filter by hex-encoded IDs and/or names (assumes ANY_PRESENT inclusion method)",
      "properties": {
        "ids": {
          "description": "Array of hex-encoded IDs",
          "items": {
            "$ref": "#/$defs/HexId"
          },
          "type": "array",
          "x-struct": null,
          "x-validate": null
        },
        "names": {
          "description": "Array of entity names for substring matching (case-insensitive)",
          "items": {
            "minLength": 1,
            "type": "string",
            "x-struct": null,
            "x-validate": null
          },
          "maxItems": 10,
          "type": "array",
          "x-struct": null,
          "x-validate": null
        }
      },
      "title": "IdFilter",
      "type": "object",
      "x-struct": "Elixir.TalariaWeb.Schemas.V2.Companies.Enrich.TechnographicsFilters.IdFilter",
      "x-validate": "Elixir.TalariaWeb.Schemas.V2.Companies.Enrich.TechnographicsFilters.IdFilter"
    },
    "InstallsFilter": {
      "additionalProperties": false,
      "description": "Install-level filter options",
      "properties": {
        "granularity": {
          "description": "Controls the shape of returned installs. \"country\" returns one row per product per country with `country_code` populated (across all countries the company has installs in, unless restricted by the country code filter). \"global\" returns deduplicated rows per product with `country_code` null. When omitted, behavior falls back to `localized`. Takes precedence over `localized` when provided.",
          "enum": [
            "global",
            "country"
          ],
          "type": "string",
          "x-struct": null,
          "x-validate": null
        },
        "localized": {
          "default": true,
          "deprecated": true,
          "description": "DEPRECATED: use `granularity` instead. Only match records where installs are within the same country as the company. Overridden by country code filter when provided. When `granularity` is provided, it takes precedence over this field.",
          "type": "boolean",
          "x-struct": null,
          "x-validate": null
        }
      },
      "title": "InstallsFilter",
      "type": "object",
      "x-struct": "Elixir.TalariaWeb.Schemas.V2.Companies.Enrich.TechnographicsFilters.InstallsFilter",
      "x-validate": null
    },
    "LastVerifiedDateFilter": {
      "additionalProperties": false,
      "description": "Filter by product last verified date range (inclusive)",
      "properties": {
        "max": {
          "description": "Maximum last verified date (inclusive), e.g. 2024-12-31",
          "format": "date",
          "type": "string",
          "x-struct": null,
          "x-validate": null
        },
        "min": {
          "description": "Minimum last verified date (inclusive), e.g. 2024-01-01",
          "format": "date",
          "type": "string",
          "x-struct": null,
          "x-validate": null
        }
      },
      "title": "LastVerifiedDateFilter",
      "type": "object",
      "x-struct": "Elixir.TalariaWeb.Schemas.V2.Companies.Enrich.TechnographicsFilters.LastVerifiedDateFilter",
      "x-validate": null
    },
    "Limit": {
      "default": 10,
      "description": "The number of records to return in the request.",
      "maximum": 25,
      "title": "Limit",
      "type": "integer",
      "x-struct": "Elixir.TalariaWeb.Schemas.V2.Pagination.Limit",
      "x-validate": null
    },
    "MentionsFilters": {
      "additionalProperties": false,
      "description": "Filters for mentions data",
      "properties": {
        "country": {
          "$ref": "#/$defs/CountryFilter"
        },
        "granularity": {
          "description": "Controls the shape of returned mentions. \"country\" returns one row per mention per country. \"global\" returns deduplicated rows per mention with country_code null.",
          "enum": [
            "global",
            "country"
          ],
          "type": "string",
          "x-struct": null,
          "x-validate": null
        },
        "localized": {
          "default": true,
          "deprecated": true,
          "description": "DEPRECATED: use `granularity` instead. When `granularity` is provided, it takes precedence.",
          "type": "boolean",
          "x-struct": null,
          "x-validate": null
        },
        "mention_attributes": {
          "$ref": "#/$defs/NumericIdFilter"
        },
        "mention_categories": {
          "$ref": "#/$defs/StringIdFilter"
        },
        "mention_last_verified_date": {
          "$ref": "#/$defs/LastVerifiedDateFilter"
        },
        "mentions": {
          "$ref": "#/$defs/NumericIdFilter"
        }
      },
      "title": "MentionsFilters",
      "type": "object",
      "x-struct": "Elixir.TalariaWeb.Schemas.V2.Companies.Enrich.MentionsFilters",
      "x-validate": null
    },
    "MentionsPagination": {
      "additionalProperties": false,
      "description": "Pagination parameters for mentions data",
      "properties": {
        "limit": {
          "$ref": "#/$defs/TechnographicsLimit"
        },
        "offset": {
          "$ref": "#/$defs/Offset"
        },
        "sort": {
          "$ref": "#/$defs/MentionsSort"
        }
      },
      "title": "MentionsPagination",
      "type": "object",
      "x-struct": "Elixir.TalariaWeb.Schemas.V2.Companies.Enrich.MentionsPagination",
      "x-validate": null
    },
    "MentionsSort": {
      "default": "intensity",
      "description": "How to order mentions results. `intensity`: highest-intensity mentions first (default). `last_seen`: most recently verified mentions first.",
      "enum": [
        "intensity",
        "last_seen"
      ],
      "title": "MentionsSort",
      "type": "string",
      "x-struct": "Elixir.TalariaWeb.Schemas.V2.Companies.Enrich.MentionsPagination.Sort",
      "x-validate": null
    },
    "NumericIdFilter": {
      "additionalProperties": false,
      "description": "Filter by numeric IDs and/or names (assumes ANY_PRESENT inclusion method)",
      "properties": {
        "ids": {
          "description": "Array of numeric IDs",
          "items": {
            "type": "integer",
            "x-struct": null,
            "x-validate": null
          },
          "type": "array",
          "x-struct": null,
          "x-validate": null
        },
        "names": {
          "description": "Array of entity names for substring matching (case-insensitive)",
          "items": {
            "minLength": 1,
            "type": "string",
            "x-struct": null,
            "x-validate": null
          },
          "maxItems": 10,
          "type": "array",
          "x-struct": null,
          "x-validate": null
        }
      },
      "title": "NumericIdFilter",
      "type": "object",
      "x-struct": "Elixir.TalariaWeb.Schemas.V2.Companies.Enrich.TechnographicsFilters.NumericIdFilter",
      "x-validate": "Elixir.TalariaWeb.Schemas.V2.Companies.Enrich.TechnographicsFilters.NumericIdFilter"
    },
    "Offset": {
      "default": 0,
      "description": "Used for paginating records.",
      "minimum": 0,
      "title": "Offset",
      "type": "integer",
      "x-struct": "Elixir.TalariaWeb.Schemas.V2.Pagination.Offset",
      "x-validate": null
    },
    "ProductAttributeFilter": {
      "additionalProperties": false,
      "description": "Filter by product attribute IDs (assumes ANY_PRESENT inclusion method)",
      "properties": {
        "ids": {
          "description": "Array of product attribute IDs",
          "items": {
            "type": "integer",
            "x-struct": null,
            "x-validate": null
          },
          "minItems": 1,
          "type": "array",
          "x-struct": null,
          "x-validate": null
        }
      },
      "required": [
        "ids"
      ],
      "title": "ProductAttributeFilter",
      "type": "object",
      "x-struct": "Elixir.TalariaWeb.Schemas.V2.Companies.Enrich.TechnographicsFilters.ProductAttributeFilter",
      "x-validate": null
    },
    "RequestPagination": {
      "additionalProperties": false,
      "description": "Pagination parameters for companies and nested data",
      "properties": {
        "ai_spend": {
          "$ref": "#/$defs/SpendPagination"
        },
        "mentions": {
          "$ref": "#/$defs/MentionsPagination"
        },
        "spend": {
          "$ref": "#/$defs/SpendPagination"
        },
        "technographics": {
          "$ref": "#/$defs/TechnographicsPagination"
        }
      },
      "title": "RequestPagination",
      "type": "object",
      "x-struct": "Elixir.TalariaWeb.Schemas.V2.Companies.Enrich.RequestPagination",
      "x-validate": null
    },
    "SpendFilters": {
      "additionalProperties": false,
      "description": "Filters for spend data",
      "properties": {
        "categories": {
          "$ref": "#/$defs/IdFilter"
        }
      },
      "title": "SpendFilters",
      "type": "object",
      "x-struct": "Elixir.TalariaWeb.Schemas.V2.Companies.Enrich.SpendFilters",
      "x-validate": null
    },
    "SpendPagination": {
      "additionalProperties": false,
      "description": "Pagination parameters for spend data. Set paginate to false to return all categories without pagination (limit and offset are ignored).",
      "properties": {
        "limit": {
          "$ref": "#/$defs/Limit"
        },
        "offset": {
          "$ref": "#/$defs/Offset"
        },
        "paginate": {
          "default": true,
          "description": "When false, returns all spend categories without pagination. The limit and offset parameters are ignored.",
          "type": "boolean",
          "x-struct": null,
          "x-validate": null
        }
      },
      "title": "SpendPagination",
      "type": "object",
      "x-struct": "Elixir.TalariaWeb.Schemas.V2.Companies.Enrich.SpendPagination",
      "x-validate": null
    },
    "StringIdFilter": {
      "additionalProperties": false,
      "description": "Filter by string IDs and/or names (assumes ANY_PRESENT inclusion method)",
      "properties": {
        "ids": {
          "description": "Array of string IDs",
          "items": {
            "minLength": 1,
            "type": "string",
            "x-struct": null,
            "x-validate": null
          },
          "type": "array",
          "x-struct": null,
          "x-validate": null
        },
        "names": {
          "description": "Array of entity names for substring matching (case-insensitive)",
          "items": {
            "minLength": 1,
            "type": "string",
            "x-struct": null,
            "x-validate": null
          },
          "maxItems": 10,
          "type": "array",
          "x-struct": null,
          "x-validate": null
        }
      },
      "title": "StringIdFilter",
      "type": "object",
      "x-struct": "Elixir.TalariaWeb.Schemas.V2.Companies.Enrich.TechnographicsFilters.StringIdFilter",
      "x-validate": "Elixir.TalariaWeb.Schemas.V2.Companies.Enrich.TechnographicsFilters.StringIdFilter"
    },
    "TechnographicsFilters": {
      "additionalProperties": false,
      "description": "Filters for technographics data",
      "properties": {
        "country": {
          "$ref": "#/$defs/CountryFilter"
        },
        "installs": {
          "$ref": "#/$defs/InstallsFilter"
        },
        "product_attributes": {
          "$ref": "#/$defs/ProductAttributeFilter"
        },
        "product_categories": {
          "$ref": "#/$defs/IdFilter"
        },
        "product_last_verified_date": {
          "$ref": "#/$defs/LastVerifiedDateFilter"
        },
        "products": {
          "$ref": "#/$defs/NumericIdFilter"
        },
        "vendors": {
          "$ref": "#/$defs/NumericIdFilter"
        }
      },
      "title": "TechnographicsFilters",
      "type": "object",
      "x-struct": "Elixir.TalariaWeb.Schemas.V2.Companies.Enrich.TechnographicsFilters",
      "x-validate": null
    },
    "TechnographicsLimit": {
      "default": 10,
      "description": "The number of technographics records to return in the request.",
      "maximum": 100,
      "title": "TechnographicsLimit",
      "type": "integer",
      "x-struct": "Elixir.TalariaWeb.Schemas.V2.Companies.Enrich.TechnographicsPagination.Limit",
      "x-validate": null
    },
    "TechnographicsPagination": {
      "additionalProperties": false,
      "description": "Pagination parameters for technographics data",
      "properties": {
        "limit": {
          "$ref": "#/$defs/TechnographicsLimit"
        },
        "offset": {
          "$ref": "#/$defs/Offset"
        },
        "sort": {
          "$ref": "#/$defs/TechnographicsSort"
        }
      },
      "title": "TechnographicsPagination",
      "type": "object",
      "x-struct": "Elixir.TalariaWeb.Schemas.V2.Companies.Enrich.TechnographicsPagination",
      "x-validate": null
    },
    "TechnographicsSort": {
      "default": "intensity",
      "description": "How to order technographics results. `intensity`: highest-intensity products first (default). `last_seen`: most recently verified products first, i.e. sorted by the `product_last_verified_date` response field.",
      "enum": [
        "intensity",
        "last_seen"
      ],
      "title": "TechnographicsSort",
      "type": "string",
      "x-struct": "Elixir.TalariaWeb.Schemas.V2.Companies.Enrich.TechnographicsPagination.Sort",
      "x-validate": null
    }
  }
}