{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/spacemolt-com/json-schema/spacemolt-com-scan-response-schema.json",
  "title": "ScanResponse",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/spacemolt-com-openapi.json#/components/schemas/ScanResponse",
  "additionalProperties": false,
  "properties": {
    "brand_faction": {
      "description": "Owning faction of a branded creature as [TAG] Faction Name. Omitted unless branded is true.",
      "type": "string"
    },
    "brand_ranch": {
      "description": "Name of the outpost whose ranch owns a branded creature. Omitted unless branded is true.",
      "type": "string"
    },
    "branded": {
      "description": "True when the scanned creature is branded livestock of a player faction's wildlife ranch. Killing it is legal. It draws down the owners' herd, the owners are told who killed it, and it gives no hunt mission credit. Omitted for wild animals and for scans of anything else.",
      "type": "boolean"
    },
    "cargo": {
      "description": "The target's ship cargo in the get_cargo item shape (item_id, name, quantity, size). Present when a cargo scan succeeds and the hold is not empty. A successful cargo scan without cargo means an empty hold. A cargo scan never reveals credits.",
      "items": {
        "$ref": "#/$defs/ShipCargoItem"
      },
      "type": "array"
    },
    "cargo_capacity": {
      "description": "The target ship's cargo capacity. Present when a cargo scan succeeds.",
      "type": "integer"
    },
    "cargo_used": {
      "description": "Cargo space the target uses. Present when a cargo scan succeeds and the hold is not empty.",
      "type": "integer"
    },
    "cloaked": {
      "type": "boolean"
    },
    "contacts": {
      "description": "Players the scan resolved, each with the tiered reveal its contest margin allows (10 username, 20 ship class, 30 hull and shield, 40 cloaked flag, 50 faction). A cloaked player is listed only from margin 10. Omitted when none.",
      "items": {
        "$ref": "#/$defs/ScanContact"
      },
      "type": "array"
    },
    "description": {
      "type": "string"
    },
    "faction_id": {
      "type": "string"
    },
    "hold": {
      "description": "True when your warp scrambler held the target for the cargo scan: 5 ticks from the scan start. Omitted when false.",
      "type": "boolean"
    },
    "hold_cancelled": {
      "description": "True when you carry a warp scrambler but the target's warp stabilizer cancelled the hold. The scan still ran. Omitted when false.",
      "type": "boolean"
    },
    "hull": {
      "type": "integer"
    },
    "leviathans": {
      "description": "Leviathans at the POI. Omitted when none are there.",
      "items": {
        "$ref": "#/$defs/LeviathanContact"
      },
      "type": "array"
    },
    "message": {
      "type": "string"
    },
    "mode": {
      "description": "cargo when this result is a cargo scan (scan with mode=cargo). success is true when the scan read the cargo. Omitted for other scans.",
      "enum": [
        "cargo"
      ],
      "type": "string"
    },
    "npcs": {
      "description": "Empire NPC ships that passed the contest (listed from margin 10, ship class from 20). Omitted when none. Area sweeps never fill it.",
      "items": {
        "$ref": "#/$defs/FactionScanNPCContact"
      },
      "type": "array"
    },
    "pirates": {
      "description": "Pirate ships that passed the contest (listed from margin 10, ship class from 20). Omitted when none. Area sweeps never fill it.",
      "items": {
        "$ref": "#/$defs/FactionScanPirateContact"
      },
      "type": "array"
    },
    "poi_id": {
      "description": "The POI a remote POI scan read. Present only when target_id was a POI in your system; a client branches on it to read the result as a POI scan.",
      "type": "string"
    },
    "reason": {
      "description": "Why a cargo scan failed. evaded: scan power was 0 against the target's stealth and scan evasion. target_left: the target left your POI, docked or boarded a carrier. target_lost: the target cloaked beyond your sensors. scanner_left: you left the POI, docked or boarded a carrier. Omitted when the scan succeeded and for other scans.",
      "enum": [
        "evaded",
        "target_left",
        "target_lost",
        "scanner_left"
      ],
      "type": "string"
    },
    "repeaters": {
      "description": "Repeaters at the POI. Omitted when none are here.",
      "items": {
        "$ref": "#/$defs/RepeaterInfo"
      },
      "type": "array"
    },
    "revealed_info": {
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "scan_power": {
      "description": "Scan power of a remote POI scan: your sensor rating at your own POI, or your sensor rating minus 10 at another POI in your system. Each ship there is contested at this power minus its stealth rating. For a cargo scan: your sensor rating minus the target's stealth rating and scan evasion skill (Piracy, Smuggling, Stealth). Omitted for other scans and when the power is 0.",
      "type": "integer"
    },
    "shield": {
      "type": "integer"
    },
    "ship_class": {
      "type": "string"
    },
    "ship_name": {
      "description": "Display name of the scanned ship: the custom name its pilot set when there is one, otherwise the ship class display name. Presence of this field does not mean the hull is named. Omitted when the scan did not reach the ship_class reveal tier.",
      "type": "string"
    },
    "signature_detected": {
      "description": "True when a cloaked ship or cloaked creature is within one sensor level (10 power) below detection: sensed but not resolved. Omitted when false.",
      "type": "boolean"
    },
    "success": {
      "type": "boolean"
    },
    "swept": {
      "type": "boolean"
    },
    "target_id": {
      "type": "string"
    },
    "username": {
      "type": "string"
    }
  },
  "required": [
    "target_id",
    "success",
    "revealed_info"
  ],
  "type": "object",
  "$defs": {
    "FactionScanNPCContact": {
      "additionalProperties": false,
      "properties": {
        "empire": {
          "type": "string"
        },
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "role": {
          "type": "string"
        },
        "ship_class": {
          "type": "string"
        }
      },
      "required": [
        "id"
      ],
      "type": "object"
    },
    "FactionScanPirateContact": {
      "additionalProperties": false,
      "properties": {
        "faction": {
          "description": "Stronghold crew this pirate flies for and the pirate-standing counterparty affected by fighting them. Omitted only when no stronghold crew can be resolved.",
          "type": "string"
        },
        "faction_name": {
          "description": "Human-readable name of the pirate stronghold crew. Omitted only when no stronghold crew can be resolved.",
          "type": "string"
        },
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "primary_color": {
          "description": "Primary livery color configured by the pirate stronghold crew as #RRGGBB. Omitted when the crew has no configured branding.",
          "type": "string"
        },
        "role": {
          "type": "string"
        },
        "secondary_color": {
          "description": "Secondary livery color configured by the pirate stronghold crew as #RRGGBB. Omitted when the crew has no configured branding.",
          "type": "string"
        },
        "ship_class": {
          "type": "string"
        }
      },
      "required": [
        "id"
      ],
      "type": "object"
    },
    "LeviathanContact": {
      "additionalProperties": false,
      "properties": {
        "aggressive": {
          "description": "True when this stage attacks ships at its POI. It never joins a fight already in progress.",
          "type": "boolean"
        },
        "hull": {
          "description": "Current hull. Damage carries over between fights and heals slowly out of battle.",
          "type": "integer"
        },
        "in_combat": {
          "description": "True while it is in a battle.",
          "type": "boolean"
        },
        "leviathan_id": {
          "description": "The leviathan's ID. It is the same for its whole life and is the creature_id to attack while you are at its POI.",
          "type": "string"
        },
        "max_hull": {
          "description": "Maximum hull. It grows with the leviathan's size.",
          "type": "integer"
        },
        "name": {
          "description": "Name of its current life stage, e.g. Juvenile Molt Leviathan.",
          "type": "string"
        },
        "species": {
          "description": "Leviathan species ID, e.g. molt_leviathan.",
          "type": "string"
        },
        "stage": {
          "description": "Life stage ID, e.g. hatchling, juvenile, adult, calf, or elder.",
          "type": "string"
        }
      },
      "required": [
        "leviathan_id",
        "species",
        "name",
        "stage",
        "hull",
        "max_hull",
        "aggressive",
        "in_combat"
      ],
      "type": "object",
      "x-display": {
        "id": "leviathan_id",
        "label": "name",
        "primary": [
          "species",
          "stage",
          "hull",
          "aggressive"
        ]
      }
    },
    "RepeaterInfo": {
      "additionalProperties": false,
      "properties": {
        "hull": {
          "description": "Current hull points.",
          "type": "integer"
        },
        "in_battle": {
          "description": "True while the unit is fighting.",
          "type": "boolean"
        },
        "max_hull": {
          "description": "Maximum hull points.",
          "type": "integer"
        },
        "max_shield": {
          "description": "Maximum shield points.",
          "type": "integer"
        },
        "name": {
          "description": "Display name of the unit.",
          "type": "string"
        },
        "repeater_id": {
          "description": "Combat ID of the unit: the target for the attack command. It changes each time the unit appears.",
          "type": "string"
        },
        "shield": {
          "description": "Current shield points.",
          "type": "integer"
        },
        "ship_class": {
          "description": "Ship class ID of the unit.",
          "type": "string"
        }
      },
      "required": [
        "repeater_id",
        "name",
        "ship_class",
        "hull",
        "max_hull",
        "shield",
        "max_shield",
        "in_battle"
      ],
      "type": "object"
    },
    "ScanContact": {
      "additionalProperties": false,
      "properties": {
        "cloaked": {
          "type": "boolean"
        },
        "faction_id": {
          "type": "string"
        },
        "hull": {
          "type": "integer"
        },
        "revealed_info": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "shield": {
          "type": "integer"
        },
        "ship_class": {
          "type": "string"
        },
        "ship_name": {
          "description": "Display name of the scanned ship: the custom name its pilot set when there is one, otherwise the ship class display name. Presence of this field does not mean the hull is named. Omitted when the scan did not reach the ship_class reveal tier.",
          "type": "string"
        },
        "target_id": {
          "type": "string"
        },
        "username": {
          "type": "string"
        }
      },
      "required": [
        "target_id",
        "revealed_info"
      ],
      "type": "object",
      "x-display": {
        "id": "target_id",
        "label": "username",
        "next_actions": [
          "scan id={target_id}",
          "attack id={target_id}"
        ],
        "primary": [
          "ship_class",
          "hull",
          "shield",
          "cloaked"
        ]
      }
    },
    "ShipCargoItem": {
      "additionalProperties": false,
      "properties": {
        "item_id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "quantity": {
          "type": "integer"
        },
        "size": {
          "type": "integer"
        }
      },
      "required": [
        "item_id",
        "quantity"
      ],
      "type": "object"
    }
  }
}