{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/google-safe-browsing/json-schema/google-safe-browsing-google-cloud-webrisk-v1-compute-threat-list-diff-response-schema.json",
  "title": "GoogleCloudWebriskV1ComputeThreatListDiffResponse",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/google-safe-browsing-webrisk-threat-lists-api-openapi.yml#/components/schemas/GoogleCloudWebriskV1ComputeThreatListDiffResponse",
  "type": "object",
  "properties": {
    "recommendedNextDiff": {
      "type": "string",
      "format": "google-datetime",
      "description": "The soonest the client should wait before issuing any diff request. Querying sooner is unlikely to produce a meaningful diff. Waiting longer is acceptable considering the use case. If this field is not set clients may update as soon as they want."
    },
    "removals": {
      "$ref": "#/$defs/GoogleCloudWebriskV1ThreatEntryRemovals",
      "description": "A set of entries to remove from a local threat type's list. This field may be empty."
    },
    "responseType": {
      "enum": [
        "RESPONSE_TYPE_UNSPECIFIED",
        "DIFF",
        "RESET"
      ],
      "description": "The type of response. This may indicate that an action must be taken by the client when the response is received.",
      "type": "string"
    },
    "newVersionToken": {
      "format": "byte",
      "type": "string",
      "description": "The new opaque client version token. This should be retained by the client and passed into the next call of ComputeThreatListDiff as 'version_token'. A separate version token should be stored and used for each threatList."
    },
    "checksum": {
      "$ref": "#/$defs/GoogleCloudWebriskV1ComputeThreatListDiffResponseChecksum",
      "description": "The expected SHA256 hash of the client state; that is, of the sorted list of all hashes present in the database after applying the provided diff. If the client state doesn't match the expected state, the client must discard this diff and retry later."
    },
    "additions": {
      "$ref": "#/$defs/GoogleCloudWebriskV1ThreatEntryAdditions",
      "description": "A set of entries to add to a local threat type's list."
    }
  },
  "$defs": {
    "GoogleCloudWebriskV1ComputeThreatListDiffResponseChecksum": {
      "properties": {
        "sha256": {
          "description": "The SHA256 hash of the client state; that is, of the sorted list of all hashes present in the database.",
          "type": "string",
          "format": "byte"
        }
      },
      "description": "The expected state of a client's local database.",
      "type": "object"
    },
    "GoogleCloudWebriskV1RawHashes": {
      "type": "object",
      "properties": {
        "prefixSize": {
          "type": "integer",
          "description": "The number of bytes for each prefix encoded below. This field can be anywhere from 4 (shortest prefix) to 32 (full SHA256 hash). In practice this is almost always 4, except in exceptional circumstances.",
          "format": "int32"
        },
        "rawHashes": {
          "format": "byte",
          "description": "The hashes, in binary format, concatenated into one long string. Hashes are sorted in lexicographic order. For JSON API users, hashes are base64-encoded.",
          "type": "string"
        }
      },
      "description": "The uncompressed threat entries in hash format. Hashes can be anywhere from 4 to 32 bytes in size. A large majority are 4 bytes, but some hashes are lengthened if they collide with the hash of a popular URI. Used for sending ThreatEntryAdditons to clients that do not support compression, or when sending non-4-byte hashes to clients that do support compression."
    },
    "GoogleCloudWebriskV1RawIndices": {
      "properties": {
        "indices": {
          "description": "The indices to remove from a lexicographically-sorted local list.",
          "items": {
            "type": "integer",
            "format": "int32"
          },
          "type": "array"
        }
      },
      "type": "object",
      "description": "A set of raw indices to remove from a local list."
    },
    "GoogleCloudWebriskV1RiceDeltaEncoding": {
      "properties": {
        "riceParameter": {
          "format": "int32",
          "type": "integer",
          "description": "The Golomb-Rice parameter, which is a number between 2 and 28. This field is missing (that is, zero) if `num_entries` is zero."
        },
        "encodedData": {
          "description": "The encoded deltas that are encoded using the Golomb-Rice coder.",
          "type": "string",
          "format": "byte"
        },
        "firstValue": {
          "type": "string",
          "description": "The offset of the first entry in the encoded data, or, if only a single integer was encoded, that single integer's value. If the field is empty or missing, assume zero.",
          "format": "int64"
        },
        "entryCount": {
          "type": "integer",
          "format": "int32",
          "description": "The number of entries that are delta encoded in the encoded data. If only a single integer was encoded, this will be zero and the single value will be stored in `first_value`."
        }
      },
      "description": "The Rice-Golomb encoded data. Used for sending compressed 4-byte hashes or compressed removal indices.",
      "type": "object"
    },
    "GoogleCloudWebriskV1ThreatEntryAdditions": {
      "properties": {
        "rawHashes": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/GoogleCloudWebriskV1RawHashes"
          },
          "description": "The raw SHA256-formatted entries. Repeated to allow returning sets of hashes with different prefix sizes."
        },
        "riceHashes": {
          "$ref": "#/$defs/GoogleCloudWebriskV1RiceDeltaEncoding",
          "description": "The encoded 4-byte prefixes of SHA256-formatted entries, using a Golomb-Rice encoding. The hashes are converted to uint32, sorted in ascending order, then delta encoded and stored as encoded_data."
        }
      },
      "description": "Contains the set of entries to add to a local database. May contain a combination of compressed and raw data in a single response.",
      "type": "object"
    },
    "GoogleCloudWebriskV1ThreatEntryRemovals": {
      "type": "object",
      "properties": {
        "rawIndices": {
          "$ref": "#/$defs/GoogleCloudWebriskV1RawIndices",
          "description": "The raw removal indices for a local list."
        },
        "riceIndices": {
          "$ref": "#/$defs/GoogleCloudWebriskV1RiceDeltaEncoding",
          "description": "The encoded local, lexicographically-sorted list indices, using a Golomb-Rice encoding. Used for sending compressed removal indices. The removal indices (uint32) are sorted in ascending order, then delta encoded and stored as encoded_data."
        }
      },
      "description": "Contains the set of entries to remove from a local database."
    }
  }
}