{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/proof-holdings/json-schema/proof-holdings-verification-request-schema.json",
  "title": "VerificationRequest",
  "description": "Multi-asset verification request",
  "x-generated": "2026-11-22",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/proof-holdings-openapi.json#/components/schemas/VerificationRequest",
  "type": "object",
  "properties": {
    "id": {
      "$ref": "#/$defs/ObjectId"
    },
    "reference_id": {
      "type": "string"
    },
    "status": {
      "$ref": "#/$defs/VerificationRequestStatus"
    },
    "computed_state": {
      "type": "object",
      "properties": {
        "status": {
          "$ref": "#/$defs/VerificationRequestStatus"
        },
        "is_expiring_soon": {
          "type": "boolean",
          "description": "Whether this request is close enough to `expires_at` to act on — and the WINDOW depends on which side of the request is reading, so one row can honestly answer differently on two surfaces. Read `next_action.role` to know which answer you have. For a `requester` the window is the lesser of 24h and HALF the request's own lifetime, so a just-created short-lived request is NOT \"expiring soon\" (advising a reminder before the recipient has had any time is the case this excludes). For a `recipient` the window is a flat 24h, because they already hold the link and what matters is the deadline itself."
        },
        "next_action": {
          "type": "object",
          "properties": {
            "code": {
              "type": "string"
            },
            "role": {
              "type": "string",
              "enum": [
                "requester",
                "recipient"
              ]
            },
            "label": {
              "type": "string"
            }
          },
          "required": [
            "code",
            "role",
            "label"
          ]
        }
      },
      "required": [
        "status",
        "is_expiring_soon",
        "next_action"
      ],
      "description": "Additive machine-readable effective state: re-derives expiry from expires_at (never trusts the stored status). BOTH `is_expiring_soon` and `next_action` are role-aware — `next_action.role` says which side this envelope was computed for, and the two fields are consistent within it. Present only on authenticated owner/requester and recipient responses; absent on public/third-party surfaces."
    },
    "assets": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "type": {
            "$ref": "#/$defs/VerificationType"
          },
          "identifier": {
            "type": [
              "string",
              "null"
            ]
          },
          "channel": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "whatsapp",
              "telegram",
              "sms",
              "email",
              "dns",
              "http",
              "auto",
              "github",
              "google",
              "facebook",
              "x",
              "linkedin",
              "instagram",
              "youtube",
              "tiktok",
              "ethereum",
              "solana",
              "bitcoin",
              "coinbase",
              "kraken",
              "telegram_bot_token",
              null
            ],
            "description": "Preferred verification channel"
          },
          "allowed_channels": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/$defs/VerificationChannel"
            },
            "description": "The channels this asset may be verified over, as set on the request. The backend ENFORCES it (a forbidden channel is refused with `channel_not_allowed`) and the recipient page offers only these; null or an empty array means no restriction. Echoed on owner responses so the party that sets it can read it back — the public recipient read returns the same field."
          },
          "required": {
            "type": "boolean"
          },
          "status": {
            "$ref": "#/$defs/VerificationStatus"
          },
          "verified_at": {
            "type": "string",
            "format": "date-time"
          },
          "verified_identifier": {
            "type": "string",
            "description": "The actual identifier that was verified (only present when status is verified)"
          },
          "verified_channel": {
            "type": "string",
            "enum": [
              "whatsapp",
              "telegram",
              "sms",
              "email",
              "dns",
              "http",
              "auto",
              "github",
              "google",
              "facebook",
              "x",
              "linkedin",
              "instagram",
              "youtube",
              "tiktok",
              "ethereum",
              "solana",
              "bitcoin",
              "coinbase",
              "kraken",
              "telegram_bot_token"
            ],
            "description": "The channel used for verification (only present when status is verified)"
          },
          "has_proof": {
            "type": "boolean",
            "description": "Whether a proof token was generated for this asset"
          },
          "outcome": {
            "anyOf": [
              {
                "$ref": "#/$defs/AssetOutcome"
              },
              {
                "type": "null"
              }
            ],
            "description": "Your outcome for this asset on a request created with `outcome: 'relying_party'`; null on any other request, or before the asset verifies. Absent from an API that predates the field."
          }
        },
        "required": [
          "type",
          "required",
          "status"
        ]
      }
    },
    "action_type": {
      "$ref": "#/$defs/ActionType"
    },
    "action_context": {
      "anyOf": [
        {
          "$ref": "#/$defs/ActionContext"
        },
        {
          "type": "null"
        }
      ],
      "description": "The action the person is asked to authorize; null when the request carries none"
    },
    "partial_ok": {
      "type": "boolean"
    },
    "outcome": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "relying_party",
        null
      ],
      "description": "`relying_party` when the request was created to wait for your outcome; null otherwise. Absent from an API that predates the field."
    },
    "outcome_timeout_seconds": {
      "type": [
        "integer",
        "null"
      ],
      "description": "The window set on the request, in seconds; null when it does not wait for an outcome. Absent from an API that predates the field."
    },
    "validity_requirement": {
      "type": [
        "string",
        "null"
      ],
      "description": "Required proof freshness as set on the request (e.g. \"7d\"); null when none was set"
    },
    "verification_url": {
      "type": "string",
      "description": "URL for the verification flow"
    },
    "redirect_url": {
      "type": [
        "string",
        "null"
      ]
    },
    "callback_url": {
      "type": [
        "string",
        "null"
      ],
      "description": "The webhook URL set on the request, if any"
    },
    "progress": {
      "type": "object",
      "properties": {
        "completed": {
          "type": "integer"
        },
        "completed_required": {
          "type": "integer"
        },
        "required": {
          "type": "integer"
        },
        "optional": {
          "type": "integer"
        },
        "total": {
          "type": "integer"
        }
      },
      "required": [
        "completed",
        "completed_required",
        "required",
        "optional",
        "total"
      ]
    },
    "expires_at": {
      "type": "string",
      "format": "date-time"
    },
    "completed_at": {
      "type": "string",
      "format": "date-time"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    }
  },
  "required": [
    "id",
    "status",
    "assets",
    "action_type",
    "partial_ok",
    "expires_at",
    "created_at"
  ],
  "$defs": {
    "ActionContext": {
      "type": "object",
      "properties": {
        "title": {
          "type": "string",
          "minLength": 1,
          "maxLength": 100,
          "description": "Action title (required for confirmation and custom types)"
        },
        "description": {
          "type": "string",
          "minLength": 1,
          "maxLength": 500,
          "description": "Action description with details for the approver"
        },
        "amount": {
          "type": "number",
          "exclusiveMinimum": 0,
          "description": "Monetary amount for confirmation context"
        },
        "currency": {
          "type": "string",
          "minLength": 1,
          "maxLength": 10,
          "description": "Currency code for confirmation context"
        },
        "entity": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200,
          "description": "Entity or resource being acted on"
        }
      },
      "description": "Context for custom and confirmation action types"
    },
    "ActionType": {
      "type": "string",
      "enum": [
        "verification",
        "2fa",
        "login",
        "custom",
        "confirmation",
        "authorization"
      ],
      "description": "Type of action for verification request or authorization"
    },
    "AssetOutcome": {
      "type": "object",
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "awaiting",
            "accepted",
            "refused",
            "timed_out"
          ],
          "description": "`awaiting` from the moment the asset verifies until you answer or `deadline_at` passes; then `accepted`, `refused`, or `timed_out` (no answer in time — reported as soon as the deadline passes, whether or not anything has been written)."
        },
        "reason": {
          "type": [
            "string",
            "null"
          ],
          "description": "The reason you gave with a refusal, shown to the person in the chat and on the verification page; null otherwise."
        },
        "deadline_at": {
          "type": "string",
          "format": "date-time",
          "description": "When the window for your outcome ends."
        },
        "decided_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "description": "When the outcome was decided (for `timed_out`, the deadline); null while awaiting."
        }
      },
      "required": [
        "status",
        "reason",
        "deadline_at",
        "decided_at"
      ],
      "description": "The relying party's outcome for one asset of a request created with `outcome: 'relying_party'`."
    },
    "ObjectId": {
      "type": "string",
      "pattern": "^[0-9a-fA-F]{24}$",
      "description": "MongoDB ObjectId"
    },
    "VerificationChannel": {
      "type": "string",
      "enum": [
        "whatsapp",
        "telegram",
        "sms",
        "email",
        "dns",
        "http",
        "auto",
        "github",
        "google",
        "facebook",
        "x",
        "linkedin",
        "instagram",
        "youtube",
        "tiktok",
        "ethereum",
        "solana",
        "bitcoin",
        "coinbase",
        "kraken",
        "telegram_bot_token"
      ],
      "description": "Channel used for verification. Not yet available — a create or start naming one answers 400 `channel_not_available`: github, google, facebook, x, linkedin, instagram, youtube, tiktok, ethereum, solana, bitcoin, coinbase, kraken."
    },
    "VerificationRequestStatus": {
      "type": "string",
      "enum": [
        "pending",
        "partial",
        "completed",
        "expired",
        "cancelled"
      ],
      "description": "Status of a verification request"
    },
    "VerificationStatus": {
      "type": "string",
      "enum": [
        "pending",
        "verified",
        "failed",
        "expired",
        "revoked",
        "cancelled"
      ],
      "description": "Current status of the verification"
    },
    "VerificationType": {
      "type": "string",
      "enum": [
        "phone",
        "email",
        "domain",
        "social",
        "wallet",
        "account",
        "telegram_bot"
      ],
      "description": "Type of asset being verified. Not yet available — no channel of theirs can be completed, so a create or start answers 400 `channel_not_available`: social, wallet, account."
    }
  }
}