{
  "openapi": "3.1.0",
  "info": {
    "title": "HumanMirror x402 API",
    "version": "1.0.0",
    "description": "Pay-per-call deterministic AI-agent services using x402 V2, USDC and Base mainnet. Requests without PAYMENT-SIGNATURE return HTTP 402 with PAYMENT-REQUIRED."
  },
  "servers": [
    {
      "url": "https://humanmirror.fr"
    }
  ],
  "paths": {
    "/api/x402/outcome/": {
      "post": {
        "operationId": "humanmirrorX402Outcome",
        "summary": "Buy one deterministic verified outcome",
        "description": "0.010 USDC on Base. Settlement is requested only after HumanMirror deterministic verification succeeds.",
        "parameters": [
          {
            "name": "PAYMENT-SIGNATURE",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "x402 V2 signed payment payload. Omit on first request to receive payment requirements."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "outcome_type": {
                    "type": "string",
                    "enum": [
                      "clean_json",
                      "deduplicate_records",
                      "normalize_entity",
                      "data_quality_at_least",
                      "detect_anomalies",
                      "no_secrets",
                      "output_quality",
                      "schema_compatible",
                      "safe_preflight",
                      "execution_receipt"
                    ]
                  },
                  "objective": {
                    "type": "string"
                  },
                  "input": {},
                  "criteria": {
                    "type": "object"
                  },
                  "options": {
                    "type": "object"
                  }
                },
                "required": [
                  "input"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Verified result after successful x402 settlement"
          },
          "402": {
            "description": "Payment required; inspect PAYMENT-REQUIRED header"
          },
          "422": {
            "description": "Execution or deterministic verification failed; payment is not settled"
          },
          "503": {
            "description": "Facilitator or settlement unavailable"
          }
        }
      }
    },
    "/api/x402/one/": {
      "post": {
        "operationId": "humanmirrorX402One",
        "summary": "Buy one minimal verified-result call",
        "description": "0.012 USDC on Base.",
        "parameters": [
          {
            "name": "PAYMENT-SIGNATURE",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "outcome_type": {
                    "type": "string"
                  },
                  "objective": {
                    "type": "string"
                  },
                  "input": {},
                  "criteria": {
                    "type": "object"
                  },
                  "options": {
                    "type": "object"
                  }
                },
                "required": [
                  "input"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Verified result"
          },
          "402": {
            "description": "Payment required"
          }
        }
      }
    },
    "/api/x402/flow/": {
      "post": {
        "operationId": "humanmirrorX402Flow",
        "summary": "Buy a verified 2–3 step deterministic mission",
        "description": "0.024 USDC on Base. Settlement occurs only after all steps and final proof succeed.",
        "parameters": [
          {
            "name": "PAYMENT-SIGNATURE",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "steps": {
                    "type": "array",
                    "minItems": 2,
                    "maxItems": 3,
                    "items": {
                      "type": "object",
                      "properties": {
                        "outcome_type": {
                          "type": "string"
                        },
                        "objective": {
                          "type": "string"
                        },
                        "input_from": {
                          "type": "string",
                          "enum": [
                            "explicit",
                            "previous"
                          ]
                        },
                        "input": {},
                        "criteria": {
                          "type": "object"
                        },
                        "options": {
                          "type": "object"
                        }
                      }
                    }
                  }
                },
                "required": [
                  "steps"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Verified mission result"
          },
          "402": {
            "description": "Payment required"
          }
        }
      }
    },
    "/api/x402/clean-json/": {
      "post": {
        "operationId": "humanmirrorX402CleanJson",
        "summary": "Clean and canonicalize JSON",
        "description": "0.010 USDC on Base. Clean and canonicalize JSON and verify stability before settlement.",
        "parameters": [
          {
            "name": "PAYMENT-SIGNATURE",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "x402 V2 signed payment payload. Omit on first request to receive PAYMENT-REQUIRED."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "input": {
                    "description": "JSON-serializable input for this deterministic outcome."
                  },
                  "criteria": {
                    "type": "object"
                  },
                  "options": {
                    "type": "object"
                  }
                },
                "required": [
                  "input"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Verified result after successful x402 settlement"
          },
          "402": {
            "description": "Payment required"
          },
          "422": {
            "description": "Execution or deterministic verification failed; no settlement"
          },
          "503": {
            "description": "Facilitator or settlement unavailable"
          }
        }
      }
    },
    "/api/x402/deduplicate-records/": {
      "post": {
        "operationId": "humanmirrorX402DeduplicateRecords",
        "summary": "Remove duplicate JSON records",
        "description": "0.010 USDC on Base. Remove duplicate records and verify zero duplicates remain.",
        "parameters": [
          {
            "name": "PAYMENT-SIGNATURE",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "x402 V2 signed payment payload. Omit on first request to receive PAYMENT-REQUIRED."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "input": {
                    "description": "JSON-serializable input for this deterministic outcome."
                  },
                  "criteria": {
                    "type": "object"
                  },
                  "options": {
                    "type": "object"
                  }
                },
                "required": [
                  "input"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Verified result after successful x402 settlement"
          },
          "402": {
            "description": "Payment required"
          },
          "422": {
            "description": "Execution or deterministic verification failed; no settlement"
          },
          "503": {
            "description": "Facilitator or settlement unavailable"
          }
        }
      }
    },
    "/api/x402/normalize-entity/": {
      "post": {
        "operationId": "humanmirrorX402NormalizeEntity",
        "summary": "Normalize entity identifiers",
        "description": "0.010 USDC on Base. Normalize names, domains, URLs and emails and verify the canonical result.",
        "parameters": [
          {
            "name": "PAYMENT-SIGNATURE",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "x402 V2 signed payment payload. Omit on first request to receive PAYMENT-REQUIRED."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "input": {
                    "description": "JSON-serializable input for this deterministic outcome."
                  },
                  "criteria": {
                    "type": "object"
                  },
                  "options": {
                    "type": "object"
                  }
                },
                "required": [
                  "input"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Verified result after successful x402 settlement"
          },
          "402": {
            "description": "Payment required"
          },
          "422": {
            "description": "Execution or deterministic verification failed; no settlement"
          },
          "503": {
            "description": "Facilitator or settlement unavailable"
          }
        }
      }
    },
    "/api/x402/data-quality/": {
      "post": {
        "operationId": "humanmirrorX402DataQuality",
        "summary": "Verify a data-quality threshold",
        "description": "0.010 USDC on Base. Measure structured-data quality and verify a declared minimum threshold.",
        "parameters": [
          {
            "name": "PAYMENT-SIGNATURE",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "x402 V2 signed payment payload. Omit on first request to receive PAYMENT-REQUIRED."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "input": {
                    "description": "JSON-serializable input for this deterministic outcome."
                  },
                  "criteria": {
                    "type": "object"
                  },
                  "options": {
                    "type": "object"
                  }
                },
                "required": [
                  "input"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Verified result after successful x402 settlement"
          },
          "402": {
            "description": "Payment required"
          },
          "422": {
            "description": "Execution or deterministic verification failed; no settlement"
          },
          "503": {
            "description": "Facilitator or settlement unavailable"
          }
        }
      }
    },
    "/api/x402/anomaly-detection/": {
      "post": {
        "operationId": "humanmirrorX402AnomalyDetection",
        "summary": "Detect numeric anomalies",
        "description": "0.010 USDC on Base. Detect numeric anomaly signals and rerun the deterministic scan before settlement.",
        "parameters": [
          {
            "name": "PAYMENT-SIGNATURE",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "x402 V2 signed payment payload. Omit on first request to receive PAYMENT-REQUIRED."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "input": {
                    "description": "JSON-serializable input for this deterministic outcome."
                  },
                  "criteria": {
                    "type": "object"
                  },
                  "options": {
                    "type": "object"
                  }
                },
                "required": [
                  "input"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Verified result after successful x402 settlement"
          },
          "402": {
            "description": "Payment required"
          },
          "422": {
            "description": "Execution or deterministic verification failed; no settlement"
          },
          "503": {
            "description": "Facilitator or settlement unavailable"
          }
        }
      }
    },
    "/api/x402/secret-scanning/": {
      "post": {
        "operationId": "humanmirrorX402SecretScanning",
        "summary": "Scan for likely secrets",
        "description": "0.010 USDC on Base. Scan payloads for likely API keys, tokens, private keys and credential-like secrets.",
        "parameters": [
          {
            "name": "PAYMENT-SIGNATURE",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "x402 V2 signed payment payload. Omit on first request to receive PAYMENT-REQUIRED."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "input": {
                    "description": "JSON-serializable input for this deterministic outcome."
                  },
                  "criteria": {
                    "type": "object"
                  },
                  "options": {
                    "type": "object"
                  }
                },
                "required": [
                  "input"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Verified result after successful x402 settlement"
          },
          "402": {
            "description": "Payment required"
          },
          "422": {
            "description": "Execution or deterministic verification failed; no settlement"
          },
          "503": {
            "description": "Facilitator or settlement unavailable"
          }
        }
      }
    },
    "/api/x402/output-quality/": {
      "post": {
        "operationId": "humanmirrorX402OutputQuality",
        "summary": "Apply an AI-output quality gate",
        "description": "0.010 USDC on Base. Apply a deterministic output-quality gate and verify a minimum trust score.",
        "parameters": [
          {
            "name": "PAYMENT-SIGNATURE",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "x402 V2 signed payment payload. Omit on first request to receive PAYMENT-REQUIRED."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "input": {
                    "description": "JSON-serializable input for this deterministic outcome."
                  },
                  "criteria": {
                    "type": "object"
                  },
                  "options": {
                    "type": "object"
                  }
                },
                "required": [
                  "input"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Verified result after successful x402 settlement"
          },
          "402": {
            "description": "Payment required"
          },
          "422": {
            "description": "Execution or deterministic verification failed; no settlement"
          },
          "503": {
            "description": "Facilitator or settlement unavailable"
          }
        }
      }
    },
    "/api/x402/schema-compatibility/": {
      "post": {
        "operationId": "humanmirrorX402SchemaCompatibility",
        "summary": "Check JSON schema compatibility",
        "description": "0.010 USDC on Base. Check JSON contract compatibility and verify breaking changes remain within the declared maximum.",
        "parameters": [
          {
            "name": "PAYMENT-SIGNATURE",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "x402 V2 signed payment payload. Omit on first request to receive PAYMENT-REQUIRED."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "input": {
                    "description": "JSON-serializable input for this deterministic outcome."
                  },
                  "criteria": {
                    "type": "object"
                  },
                  "options": {
                    "type": "object"
                  }
                },
                "required": [
                  "input"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Verified result after successful x402 settlement"
          },
          "402": {
            "description": "Payment required"
          },
          "422": {
            "description": "Execution or deterministic verification failed; no settlement"
          },
          "503": {
            "description": "Facilitator or settlement unavailable"
          }
        }
      }
    },
    "/api/x402/safe-preflight/": {
      "post": {
        "operationId": "humanmirrorX402SafePreflight",
        "summary": "Preflight a command or tool action",
        "description": "0.010 USDC on Base. Verify operational risk remains within the declared limit before settlement.",
        "parameters": [
          {
            "name": "PAYMENT-SIGNATURE",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "x402 V2 signed payment payload. Omit on first request to receive PAYMENT-REQUIRED."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "input": {
                    "description": "JSON-serializable input for this deterministic outcome."
                  },
                  "criteria": {
                    "type": "object"
                  },
                  "options": {
                    "type": "object"
                  }
                },
                "required": [
                  "input"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Verified result after successful x402 settlement"
          },
          "402": {
            "description": "Payment required"
          },
          "422": {
            "description": "Execution or deterministic verification failed; no settlement"
          },
          "503": {
            "description": "Facilitator or settlement unavailable"
          }
        }
      }
    },
    "/api/x402/execution-receipt/": {
      "post": {
        "operationId": "humanmirrorX402ExecutionReceipt",
        "summary": "Issue a verifiable execution receipt",
        "description": "0.010 USDC on Base. Issue and verify a receipt for an input/output pair.",
        "parameters": [
          {
            "name": "PAYMENT-SIGNATURE",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "x402 V2 signed payment payload. Omit on first request to receive PAYMENT-REQUIRED."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "input": {
                    "description": "JSON-serializable input for this deterministic outcome."
                  },
                  "criteria": {
                    "type": "object"
                  },
                  "options": {
                    "type": "object"
                  }
                },
                "required": [
                  "input"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Verified result after successful x402 settlement"
          },
          "402": {
            "description": "Payment required"
          },
          "422": {
            "description": "Execution or deterministic verification failed; no settlement"
          },
          "503": {
            "description": "Facilitator or settlement unavailable"
          }
        }
      }
    }
  },
  "externalDocs": {
    "description": "HumanMirror x402 manifest",
    "url": "https://humanmirror.fr/.well-known/x402.json"
  }
}
