{
  "openapi": "3.1.0",
  "info": {
    "title": "delta mandate Verifier API",
    "description": "API for querying intent outcomes and retrieving zero-knowledge proofs. The Verifier receives proof results from the Orchestrator and exposes them here.",
    "license": {
      "name": "delta mandate Evaluation License",
      "url": "/license"
    },
    "version": "0.4.1"
  },
  "paths": {
    "/intents/{intent_id}": {
      "get": {
        "tags": [
          "intents"
        ],
        "description": "Get the current status of an intent.\n\nReturns the outcome once the Orchestrator has finished: success with the fulfilled intent and proposal, failure with a reason, or expiry.",
        "operationId": "intents/get",
        "parameters": [
          {
            "name": "intent_id",
            "in": "path",
            "description": "Intent ID",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/IntentId"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Intent status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntentStatus"
                }
              }
            }
          },
          "404": {
            "description": "Intent not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/proofs/{intent_id}": {
      "get": {
        "tags": [
          "proofs"
        ],
        "description": "Get the proof for an intent, if proving succeeded.\n\nOnly available once the Orchestrator has successfully completed verification.",
        "operationId": "proofs/get",
        "parameters": [
          {
            "name": "intent_id",
            "in": "path",
            "description": "Intent ID",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/IntentId"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Proof",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Proof"
                }
              }
            }
          },
          "404": {
            "description": "Proof not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "BaseSignedMessage": {
        "type": "object",
        "description": "A user-signed message",
        "required": [
          "payload",
          "signature"
        ],
        "properties": {
          "payload": {
            "$ref": "#/components/schemas/Intent",
            "description": "The data payload that is being signed."
          },
          "signature": {
            "$ref": "#/components/schemas/Signature",
            "description": "The signature corresponding to the above."
          }
        }
      },
      "EcdsaPubKey": {
        "type": "string",
        "description": "ECDSA Public Key"
      },
      "EcdsaSignature": {
        "type": "string",
        "description": "ECDSA signature"
      },
      "Ed25519PubKey": {
        "type": "string",
        "description": "Base58-encoded Ed25519 public key (32 bytes)"
      },
      "Ed25519Scheme": {
        "type": "object",
        "description": "Represents an Ed25519 signature with its public signer",
        "required": [
          "pub_key",
          "signature"
        ],
        "properties": {
          "pub_key": {
            "$ref": "#/components/schemas/Ed25519PubKey",
            "description": "The [PubKey] of the signer"
          },
          "signature": {
            "$ref": "#/components/schemas/Ed25519Signature",
            "description": "The [Signature]"
          }
        }
      },
      "Ed25519Signature": {
        "type": "string",
        "description": "Base58-encoded Ed25519 signature bytes (64 bytes)"
      },
      "ErrorResponse": {
        "type": "object",
        "required": [
          "message"
        ],
        "properties": {
          "message": {
            "type": "string"
          }
        }
      },
      "HashDigest": {
        "type": "string",
        "description": "Base58-encoded SHA-256 hash digest (32 bytes)"
      },
      "InputMap": {
        "type": "object",
        "description": "Runtime input container, as defined in docs/API.md section 2.",
        "required": [
          "fields"
        ],
        "properties": {
          "fields": {
            "type": "object",
            "additionalProperties": {},
            "propertyNames": {
              "type": "string"
            }
          }
        }
      },
      "Intent": {
        "type": "object",
        "description": "A user's expression of intent: a template instantiated with concrete\nattribute values.\n\nThe intent specifies what the user wants to happen (`template_id`) and the\nconstraints on how it may be fulfilled (`attrs`). Intents are always\nsubmitted as a `SignedIntent` to prove authorship.",
        "required": [
          "id",
          "attrs",
          "template_id"
        ],
        "properties": {
          "attrs": {
            "$ref": "#/components/schemas/InputMap",
            "description": "Attribute values that parameterize the template."
          },
          "id": {
            "$ref": "#/components/schemas/IntentId",
            "description": "Unique identifier for this intent."
          },
          "template_id": {
            "$ref": "#/components/schemas/HashDigest",
            "description": "ID of the template that defines the rules for fulfilling this intent."
          }
        }
      },
      "IntentId": {
        "type": "string",
        "format": "uuid",
        "description": "Unique identifier for an intent, assigned by the caller."
      },
      "IntentStatus": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "intent",
              "proposal",
              "status"
            ],
            "properties": {
              "intent": {
                "$ref": "#/components/schemas/Intent"
              },
              "proposal": {
                "$ref": "#/components/schemas/Proposal"
              },
              "status": {
                "type": "string",
                "enum": [
                  "success"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "reason",
              "proposal",
              "status"
            ],
            "properties": {
              "proposal": {
                "$ref": "#/components/schemas/Proposal"
              },
              "reason": {
                "type": "string"
              },
              "status": {
                "type": "string",
                "enum": [
                  "failure"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "status"
            ],
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "expired"
                ]
              }
            }
          }
        ],
        "description": "The outcome of an intent's proving process."
      },
      "MultisigPubKey": {
        "type": "object",
        "description": "Represents the public parameters of a multisignature authotization policy.\n\nDefines the weight each key is associated with, and the minimal threshold\nabove which a subset of signers can emit a valid signature.\n\nEach [PubKey] defines a unique owner.",
        "required": [
          "signers",
          "threshold"
        ],
        "properties": {
          "signers": {
            "type": "object",
            "description": "The list of signers and their associated weight"
          },
          "threshold": {
            "$ref": "#/components/schemas/u64",
            "description": "The threshold above which a subset of the signers can emit a valid signature"
          }
        }
      },
      "MultisigScheme": {
        "type": "object",
        "description": "Multisignature scheme: a set of individual signatures collectively satisfying a threshold policy.",
        "required": [
          "signatures",
          "pub_key"
        ],
        "properties": {
          "pub_key": {
            "$ref": "#/components/schemas/MultisigPubKey",
            "description": "The multisig descriptor to be checked against"
          },
          "signatures": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Signature"
            },
            "description": "The list of signatures"
          }
        }
      },
      "PasskeyScheme": {
        "type": "object",
        "description": "Signature signed by a passkey (signer) device",
        "required": [
          "pub_key",
          "signature",
          "client_data",
          "authenticator_data"
        ],
        "properties": {
          "authenticator_data": {
            "type": "string",
            "description": "The bs58-encoded bytes of the [authenticator\ndata](https://www.w3.org/TR/webauthn-3/#authenticator-data)."
          },
          "client_data": {
            "type": "string",
            "description": "String containing the [client data] JSON.\n\nThis field is a string because JSON does not define property order, and\nwe must guarantee that the UTF8 bytes of this string are exactly the\nsame as those used by the passkey device.\n\n[client data]: https://www.w3.org/TR/webauthn-3/#dictdef-collectedclientdata"
          },
          "pub_key": {
            "$ref": "#/components/schemas/EcdsaPubKey"
          },
          "signature": {
            "$ref": "#/components/schemas/EcdsaSignature"
          }
        }
      },
      "Proof": {
        "type": "object",
        "required": [
          "sp1_proof",
          "evidence",
          "signed_intent",
          "proposal"
        ],
        "properties": {
          "evidence": {
            "$ref": "#/components/schemas/InputMap"
          },
          "proposal": {
            "$ref": "#/components/schemas/Proposal"
          },
          "signed_intent": {
            "$ref": "#/components/schemas/BaseSignedMessage"
          },
          "sp1_proof": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            },
            "description": "Serialized `sp1_sdk::SP1ProofWithPublicValues`."
          }
        }
      },
      "Proposal": {
        "type": "object",
        "description": "An agent's proposed solution for a specific intent.\n\nOnce submitted, the Orchestrator fetches the URL and runs ZK proof generation to\nverify the proposal satisfies the intent's template constraints.",
        "required": [
          "intent_id",
          "url"
        ],
        "properties": {
          "intent_id": {
            "$ref": "#/components/schemas/IntentId",
            "description": "The ID of the intent this proposal targets."
          },
          "url": {
            "type": "string",
            "description": "URL pointing to the proposed solution payload that the Orchestrator will fetch\nand verify."
          }
        }
      },
      "Signature": {
        "oneOf": [
          {
            "type": "object",
            "description": "Ed25519 signature",
            "required": [
              "Ed25519"
            ],
            "properties": {
              "Ed25519": {
                "$ref": "#/components/schemas/Ed25519Scheme",
                "description": "Ed25519 signature"
              }
            }
          },
          {
            "type": "object",
            "description": "Passkey signature",
            "required": [
              "Passkey"
            ],
            "properties": {
              "Passkey": {
                "$ref": "#/components/schemas/PasskeyScheme",
                "description": "Passkey signature"
              }
            }
          },
          {
            "type": "object",
            "description": "Multisig signature",
            "required": [
              "Multisig"
            ],
            "properties": {
              "Multisig": {
                "$ref": "#/components/schemas/MultisigScheme",
                "description": "Multisig signature"
              }
            }
          }
        ],
        "description": "A generic verifiable signature.\n\nEach variant contains a specific signature scheme, which itself contains all the necessary\ndata to verify the signature."
      },
      "u64": {
        "type": "integer",
        "format": "int64",
        "minimum": 0
      }
    }
  },
  "tags": [
    {
      "name": "intents",
      "description": "Query the status of intents.\n\nAn intent transitions from pending to success, failure, or expired as the Orchestrator processes it."
    },
    {
      "name": "proofs",
      "description": "Fetch proof data.\n\nProofs are available only for intents that have been successfully proven."
    }
  ]
}