{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/hlr-lookup/json-schema/hlr-lookup-lookup-request-schema.json",
  "title": "LookupRequest",
  "description": "Accepts either a flat single-number body or a nested batch body (up to 80 items).",
  "x-generated": "2026-11-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/hlr-lookup-openapi.yml#/components/schemas/LookupRequest",
  "oneOf": [
    {
      "$ref": "#/$defs/LookupRequestFlat"
    },
    {
      "$ref": "#/$defs/LookupRequestNested"
    }
  ],
  "$defs": {
    "LookupRequestFlat": {
      "title": "LookupRequestFlat",
      "type": "object",
      "description": "Flat single-number request. Auto-converted server-side to a single-item nested request.",
      "required": [
        "api_key",
        "api_secret",
        "telephone_number"
      ],
      "additionalProperties": false,
      "properties": {
        "api_key": {
          "type": "string"
        },
        "api_secret": {
          "type": "string"
        },
        "telephone_number": {
          "type": "string"
        },
        "input_format": {
          "type": "string"
        },
        "output_format": {
          "type": "string"
        },
        "cache_days_global": {
          "type": "integer",
          "minimum": 0,
          "maximum": 30
        },
        "cache_days_private": {
          "type": "integer",
          "minimum": 0,
          "maximum": 30
        },
        "save_to_cache": {
          "type": "string",
          "enum": [
            "YES",
            "NO",
            "PRIVATE"
          ]
        },
        "get_ported_date": {
          "$ref": "#/$defs/YesNo"
        },
        "get_landline_status": {
          "$ref": "#/$defs/YesNo"
        },
        "get_imsi_hash": {
          "$ref": "#/$defs/YesNo"
        },
        "usa_status": {
          "$ref": "#/$defs/YesNo"
        }
      }
    },
    "LookupRequestNested": {
      "title": "LookupRequestNested",
      "type": "object",
      "required": [
        "api_key",
        "api_secret",
        "requests"
      ],
      "additionalProperties": false,
      "properties": {
        "api_key": {
          "type": "string"
        },
        "api_secret": {
          "type": "string"
        },
        "requests": {
          "type": "array",
          "minItems": 1,
          "maxItems": 80,
          "items": {
            "$ref": "#/$defs/RequestItem"
          }
        }
      }
    },
    "RequestItem": {
      "title": "RequestItem",
      "type": "object",
      "description": "A single number to look up. Only `telephone_number` is required.",
      "required": [
        "telephone_number"
      ],
      "additionalProperties": false,
      "properties": {
        "telephone_number": {
          "type": "string",
          "description": "Phone number in international E.164 (digits only, no leading `+`) or national format (in which case `input_format` must be set to the ISO3 country code)."
        },
        "input_format": {
          "type": "string",
          "description": "Empty string (default) for international input, or an ISO3 country code when `telephone_number` is in national format."
        },
        "output_format": {
          "type": "string",
          "description": "Format of `formatted_telephone_number` in the response. One of the literals below, or a valid ISO3 country code to format internationally for that country."
        },
        "cache_days_global": {
          "type": "integer",
          "minimum": 0,
          "maximum": 30,
          "description": "Max age, in days, of a globally-shared cached result that may be returned."
        },
        "cache_days_private": {
          "type": "integer",
          "minimum": 0,
          "maximum": 30,
          "description": "Max age, in days, of an account-private cached result that may be returned."
        },
        "save_to_cache": {
          "type": "string",
          "enum": [
            "YES",
            "NO",
            "PRIVATE"
          ],
          "description": "Whether new results should be written to the shared cache (`YES`), not cached (`NO`), or cached privately to this account (`PRIVATE`)."
        },
        "get_ported_date": {
          "allOf": [
            {
              "$ref": "#/$defs/YesNo"
            }
          ],
          "default": "NO",
          "description": "Request the ported-date field when available."
        },
        "get_landline_status": {
          "allOf": [
            {
              "$ref": "#/$defs/YesNo"
            }
          ],
          "default": "NO",
          "description": "Request the landline_status field when available."
        },
        "get_imsi_hash": {
          "allOf": [
            {
              "$ref": "#/$defs/YesNo"
            }
          ],
          "description": "Request an IMSI hash under `current_network_details.imsi_hash` when available."
        },
        "usa_status": {
          "allOf": [
            {
              "$ref": "#/$defs/YesNo"
            }
          ],
          "default": "NO",
          "description": "For US numbers, return live status instead of the default `NOT_AVAILABLE_NETWORK_ONLY`. Incurs an extra credit per lookup."
        }
      }
    },
    "YesNo": {
      "type": "string",
      "enum": [
        "YES",
        "NO"
      ]
    }
  }
}