{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/githunt-ai/json-schema/githunt-ai-search-request-schema.json",
  "title": "SearchRequest",
  "description": "At least one of `location`, `locations`, or `regions` is required.",
  "x-generated": "2026-10-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/githunt-ai-openapi.yaml#/components/schemas/SearchRequest",
  "type": "object",
  "properties": {
    "location": {
      "type": "string"
    },
    "role": {
      "type": "string"
    },
    "skills": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "maxItems": 20
    },
    "languages": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "maxItems": 10
    },
    "minExperienceYears": {
      "type": "integer",
      "minimum": 0,
      "maximum": 50
    },
    "isHireable": {
      "type": "boolean"
    },
    "strictSkills": {
      "type": "boolean",
      "default": false
    },
    "includeUnlocated": {
      "type": "boolean",
      "default": false,
      "description": "When true, also search candidates indexed with no stated location. Their location is unknown, so they are returned as screening leads and can never be counted as geographically verified; `meta.coverage.unlocated_included` marks a response that contains them."
    },
    "maxResults": {
      "type": "integer",
      "minimum": 1,
      "maximum": 100,
      "default": 25
    },
    "offset": {
      "type": "integer",
      "minimum": 0,
      "maximum": 200,
      "default": 0,
      "description": "Number of top-ranked candidates to skip, for paging. Use with maxResults to fetch the next page. Consecutive pages never overlap."
    },
    "excludeLogins": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "maxItems": 500,
      "description": "GitHub logins to leave out of results, e.g. candidates already seen in a prior call. Use for dedup across searches. Case-insensitive; invalid entries are dropped rather than rejected."
    },
    "excludeLocations": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "maxItems": 50,
      "description": "Countries or cities to exclude, matched the same way as the location parameter (aliases and native names included)."
    },
    "excludeUtcOffsets": {
      "type": "object",
      "description": "Exclude candidates whose stated location resolves entirely within this UTC offset band, in hours. A location that only partially overlaps the band, or can't be resolved, is kept (not excluded) - a candidate whose commit timezone falls inside the band but whose location is unresolvable comes back flagged with `location_resolution.screening_reason`, never dropped.",
      "properties": {
        "min": {
          "type": "number",
          "minimum": -12,
          "maximum": 14
        },
        "max": {
          "type": "number",
          "minimum": -12,
          "maximum": 14
        }
      },
      "required": [
        "min",
        "max"
      ]
    },
    "locations": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "maxItems": 10,
      "description": "Additional cities/countries to search in one call, freeform like `location`, merged with it (max 10 combined). Live GitHub crawl only covers the first location; further locations are served from the candidate pool only. At least one of `location`, `locations`, or `regions` is required."
    },
    "regions": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "north-america",
          "latin-america",
          "south-america",
          "europe",
          "western-europe",
          "eastern-europe",
          "nordics",
          "dach",
          "benelux",
          "iberia",
          "uk-ireland",
          "middle-east",
          "africa",
          "apac",
          "east-asia",
          "southeast-asia",
          "south-asia",
          "oceania",
          "americas",
          "emea",
          "worldwide"
        ]
      },
      "maxItems": 3,
      "description": "Named region shortcuts that expand to their member countries, merged with `location`/`locations` (max 10 combined locations after expansion; extras are dropped). Case-insensitive. A request whose region names are all unknown and that carries no `location` is rejected with `invalid_request`."
    },
    "organizations": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "maxItems": 20,
      "description": "GitHub org logins to check candidates' employer affinity against. Boosts matching candidates' rank unless `requireOrgAffinity` is true."
    },
    "sectors": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "adtech",
          "ai-ml",
          "banking",
          "cloud",
          "cybersecurity",
          "ecommerce",
          "fintech",
          "gaming",
          "healthtech",
          "media",
          "mobility",
          "payments"
        ]
      },
      "maxItems": 5,
      "description": "Industry sectors to check candidates' employer affinity against, via GitHunt's employer graph (public GitHub orgs mapped to companies and sectors)."
    },
    "requireOrgAffinity": {
      "type": "boolean",
      "default": false,
      "description": "When true, only return candidates matching one of the given `organizations`/`sectors` (hard filter) instead of just boosting their rank."
    },
    "domains": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "payments",
          "healthcare",
          "adtech"
        ]
      },
      "maxItems": 3,
      "description": "Domain vocabulary packs to score candidates' repos/bio against for subject-matter evidence (e.g. core payments-processing terminology, not just the word \"payments\")."
    },
    "skillRecency": {
      "type": "array",
      "minItems": 1,
      "maxItems": 10,
      "items": {
        "$ref": "#/$defs/SkillRecencyEntry"
      },
      "description": "Filter on public skill activity. Entries are ANDed: a candidate must satisfy every entry to be returned. Only candidates whose signals positively support every entry are returned, and only they occupy a slot in the per-location selection the search scores, so a candidate with evidence is never crowded out by higher-activity candidates without it. Candidates whose signals cannot answer the question are `unknown` and are left out of the results (and queued for enrichment), which is not a negative finding - see `meta.skill_recency`. `unknown` covers a signal that is missing, failed, expired (signals are refreshed on a 30-day cycle, and one older than that no longer answers a strict filter) or partial (the years the answer depends on could not be fetched). Malformed entries are an uncharged `invalid_request`. When `skillRecency` is set, the search is served from the candidate pool alone: a live GitHub row carries no derived signals and could only ever be `unknown`."
    },
    "excludeList": {
      "type": "string",
      "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$",
      "description": "Name of a seen list (see /v1/lists) whose logins are merged into `excludeLogins` for this search, so a rerun of the same brief never returns candidates the account already recorded. Only permanent `seen` entries and claims that have not expired are excluded: an interrupted run's candidates are rediscoverable as soon as the claim lapses. The server-side list is bounded at 5000 eligible logins rather than the 500-entry client cap; `meta.exclude_list.truncated` reports when that bound was hit. An unknown list is a `not_found` before any quota is charged, so create the list first with an empty `POST /v1/lists/{name}/logins`."
    }
  },
  "$defs": {
    "SkillRecencyEntry": {
      "type": "object",
      "description": "One skill-activity predicate. At least one of `minActiveYears` or `usedWithinYears` is required; both may be given.",
      "required": [
        "skill"
      ],
      "properties": {
        "skill": {
          "type": "string",
          "minLength": 1,
          "maxLength": 64,
          "description": "Language or skill name. Common aliases resolve to the canonical GitHub Linguist name (ts, js, py, rb, kt, rs, sh, cpp, c#, golang)."
        },
        "minActiveYears": {
          "type": "integer",
          "minimum": 1,
          "maximum": 9,
          "description": "Minimum number of distinct calendar years with public activity in this skill (a year counts at five or more commits). This is a public-activity measure, never elapsed or commercial tenure."
        },
        "usedWithinYears": {
          "type": "integer",
          "minimum": 1,
          "maximum": 9,
          "description": "Require dated activity inside the rolling window of this many years ending at the request's UTC timestamp. Calendar-year subtraction in UTC, clamping Feb 29 to Feb 28 in a non-leap target year; the cutoff day itself counts as inside the window."
        }
      }
    }
  }
}