{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/hlr-lookup/json-schema/hlr-lookup-hlr-response-schema.json",
  "title": "HlrResponse",
  "x-generated": "2026-11-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/hlr-lookup-openapi.yml#/components/schemas/HlrResponse",
  "type": "object",
  "required": [
    "results"
  ],
  "properties": {
    "results": {
      "type": "array",
      "items": {
        "oneOf": [
          {
            "$ref": "#/$defs/HlrResultItemSuccess"
          },
          {
            "$ref": "#/$defs/ResultItemError"
          }
        ]
      }
    }
  },
  "$defs": {
    "CurrentNetworkDetails": {
      "title": "CurrentNetworkDetails",
      "type": "object",
      "description": "Network currently hosting the number (after any porting). Unlike `OriginalNetworkDetails`, `area` is omitted.",
      "properties": {
        "name": {
          "type": "string"
        },
        "mccmnc": {
          "type": "string"
        },
        "country_name": {
          "type": "string"
        },
        "country_iso3": {
          "type": "string"
        },
        "country_prefix": {
          "type": "string"
        },
        "imsi_hash": {
          "type": "string",
          "description": "IMSI hash. Present only when `get_imsi_hash=YES` was requested and the current network is available."
        }
      }
    },
    "EchoedRequestParameters": {
      "title": "EchoedRequestParameters",
      "type": "object",
      "description": "The request parameters applied to this result (after defaults and resolution).",
      "properties": {
        "telephone_number": {
          "type": "string"
        },
        "input_format": {
          "type": "string"
        },
        "output_format": {
          "type": "string"
        },
        "save_to_cache": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "YES",
                "NO",
                "PRIVATE"
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "cache_days_global": {
          "type": [
            "integer",
            "null"
          ]
        },
        "cache_days_private": {
          "type": [
            "integer",
            "null"
          ]
        },
        "get_ported_date": {
          "$ref": "#/$defs/YesNo"
        },
        "get_landline_status": {
          "$ref": "#/$defs/YesNo"
        },
        "get_imsi_hash": {
          "$ref": "#/$defs/YesNo"
        },
        "usa_status": {
          "$ref": "#/$defs/YesNo"
        }
      }
    },
    "HlrResultItemSuccess": {
      "title": "HlrResultItemSuccess",
      "type": "object",
      "required": [
        "error",
        "uuid",
        "request_parameters",
        "credits_spent",
        "detected_telephone_number",
        "formatted_telephone_number",
        "live_status",
        "original_network",
        "original_network_details",
        "current_network",
        "current_network_details",
        "is_ported",
        "sms_email",
        "mms_email",
        "timestamp"
      ],
      "properties": {
        "error": {
          "type": "string",
          "const": "NONE"
        },
        "uuid": {
          "type": "string",
          "format": "uuid"
        },
        "request_parameters": {
          "$ref": "#/$defs/EchoedRequestParameters"
        },
        "credits_spent": {
          "type": "number"
        },
        "detected_telephone_number": {
          "type": "string"
        },
        "formatted_telephone_number": {
          "type": "string"
        },
        "telephone_number_type": {
          "allOf": [
            {
              "$ref": "#/$defs/TelephoneNumberType"
            }
          ],
          "description": "Omitted on `/apiv2/mnp` responses for country code 1 (NANP) numbers."
        },
        "live_status": {
          "$ref": "#/$defs/LiveStatus"
        },
        "original_network": {
          "$ref": "#/$defs/NetworkAvailability"
        },
        "original_network_details": {
          "$ref": "#/$defs/OriginalNetworkDetails"
        },
        "current_network": {
          "$ref": "#/$defs/NetworkAvailability"
        },
        "current_network_details": {
          "$ref": "#/$defs/CurrentNetworkDetails"
        },
        "is_ported": {
          "$ref": "#/$defs/IsPorted"
        },
        "sms_email": {
          "type": "string",
          "description": "SMS-to-email gateway address, empty string if unknown."
        },
        "mms_email": {
          "type": "string",
          "description": "MMS-to-email gateway address, empty string if unknown."
        },
        "ported_date": {
          "type": "string",
          "description": "ISO-8601 UTC timestamp, or a status string such as `NOT_AVAILABLE` / `NOT_APPLICABLE` if the supplier returned one. Only present when `get_ported_date=YES` was requested and the supplier returned a value."
        },
        "landline_status": {
          "type": "string",
          "enum": [
            "LIVE",
            "DEAD",
            "OUT_OF_ORDER",
            "NUMBER_CHANGED",
            "CALL_BARRED",
            "INCONCLUSIVE",
            "UNKNOWN_NOT_AUTH",
            "UNKNOWN_NOT_AVAIL",
            "UNKNOWN_NOT_IMPL",
            "UNKNOWN_REJECTED",
            "UNKNOWN_INTERWORKING",
            "ERROR_UNKNOWN_RESPONSE"
          ],
          "description": "Only present when `get_landline_status=YES` was requested and available."
        },
        "raw_landline_response": {
          "type": "string",
          "description": "Raw response from the landline-status supplier. Only present when the supplier returned one."
        },
        "disposable_number": {
          "type": "string",
          "enum": [
            "YES",
            "NO",
            "UNKNOWN"
          ],
          "description": "Whether the number is a known disposable / temporary number. `UNKNOWN` if the supplier could not determine it."
        },
        "timestamp": {
          "type": "string",
          "description": "ISO-8601 UTC timestamp of the underlying result (cached or live)."
        }
      }
    },
    "IsPorted": {
      "type": "string",
      "enum": [
        "YES",
        "NO",
        "UNKNOWN"
      ]
    },
    "LiveStatus": {
      "type": "string",
      "enum": [
        "LIVE",
        "DEAD",
        "ABSENT_SUBSCRIBER",
        "NO_TELESERVICE_PROVISIONED",
        "NOT_AVAILABLE_NETWORK_ONLY",
        "NO_COVERAGE",
        "INCONCLUSIVE",
        "NOT_APPLICABLE"
      ]
    },
    "NetworkAvailability": {
      "type": "string",
      "enum": [
        "AVAILABLE",
        "NOT_AVAILABLE",
        "NOT_APPLICABLE"
      ]
    },
    "OriginalNetworkDetails": {
      "title": "OriginalNetworkDetails",
      "type": "object",
      "description": "Network that originally issued the range containing this number.",
      "properties": {
        "name": {
          "type": "string"
        },
        "mccmnc": {
          "type": "string"
        },
        "country_name": {
          "type": "string"
        },
        "country_iso3": {
          "type": "string"
        },
        "area": {
          "type": "string",
          "description": "Geographic area (may be empty for mobile ranges)."
        },
        "country_prefix": {
          "type": "string"
        }
      }
    },
    "ResultItemError": {
      "title": "ResultItemError",
      "type": "object",
      "required": [
        "error"
      ],
      "properties": {
        "error": {
          "type": "string",
          "enum": [
            "INSUFFICIENT_CREDIT",
            "INTERNAL_ERROR",
            "TOO_MANY_REQUESTS",
            "NULL_RESULT"
          ]
        }
      }
    },
    "TelephoneNumberType": {
      "type": "string",
      "enum": [
        "MOBILE",
        "LANDLINE",
        "VOIP",
        "PAGER",
        "PREMIUM",
        "TOLL_FREE",
        "SHARED_COST",
        "PERSONAL_NUMBER",
        "UNIVERSAL_ACCESS_NUMBER",
        "VOICEMAIL_ONLY",
        "STAGE_AND_SCREEN",
        "MACHINE_TO_MACHINE",
        "MSRN",
        "MOBILE_OR_LANDLINE",
        "UNKNOWN",
        "BAD_FORMAT"
      ]
    },
    "YesNo": {
      "type": "string",
      "enum": [
        "YES",
        "NO"
      ]
    }
  }
}