{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/verifi-cloud/json-schema/verifi-cloud-verify-state-schema.json",
  "title": "VerifyState",
  "description": "The state of one chain. verdict, explanation, and response stay null until the unlock has been passed.",
  "x-generated": "2026-11-28",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/verifi-cloud-openapi.yml#/components/schemas/VerifyState",
  "type": "object",
  "properties": {
    "verify_id": {
      "type": "string",
      "format": "uuid",
      "description": "The durable handle for this chain. Persist it."
    },
    "work_id": {
      "type": "string",
      "format": "uuid",
      "description": "Alias of verify_id, as the service-windows extension names it."
    },
    "contract_version": {
      "type": "integer",
      "enum": [
        2,
        3
      ],
      "description": "3 for chains admitted under the three-gate contract. 2 for chains that finish under the old fixed USDC prices."
    },
    "status": {
      "type": "string",
      "enum": [
        "processing",
        "ready",
        "failed",
        "completed"
      ],
      "description": "processing: admission is settling or a human is working. ready: a human answered but the result is locked. failed: stop. completed: the unlock passed and the answer is available."
    },
    "human_status": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "accepted",
        "rejected",
        "refined",
        null
      ],
      "description": "The raw human action. Null until completed."
    },
    "verdict": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "true",
        "false",
        "refined",
        null
      ],
      "description": "The parseable verdict. true: the claim holds. false: it does not. refined: the human supplied a better version in explanation. Null until completed."
    },
    "explanation": {
      "type": [
        "string",
        "null"
      ],
      "description": "The human's free text when the verdict is refined. Null until completed."
    },
    "response": {
      "type": [
        "string",
        "null"
      ],
      "description": "The raw human response text. Null until completed."
    },
    "response_time_ms": {
      "type": [
        "integer",
        "null"
      ],
      "description": "How long the human took. Null until completed."
    },
    "wallet_address": {
      "type": [
        "string",
        "null"
      ],
      "description": "The requester wallet that owns this chain."
    },
    "funding": {
      "$ref": "#/$defs/Funding"
    },
    "created_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "admitted_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "When the admission settlement was recorded and the chain entered the human queue. The windows start here. Null on the 202 of a paid admission."
    },
    "sla_deadline": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "admitted_at plus 60 minutes. An answer at or before it unlocks at the SLA price."
    },
    "grace_deadline": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "admitted_at plus 24 hours. An answer after sla_deadline and at or before it unlocks at the grace price."
    },
    "ready_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "When the human answered. It alone decides the unlock price."
    },
    "expires_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "When unanswered work fails with human_timeout. On a contract 3 chain it equals grace_deadline, the last deadline, once the chain is admitted: 24 hours after admitted_at. Chains from before contract 3 expire 60 minutes after creation. It is null on the 202 of a paid admission, because the windows have not started yet; read it from the first poll."
    },
    "responded_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "unlocked_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "When the unlock passed. Null in the unlock response itself; set on later polls."
    },
    "terms": {
      "anyOf": [
        {
          "$ref": "#/$defs/BoundTerms"
        },
        {
          "type": "null"
        }
      ],
      "description": "The terms bound at admission. Null on chains from before contract 3."
    },
    "next_action": {
      "type": "string",
      "enum": [
        "poll",
        "unlock",
        "stop",
        "done"
      ],
      "description": "What the agent should do next. Follow this instead of inferring from status."
    },
    "poll_url": {
      "type": "string",
      "description": "Present when next_action is poll."
    },
    "retry_after_seconds": {
      "type": "integer",
      "description": "Present when next_action is poll. Honor it."
    },
    "unlock_url": {
      "type": "string",
      "description": "Absolute unlock URL. Present when next_action is unlock."
    },
    "unlock": {
      "$ref": "#/$defs/UnlockAction"
    },
    "service_window": {
      "$ref": "#/$defs/ServiceWindow"
    },
    "failure": {
      "$ref": "#/$defs/FailureInfo"
    }
  },
  "$defs": {
    "BoundTerms": {
      "type": "object",
      "description": "The terms bound to this chain at admission, for the asset it was paid in. They never change afterwards.",
      "properties": {
        "version": {
          "const": 1
        },
        "terms_id": {
          "type": "string"
        },
        "windows": {
          "type": "object",
          "required": [
            "sla"
          ],
          "properties": {
            "sla": {
              "type": "object",
              "required": [
                "within_seconds"
              ],
              "properties": {
                "within_seconds": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "grace": {
              "type": "object",
              "required": [
                "within_seconds"
              ],
              "properties": {
                "within_seconds": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            }
          }
        },
        "price_basis": {
          "type": "object",
          "required": [
            "currency",
            "admission",
            "sla"
          ],
          "properties": {
            "currency": {
              "type": "string"
            },
            "admission": {
              "type": "string"
            },
            "sla": {
              "type": "string"
            },
            "grace": {
              "type": "string"
            }
          }
        },
        "network": {
          "type": "string"
        },
        "asset": {
          "type": "string"
        },
        "asset_symbol": {
          "type": "string",
          "enum": [
            "USDC",
            "EURC"
          ]
        },
        "asset_decimals": {
          "type": "integer"
        },
        "asset_eip712": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string"
            },
            "version": {
              "type": "string"
            }
          }
        },
        "admission": {
          "type": "string",
          "pattern": "^[0-9]+$"
        },
        "sla": {
          "type": "string",
          "pattern": "^[0-9]+$"
        },
        "grace": {
          "type": "string",
          "pattern": "^[0-9]+$"
        },
        "asset_binding": {
          "enum": [
            "admission_asset"
          ]
        },
        "expiry": {
          "type": "object",
          "properties": {
            "admission_credit": {
              "enum": [
                "next_admission",
                "none"
              ]
            }
          }
        },
        "cancellation": {
          "enum": [
            "none"
          ]
        },
        "conversion": {
          "type": "object",
          "required": [
            "from",
            "rate",
            "source",
            "as_of"
          ],
          "properties": {
            "from": {
              "type": "string"
            },
            "rate": {
              "type": "string"
            },
            "source": {
              "type": "string"
            },
            "as_of": {
              "type": "string"
            },
            "rounding": {
              "enum": [
                "up_to_cent",
                "none"
              ]
            }
          },
          "description": "Present on a USDC chain: how the euro prices were converted."
        }
      }
    },
    "FailureInfo": {
      "type": "object",
      "description": "Why the chain ended without a redeemable result. Present when status is failed.",
      "properties": {
        "reason": {
          "type": "string",
          "enum": [
            "human_timeout",
            "entry_not_settled",
            "processing_failed"
          ],
          "description": "human_timeout: no human answered within the last window, 24 hours after admitted_at (60 minutes for chains admitted before contract 3). entry_not_settled: the gate 1 settlement never arrived, so the chain never entered the queue."
        },
        "entry_credit_granted": {
          "type": "boolean",
          "description": "True when the wallet received one admission credit: its next admission is free, bound to the asset this chain was paid in. The credit never pays an unlock. Granted when gate 1 was actually paid with x402. When gate 1 was funded by an earned credit, that credit is returned to the wallet instead, so it is not lost."
        },
        "entry_credit_value_usdc": {
          "type": [
            "string",
            "null"
          ],
          "description": "The admission price as decimal USDC on a USDC chain, 0.00 when no credit was granted. Null on an EURC chain."
        },
        "entry_credit": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "next_admission",
            null
          ],
          "description": "What the credit covers. Null when no credit was granted. Contract 3 chains only."
        }
      }
    },
    "Funding": {
      "type": "object",
      "description": "Exactly what this chain costs and was charged, per gate. A contract 3 chain states the bound asset and every amount as a string in that asset's atomic units (6 decimals for USDC and EURC). The *_usdc fields keep their meaning, decimal USDC, on a USDC chain and are null on an EURC chain. A chain admitted before contract 3 has only the *_usdc fields, at the old fixed prices.",
      "properties": {
        "entry_source": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "initial_free",
            "failure_credit",
            "x402",
            null
          ],
          "description": "How gate 1 was funded. failure_credit: an earned admission credit, bound to the asset of the chain that earned it."
        },
        "free_use_number": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 1,
          "maximum": 5,
          "description": "Legacy field: which historical free chain this was, when funded by initial_free. Null for new chains, since free human work is no longer granted."
        },
        "asset": {
          "type": "object",
          "description": "The asset the chain is bound to. The unlock is paid in it.",
          "properties": {
            "network": {
              "type": "string"
            },
            "address": {
              "type": "string"
            },
            "symbol": {
              "type": "string",
              "enum": [
                "USDC",
                "EURC"
              ]
            },
            "decimals": {
              "type": "integer"
            }
          }
        },
        "entry_amount_atomic": {
          "type": "string",
          "description": "The admission price in the bound asset."
        },
        "entry_charged_atomic": {
          "type": "string",
          "description": "What gate 1 actually charged. 0 when an admission credit paid it."
        },
        "unlock_source": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "initial_free",
            "x402",
            null
          ],
          "description": "How the unlock was funded. Null until the result is unlocked."
        },
        "unlock_window": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "sla",
            "grace",
            null
          ],
          "description": "The window that priced the unlock. Null until the human answers."
        },
        "unlock_amount_atomic": {
          "type": "string",
          "description": "The unlock price in the bound asset. Until the human answers, the SLA amount: the most the unlock can cost."
        },
        "unlock_charged_atomic": {
          "type": "string"
        },
        "total_amount_atomic": {
          "type": "string"
        },
        "total_charged_atomic": {
          "type": "string"
        },
        "entry_list_price_usdc": {
          "type": [
            "string",
            "null"
          ]
        },
        "entry_charged_usdc": {
          "type": [
            "string",
            "null"
          ]
        },
        "unlock_list_price_usdc": {
          "type": [
            "string",
            "null"
          ]
        },
        "unlock_charged_usdc": {
          "type": [
            "string",
            "null"
          ]
        },
        "total_list_price_usdc": {
          "type": [
            "string",
            "null"
          ]
        },
        "total_charged_usdc": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "ServiceWindow": {
      "type": "object",
      "description": "Why the unlock costs what it costs. Present when status is ready on a contract 3 chain.",
      "properties": {
        "applied": {
          "type": "string",
          "enum": [
            "sla",
            "grace"
          ],
          "description": "sla if ready_at is at or before sla_deadline, otherwise grace. A boundary instant belongs to the earlier window."
        },
        "sla_deadline": {
          "type": "string",
          "format": "date-time"
        },
        "grace_deadline": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "network": {
          "type": "string"
        },
        "asset": {
          "type": "string"
        },
        "unlock_amount": {
          "type": "string",
          "description": "The one unlock amount, in the bound asset's atomic units."
        }
      }
    },
    "UnlockAction": {
      "type": "object",
      "description": "How to pass the unlock gate. Present when status is ready.",
      "properties": {
        "method": {
          "type": "string"
        },
        "url": {
          "type": "string"
        },
        "price_usdc": {
          "type": [
            "string",
            "null"
          ],
          "description": "The unlock price in decimal USDC on a USDC chain. Null on an EURC chain."
        },
        "payment_required": {
          "type": "boolean",
          "description": "False only for a legacy chain whose unlock a free entitlement covers."
        },
        "funded_by": {
          "type": "string",
          "enum": [
            "initial_free",
            "x402"
          ]
        },
        "network": {
          "type": "string"
        },
        "asset": {
          "type": "string",
          "description": "The bound asset."
        },
        "asset_symbol": {
          "type": "string",
          "enum": [
            "USDC",
            "EURC"
          ]
        },
        "amount_atomic": {
          "type": "string",
          "description": "The unlock amount in atomic units. Equals service_window.unlock_amount."
        },
        "amount_decimal": {
          "type": "string"
        },
        "applied_window": {
          "type": "string",
          "enum": [
            "sla",
            "grace"
          ]
        }
      }
    }
  }
}