{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/snipget-ai/json-schema/snipget-ai-biotech-trial-lookup-batch-response-schema.json",
  "title": "BiotechTrialLookupBatchResponse",
  "description": "Success envelope for `/v1/biotech/trial/lookup/batch` — `result` carries this utility's precise shape.",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/snipget-ai-openapi.yml#/components/schemas/BiotechTrialLookupBatchResponse",
  "properties": {
    "status": {
      "type": "string",
      "title": "Status",
      "default": "ok"
    },
    "confidence": {
      "type": "number",
      "maximum": 1.0,
      "minimum": 0.0,
      "title": "Confidence"
    },
    "result": {
      "type": "object",
      "properties": {
        "items": {
          "type": "array",
          "description": "One entry per input item, in order.",
          "items": {
            "type": "object",
            "description": "One per-input result: the input echoed back, a per-item confidence, and the result fields.",
            "properties": {
              "input": {
                "description": "The original input for this item, echoed back."
              },
              "is_valid": {
                "type": "boolean"
              },
              "why_invalid": {
                "type": "string"
              },
              "nct_id": {
                "type": "string"
              },
              "status": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "phases": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "conditions": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "interventions": {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "sponsor": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "start_date": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "completion_date": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "enrollment": {
                "anyOf": [
                  {
                    "type": "integer"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "source": {
                "type": "string"
              },
              "confidence": {
                "type": "number",
                "minimum": 0.0,
                "maximum": 1.0,
                "description": "Confidence for this item."
              }
            }
          }
        },
        "summary": {
          "type": "object",
          "description": "Aggregate counts for the batch. Always carries `total`; adds `valid`/`invalid`, `matched`/`unmatched`, `format_valid`/`format_invalid`, and `exists`/`not_exists` counts when the per-item results carry those booleans, and `errors` (count of per-item rejects) when at least one item was rejected.",
          "additionalProperties": true
        }
      },
      "required": [
        "items",
        "summary"
      ]
    },
    "meta": {
      "$ref": "#/$defs/ResponseMeta"
    }
  },
  "type": "object",
  "required": [
    "confidence",
    "result"
  ],
  "$defs": {
    "ReceiptMeta": {
      "properties": {
        "receipt_id": {
          "type": "string",
          "title": "Receipt Id"
        },
        "build": {
          "type": "string",
          "title": "Build"
        },
        "input_hash": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Input Hash"
        },
        "result_hash": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Result Hash"
        },
        "error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Error"
        },
        "message": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Message"
        }
      },
      "additionalProperties": true,
      "type": "object",
      "required": [
        "receipt_id",
        "build"
      ],
      "title": "ReceiptMeta",
      "description": "Opt-in execution receipt (ADR #68 B1) — caller-verifiable hashes.\n\nRequested with the ``include_receipt=true`` query parameter (free, like\n``include_trace``). Reproduce either hash with any RFC 8785 (JCS)\nlibrary: ``input_hash = sha256(jcs({\"tool\": <request path>, \"args\":\n<your JSON body minus include_trace/include_receipt>}))``;\n``result_hash = sha256(jcs(result))``. For deterministic tools\n(everything except the generators) the same input on the same ``build``\nreproduces ``result_hash`` — disputes are honored by replay."
    },
    "ResponseMeta": {
      "properties": {
        "version": {
          "type": "string",
          "title": "Version",
          "default": "0.1.0"
        },
        "build": {
          "type": "string",
          "title": "Build",
          "default": "575f681398a6"
        },
        "elapsed_ms": {
          "type": "integer",
          "title": "Elapsed Ms",
          "default": 0
        },
        "cost_units": {
          "type": "integer",
          "title": "Cost Units",
          "description": "Cost units charged for this call: one per item processed (a batch of N items = N; live-registry lookups bill 2 per item). A call is one request; cost units are the billing measure.",
          "default": 1
        },
        "request_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Request Id"
        },
        "trace": {
          "anyOf": [
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "title": "Trace"
        },
        "rate_limit_remaining": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Rate Limit Remaining"
        },
        "rate_limit_reset": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Rate Limit Reset"
        },
        "quota_remaining": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Quota Remaining",
          "description": "Cost units left in the plan's monthly included bucket before this call's charge lands (None on unlimited tiers)."
        },
        "quota_reset": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Quota Reset",
          "description": "Unix timestamp when the monthly included bucket resets."
        },
        "credit_remaining_usd": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Credit Remaining Usd",
          "description": "Prepaid overage-allowance balance in USD, populated once the included cost units are used up and this call is drawing on it."
        },
        "receipt": {
          "anyOf": [
            {
              "$ref": "#/$defs/ReceiptMeta"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "additionalProperties": true,
      "type": "object",
      "title": "ResponseMeta",
      "description": "Metadata attached to every successful response."
    }
  }
}