id: thehive
name: TheHive
version: 1.0.0
description: "TheHive (case-management API v1) — SOC case handling: create/read/update/search cases, create tasks, create and read alerts, promote an alert to a case, and add observables. Bearer (API key) authentication; stdlib-only, no extra Python dependencies. Targets TheHive 5."
changelog: "1.0.0 — Initial release: case create/get/update/search, create task, alert create/get/promote, add observable."
category: case_management

# Per-instance configuration. The API key is sent as 'Authorization: Bearer <api_key>'.
config_schema:
  properties:
    base_url:
      type: string
      description: "TheHive URL (e.g. https://thehive.example.com:9000)"
    api_key:
      type: string
      description: "TheHive API key"
      x-soar-sensitive: true
  required:
    - base_url
    - api_key

commands:
  - id: create_case
    name: thehive-create-case
    description: "Create a case."
    inputs_schema:
      properties:
        title: { type: string, description: "Case title" }
        description: { type: string, description: "Case description" }
        severity: { type: number, description: "1 (low) - 4 (critical), default 2" }
        tlp: { type: number, description: "TLP 0 (white) - 4 (red), default 2" }
        tags: { type: string, description: "Comma-separated tags" }
      required: [title, description]
    outputs_schema: { properties: {} }
  - id: get_case
    name: thehive-get-case
    description: "Get a case by ID."
    risk: read
    inputs_schema:
      properties:
        case_id: { type: string, description: "Case ID" }
      required: [case_id]
    outputs_schema: { properties: {} }
  - id: update_case
    name: thehive-update-case
    description: "Update a case (status, severity, or assignee)."
    inputs_schema:
      properties:
        case_id: { type: string, description: "Case ID" }
        status: { type: string, description: "New status (e.g. Open, Resolved)" }
        severity: { type: number, description: "1-4" }
        assignee: { type: string, description: "Assignee login" }
      required: [case_id]
    outputs_schema: { properties: {} }
  - id: search_cases
    name: thehive-search-cases
    description: "Search cases with a free-text query."
    risk: read
    inputs_schema:
      properties:
        query: { type: string, description: "Free-text keyword to match in title/description" }
        limit: { type: number, description: "Max cases (default 50)" }
      required: []
    outputs_schema: { properties: {} }
  - id: create_task
    name: thehive-create-task
    description: "Add a task to a case."
    inputs_schema:
      properties:
        case_id: { type: string, description: "Case ID" }
        title: { type: string, description: "Task title" }
        description: { type: string, description: "Task description" }
      required: [case_id, title]
    outputs_schema: { properties: {} }
  - id: create_alert
    name: thehive-create-alert
    description: "Create an alert."
    inputs_schema:
      properties:
        title: { type: string, description: "Alert title" }
        description: { type: string, description: "Alert description" }
        type: { type: string, description: "Alert type (e.g. external)" }
        source: { type: string, description: "Alert source" }
        source_ref: { type: string, description: "Unique source reference" }
        severity: { type: number, description: "1-4, default 2" }
      required: [title, description, type, source, source_ref]
    outputs_schema: { properties: {} }
  - id: get_alert
    name: thehive-get-alert
    description: "Get an alert by ID."
    risk: read
    inputs_schema:
      properties:
        alert_id: { type: string, description: "Alert ID" }
      required: [alert_id]
    outputs_schema: { properties: {} }
  - id: promote_alert
    name: thehive-promote-alert
    description: "Promote an alert to a case."
    inputs_schema:
      properties:
        alert_id: { type: string, description: "Alert ID" }
      required: [alert_id]
    outputs_schema: { properties: {} }
  - id: add_observable
    name: thehive-add-observable
    description: "Add an observable to a case."
    inputs_schema:
      properties:
        case_id: { type: string, description: "Case ID" }
        data_type: { type: string, description: "Observable type (ip, domain, url, hash, mail, ...)" }
        data: { type: string, description: "Observable value" }
        message: { type: string, description: "Optional note" }
        ioc: { type: boolean, description: "Mark as IOC (default false)" }
      required: [case_id, data_type, data]
    outputs_schema: { properties: {} }

  - id: test_connection
    name: thehive-test-connection
    description: "Verify connectivity and the API key (used by the Test button)."
    risk: read
    inputs_schema:
      properties: {}
      required: []
    outputs_schema: { properties: {} }
