{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/licium-ai/json-schema/licium-ai-owned-settlement-schema.json",
  "title": "OwnedSettlement",
  "x-generated": "2026-11-15",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/licium-ai-openapi.json#/components/schemas/OwnedSettlement",
  "type": "object",
  "required": [
    "id",
    "criteria",
    "criteria_origin",
    "amount_usd",
    "currency",
    "counterparty_label",
    "counterparty_url",
    "deadline_at",
    "status",
    "funding_rail",
    "funded",
    "passed_at",
    "veto_deadline_at",
    "veto_open",
    "veto_reason",
    "released_at",
    "refunded_at",
    "refund_pending",
    "flipped_bounty_id",
    "created_at",
    "release_not_before",
    "payment_reversal"
  ],
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "criteria": {
      "type": "object",
      "description": "The pinned checks snapshot: { checks, template_id, template_version, origin }."
    },
    "criteria_origin": {
      "type": "string",
      "enum": [
        "buyer_pinned",
        "template",
        "saved_contract"
      ]
    },
    "amount_usd": {
      "type": "number",
      "minimum": 1
    },
    "currency": {
      "type": "string",
      "const": "usd"
    },
    "counterparty_label": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "counterparty_url": {
      "type": "string",
      "format": "uri",
      "description": "The private link the counterparty uses to upload a file."
    },
    "deadline_at": {
      "type": "string",
      "format": "date-time"
    },
    "status": {
      "type": "string",
      "enum": [
        "created",
        "funded",
        "passed",
        "released",
        "vetoed",
        "expired",
        "refunded",
        "flipped"
      ]
    },
    "funding_rail": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "stripe",
            "x402",
            "balance"
          ]
        },
        {
          "type": "null"
        }
      ]
    },
    "funded": {
      "type": "boolean",
      "description": "True once the escrow is held."
    },
    "passed_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "veto_deadline_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "veto_open": {
      "type": "boolean",
      "description": "True while a passed settlement can still be vetoed."
    },
    "veto_reason": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "released_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "refunded_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "refund_pending": {
      "type": "boolean",
      "description": "A refund started and has not finished (a USDC return in flight)."
    },
    "flipped_bounty_id": {
      "anyOf": [
        {
          "type": "string",
          "format": "uuid"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "release_not_before": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "description": "After a pass, the earliest release time: the end of the 24-hour veto window, or 7 days after funding when the escrow was paid by card or by a balance bought with a card."
    },
    "payment_reversal": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "refund",
            "dispute"
          ]
        },
        {
          "type": "null"
        }
      ],
      "description": "The card payment behind this settlement was refunded or disputed. The money went back to the card and the settlement never releases."
    },
    "latest_check": {
      "description": "GET /v1/settlements/{id} only: the newest file the counterparty ran through the pinned checks, or null. Licium keeps the file's sha256 fingerprint, not the file.",
      "anyOf": [
        {
          "type": "object",
          "required": [
            "verdict",
            "checked_at",
            "file_fingerprint",
            "checks"
          ],
          "properties": {
            "verdict": {
              "type": "string",
              "enum": [
                "pass",
                "fail"
              ]
            },
            "checked_at": {
              "type": "string",
              "format": "date-time"
            },
            "file_fingerprint": {
              "type": "string",
              "description": "sha256 of the checked file, hex."
            },
            "checks": {
              "type": "array",
              "items": {
                "type": "object",
                "required": [
                  "check_id",
                  "label",
                  "passed"
                ],
                "properties": {
                  "check_id": {
                    "type": "string"
                  },
                  "label": {
                    "type": "string"
                  },
                  "passed": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "additionalProperties": false
}