{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/detectif-ai/json-schema/detectif-ai-verify-response-schema.json",
  "title": "VerifyResponse",
  "x-generated": "2026-11-05",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_original/detectif-ai-api-openapi.json#/components/schemas/VerifyResponse",
  "properties": {
    "request_id": {
      "type": "string",
      "title": "Request Id"
    },
    "operation_id": {
      "type": "string",
      "title": "Operation Id"
    },
    "object": {
      "type": "string",
      "const": "speaker.verification",
      "title": "Object"
    },
    "speaker_id": {
      "type": "string",
      "title": "Speaker Id"
    },
    "result": {
      "$ref": "#/$defs/VerifyResult"
    },
    "deepfake": {
      "anyOf": [
        {
          "$ref": "#/$defs/EmbeddedDeepfake"
        },
        {
          "$ref": "#/$defs/EmbeddedDeepfakeError"
        },
        {
          "type": "null"
        }
      ],
      "title": "Deepfake",
      "description": "null unless detect_deepfake=true; then either the synthetic-speech result or its error."
    },
    "model": {
      "$ref": "#/$defs/ModelInfo"
    },
    "credits": {
      "$ref": "#/$defs/CreditsCharged"
    },
    "latency_ms": {
      "type": "number",
      "title": "Latency Ms"
    },
    "idempotent_replay": {
      "type": "boolean",
      "title": "Idempotent Replay"
    }
  },
  "type": "object",
  "required": [
    "request_id",
    "operation_id",
    "object",
    "speaker_id",
    "result",
    "deepfake",
    "model",
    "credits",
    "latency_ms",
    "idempotent_replay"
  ],
  "$defs": {
    "CreditsCharged": {
      "properties": {
        "charged": {
          "type": "integer",
          "title": "Charged",
          "description": "Credits used by this request. A repeated request with the same Idempotency-Key uses none: it reports 0 here and what the original request used in `original_charge`."
        },
        "balance": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Balance",
          "description": "Your available credits after this request; null on the unlimited plan."
        },
        "original_charge": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Original Charge",
          "description": "Only on repeated requests (`charged` is then 0): the credits the original request used."
        },
        "unlimited": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "title": "Unlimited",
          "description": "Present (true) only for accounts on the unlimited plan, where checks use no credits."
        }
      },
      "type": "object",
      "required": [
        "charged",
        "balance"
      ],
      "title": "CreditsCharged"
    },
    "EmbeddedDeepfake": {
      "properties": {
        "verdict": {
          "type": "string",
          "enum": [
            "real",
            "fake",
            "not_sure"
          ],
          "title": "Verdict",
          "description": "The decision: `real` or `fake` (AI-generated). Always one of these two. (`not_sure` stays in the list of values only so that older clients keep working; it is never returned.)"
        },
        "label": {
          "type": "string",
          "enum": [
            "synthetic",
            "genuine",
            "uncertain"
          ],
          "title": "Label",
          "description": "The same decision in the older wording: `synthetic` (fake) or `genuine` (real). (`uncertain` is never returned.)"
        },
        "is_synthetic": {
          "type": "boolean",
          "title": "Is Synthetic",
          "description": "true only when the verdict is `fake`."
        },
        "score": {
          "type": "number",
          "maximum": 1.0,
          "minimum": 0.0,
          "title": "Score",
          "description": "How likely the recording is AI-generated, from 0 to 1."
        },
        "threshold": {
          "type": "number",
          "title": "Threshold",
          "description": "Deprecated: kept for older clients. Decide with `verdict`.",
          "deprecated": true
        },
        "score_semantics": {
          "type": "string",
          "title": "Score Semantics",
          "description": "A short reminder of what `score` means."
        },
        "duration_seconds": {
          "type": "number",
          "title": "Duration Seconds",
          "description": "Length of the checked audio, in seconds."
        },
        "scored_seconds": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Scored Seconds",
          "description": "Seconds of audio the verdict is based on (all of the checked audio). At least 10 seconds of speech gives the most reliable verdicts."
        },
        "segments": {
          "items": {
            "$ref": "#/$defs/Segment"
          },
          "type": "array",
          "title": "Segments",
          "description": "Scores for consecutive, overlapping parts of the recording."
        },
        "operation_id": {
          "type": "string",
          "title": "Operation Id"
        },
        "credits_charged": {
          "type": "integer",
          "title": "Credits Charged"
        },
        "model": {
          "$ref": "#/$defs/ModelInfo"
        }
      },
      "type": "object",
      "required": [
        "verdict",
        "label",
        "is_synthetic",
        "score",
        "threshold",
        "score_semantics",
        "duration_seconds",
        "segments",
        "operation_id",
        "credits_charged",
        "model"
      ],
      "title": "EmbeddedDeepfake"
    },
    "EmbeddedDeepfakeError": {
      "properties": {
        "error": {
          "$ref": "#/$defs/ErrorDetail"
        },
        "operation_id": {
          "type": "string",
          "title": "Operation Id"
        },
        "credits_charged": {
          "type": "integer",
          "title": "Credits Charged",
          "default": 0
        }
      },
      "type": "object",
      "required": [
        "error",
        "operation_id"
      ],
      "title": "EmbeddedDeepfakeError"
    },
    "ErrorDetail": {
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "invalid_request",
            "authentication",
            "permission",
            "not_found",
            "conflict",
            "rate_limited",
            "insufficient_credits",
            "payload_too_large",
            "unsupported_media",
            "unprocessable_audio",
            "overloaded",
            "internal"
          ],
          "title": "Type"
        },
        "code": {
          "type": "string",
          "title": "Code",
          "description": "Stable snake_case error code."
        },
        "message": {
          "type": "string",
          "title": "Message",
          "description": "Human-readable explanation. Do not parse."
        },
        "param": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Param",
          "description": "The request field the error refers to, if any."
        }
      },
      "type": "object",
      "required": [
        "type",
        "code",
        "message"
      ],
      "title": "ErrorDetail"
    },
    "ModelInfo": {
      "properties": {
        "name": {
          "type": "string",
          "title": "Name",
          "description": "Model family: `aletheia` (deepfake detection) or `eidos` (speaker verification)."
        },
        "version": {
          "type": "string",
          "title": "Version",
          "description": "Model version, for example `2026.10`; it changes whenever the model is updated."
        }
      },
      "type": "object",
      "required": [
        "name",
        "version"
      ],
      "title": "ModelInfo"
    },
    "Segment": {
      "properties": {
        "start": {
          "type": "number",
          "title": "Start",
          "description": "Start of this part of the recording, in seconds."
        },
        "end": {
          "type": "number",
          "title": "End",
          "description": "End of this part of the recording, in seconds."
        },
        "score": {
          "type": "number",
          "maximum": 1.0,
          "minimum": 0.0,
          "title": "Score",
          "description": "How likely this part is synthetic (0 to 1)."
        },
        "verdict": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "real",
                "fake"
              ]
            },
            {
              "type": "null"
            }
          ],
          "title": "Verdict",
          "description": "Whether this part on its own sounds AI-generated: `fake` or `real`. The recording's `verdict` is the decision for the whole recording. Absent in results from before 29 October 2026."
        }
      },
      "type": "object",
      "required": [
        "start",
        "end",
        "score"
      ],
      "title": "Segment"
    },
    "VerifyResult": {
      "properties": {
        "decision": {
          "type": "string",
          "enum": [
            "match",
            "no_match"
          ],
          "title": "Decision",
          "description": "`match` or `no_match`. Decide with this field."
        },
        "similarity": {
          "type": "number",
          "maximum": 1.0,
          "minimum": -1.0,
          "title": "Similarity",
          "description": "How alike the two voices are, from -1 to 1 (higher is more alike)."
        },
        "threshold": {
          "type": "number",
          "title": "Threshold",
          "description": "Deprecated: kept for older clients. Decide with `decision`.",
          "deprecated": true
        },
        "similarity_semantics": {
          "type": "string",
          "title": "Similarity Semantics",
          "description": "A short reminder of what `similarity` means."
        },
        "duration_seconds": {
          "type": "number",
          "title": "Duration Seconds",
          "description": "Length of the checked audio, in seconds."
        }
      },
      "type": "object",
      "required": [
        "decision",
        "similarity",
        "threshold",
        "similarity_semantics",
        "duration_seconds"
      ],
      "title": "VerifyResult"
    }
  }
}