{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/zyphe-com/json-schema/zyphe-com-tm-ingest-transaction-request-schema.json",
  "title": "TmIngestTransactionRequest",
  "description": "Ingest one transaction event for monitoring.\n\nUnknown fields are rejected: a misspelled field name makes the request fail instead of being\nsilently ignored.",
  "x-generated": "2026-11-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/zyphe-com-openapi.json#/components/schemas/TmIngestTransactionRequest",
  "type": "object",
  "required": [
    "externalId",
    "identityId",
    "direction",
    "amountMinor",
    "currency",
    "occurredAt"
  ],
  "properties": {
    "amountMinor": {
      "type": "integer",
      "format": "int64",
      "description": "Integer minor units (e.g. cents) — no float money."
    },
    "channel": {
      "type": [
        "string",
        "null"
      ],
      "description": "e.g. `card`, `sepa`, `onchain`."
    },
    "counterparty": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/$defs/TmCounterpartyRequest"
        }
      ]
    },
    "currency": {
      "type": "string",
      "description": "ISO 4217 alpha-3 (letters only, e.g. `EUR`). Uppercase on the wire; any case accepted."
    },
    "description": {
      "type": [
        "string",
        "null"
      ],
      "description": "Payment reference / free-text description (SEPA *causale*) — the keyword-screening surface."
    },
    "direction": {
      "$ref": "#/$defs/TmTransactionDirection"
    },
    "externalId": {
      "type": "string",
      "description": "Client-side transaction id — the idempotency key per organization: replaying the same\n`externalId` returns the original result without re-evaluating or double-billing."
    },
    "externalUserId": {
      "type": [
        "string",
        "null"
      ],
      "description": "Optional client-side user reference (passthrough)."
    },
    "identityId": {
      "type": "string",
      "format": "uuid",
      "description": "The monitored (verified) identity this event belongs to."
    },
    "metadata": {
      "description": "Arbitrary client metadata, persisted verbatim for audit/replay."
    },
    "occurredAt": {
      "type": "string",
      "format": "date-time",
      "description": "Client event time. Rejected if more than 24h in the future — a small clock-skew\nallowance, not an invitation to backdate/forward-date events."
    },
    "originCountry": {
      "type": [
        "string",
        "null"
      ],
      "description": "ISO 3166-1 alpha-2 — the monitored identity's side (defaults to the org's operating\ncountry semantics; overridable per event for multi-country books)."
    },
    "rail": {
      "type": [
        "string",
        "null"
      ],
      "description": "Provider/rail (`open_banking`, `sepa`, `card`, …)."
    },
    "referenceDocumentId": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid",
      "description": "Attached invoice/document reference."
    }
  },
  "additionalProperties": false,
  "$defs": {
    "TmCounterpartyKind": {
      "type": "string",
      "description": "Counterparty node type.",
      "enum": [
        "PERSON",
        "ORGANIZATION",
        "ACCOUNT",
        "WALLET"
      ]
    },
    "TmCounterpartyRequest": {
      "type": "object",
      "description": "Counterparty leg of an ingest request.",
      "properties": {
        "address": {
          "type": [
            "string",
            "null"
          ],
          "description": "Account/IBAN/wallet identifier — the canonical join key for \"same counterparty across\nidentities\" derives from it. This becomes a unique-index key, so it is capped well below\nany DB index limit."
        },
        "country": {
          "type": [
            "string",
            "null"
          ],
          "description": "ISO 3166-1 alpha-2; derived from the IBAN prefix of `address` when omitted."
        },
        "kind": {
          "$ref": "#/$defs/TmCounterpartyKind"
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "additionalProperties": false
    },
    "TmTransactionDirection": {
      "type": "string",
      "description": "Direction of a monitored transaction relative to the monitored identity.",
      "enum": [
        "DEPOSIT",
        "WITHDRAWAL",
        "TRANSFER"
      ]
    }
  }
}