{
  "openapi": "3.1.0",
  "info": {
    "title": "ELTAV Sovereign DeepTech Mesh API",
    "version": "2026.4.2",
    "description": "Production HTTP 402 / L402 machine-to-machine API for autonomous AI agents, enterprise provers, and WebGPU neuromorphic compute nodes.",
    "contact": {
      "name": "ELTAV LLC Developer Support",
      "url": "https://eltav.io/developers",
      "email": "contact@eltav.io"
    },
    "license": {
      "name": "Proprietary Commercial / Enterprise License",
      "url": "https://eltav.io/terms"
    }
  },
  "servers": [
    {
      "url": "https://api.eltav.io",
      "description": "Primary Production Cloud Run Gateway"
    },
    {
      "url": "https://dept-matrix-996431319688.us-central1.run.app",
      "description": "Direct Department Matrix Microservice"
    }
  ],
  "paths": {
    "/health": {
      "get": {
        "summary": "Check API Gateway and Ecosystem Health",
        "description": "Returns operational status of the 18 live ecosystem domains, WebGPU provers, and active inference clusters.",
        "operationId": "getHealth",
        "x-openai-isConsequential": false,
        "responses": {
          "200": {
            "description": "System fully operational",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "example": "OPERATIONAL"
                    },
                    "version": {
                      "type": "string",
                      "example": "2026.4.2"
                    },
                    "domainsOnline": {
                      "type": "integer",
                      "example": 18
                    },
                    "proverLatencyMs": {
                      "type": "number",
                      "example": 0.041
                    },
                    "snnFramerateFps": {
                      "type": "integer",
                      "example": 1667
                    },
                    "fepSurprisal": {
                      "type": "number",
                      "example": 0.042
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/zk/prove": {
      "post": {
        "summary": "Compute Goldilocks STARK ZK Proof",
        "description": "Generates a zero-knowledge execution trace proof over the 64-bit prime field p = 2^64 - 2^32 + 1 in ~0.041ms.",
        "operationId": "computeZkProof",
        "x-openai-isConsequential": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "traceData"
                ],
                "properties": {
                  "traceData": {
                    "type": "string",
                    "description": "Hex-encoded raw execution trace or input string",
                    "example": "0x454c5441565f534f5645524549474e"
                  },
                  "degree": {
                    "type": "integer",
                    "description": "Degree of trace polynomial",
                    "default": 65536,
                    "example": 65536
                  },
                  "friBlowup": {
                    "type": "integer",
                    "description": "FRI blowup factor",
                    "default": 8,
                    "example": 8
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Proof successfully generated",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "proofRootHash": {
                      "type": "string",
                      "example": "0x8c347d85fd6d3e60b8f8e5ca053b708a"
                    },
                    "verificationLatencyMs": {
                      "type": "number",
                      "example": 0.041
                    },
                    "fieldOps": {
                      "type": "integer",
                      "example": 65536
                    },
                    "primeField": {
                      "type": "string",
                      "example": "2^64 - 2^32 + 1"
                    },
                    "status": {
                      "type": "string",
                      "example": "VERIFIED_VALID"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required / L402 challenge issued"
          }
        }
      }
    },
    "/v1/snn/solve": {
      "post": {
        "summary": "Execute WebGPU Spiking Neural Network Graph Convergence",
        "description": "Simulates 1,000,000 LIF (Leaky Integrate-and-Fire) neurons with STDP synaptic plasticity in sub-millisecond iterations.",
        "operationId": "solveSnnGraph",
        "x-openai-isConsequential": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "neuronCount"
                ],
                "properties": {
                  "neuronCount": {
                    "type": "integer",
                    "default": 1000000,
                    "example": 1000000
                  },
                  "iterations": {
                    "type": "integer",
                    "default": 100,
                    "example": 100
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "SNN convergence state and spike raster",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "activeNeurons": {
                      "type": "integer",
                      "example": 1000000
                    },
                    "spikeCount": {
                      "type": "integer",
                      "example": 48291
                    },
                    "framerateFps": {
                      "type": "integer",
                      "example": 1667
                    },
                    "vramConsumedMb": {
                      "type": "number",
                      "example": 32
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/acoustic/modulate": {
      "post": {
        "summary": "Generate Near-Ultrasound FSK Audio Modulated Packet",
        "description": "Encodes binary payload into 18.6 kHz - 19.5 kHz audio carrier with [8,4,4] Extended SECDED error correction.",
        "operationId": "acousticModulate",
        "x-openai-isConsequential": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "payloadHex"
                ],
                "properties": {
                  "payloadHex": {
                    "type": "string",
                    "example": "0x454c544156"
                  },
                  "carrierHz": {
                    "type": "integer",
                    "default": 18600,
                    "example": 18600
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Audio packet buffer generated",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "sampleRate": {
                      "type": "integer",
                      "example": 44100
                    },
                    "durationSeconds": {
                      "type": "number",
                      "example": 0.28
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/mesh/rendezvous": {
      "post": {
        "summary": "AeroMesh P2P WebRTC Signaling Handshake",
        "description": "Exchanges ephemeral session SDP and acoustic carrier tokens for direct air-gapped device entanglement.",
        "operationId": "meshRendezvous",
        "x-openai-isConsequential": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "peerPublicKey",
                  "sdpOffer"
                ],
                "properties": {
                  "peerPublicKey": {
                    "type": "string",
                    "example": "0x04bfb0d39e..."
                  },
                  "sdpOffer": {
                    "type": "string",
                    "example": "v=0..."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Peer connection answer and ICE candidates",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "sdpAnswer": {
                      "type": "string",
                      "example": "v=0..."
                    },
                    "sessionStatus": {
                      "type": "string",
                      "example": "P2P_AEROMESH_ENTANGLED"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/x402/challenge": {
      "get": {
        "summary": "Discover HTTP 402 Agentic Challenge",
        "description": "Returns HTTP 402 Payment Required with MPP, L402, and x402 settlement challenge headers.",
        "operationId": "getX402Challenge",
        "parameters": [
          {
            "name": "tool",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "sars_m2m_license_contract"
            }
          }
        ],
        "responses": {
          "402": {
            "description": "Challenge issued. Contains challenge token and payment parameters.",
            "headers": {
              "WWW-Authenticate": {
                "schema": {
                  "type": "string"
                }
              },
              "X-402-Challenge": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/v1/x402/verify": {
      "post": {
        "summary": "Verify Payment & Issue Execution Ticket",
        "description": "Verifies Stripe Shared Payment Token (SPT) and issues single-use execution ticket for Class Gamma operations.",
        "operationId": "verifyX402Payment",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "challengeToken": {
                    "type": "string"
                  },
                  "agentId": {
                    "type": "string"
                  },
                  "capability": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Payment cleared. Execution ticket issued."
          }
        }
      }
    },
    "/v1/x402/execute": {
      "post": {
        "summary": "Execute Class Gamma WAL Saga",
        "description": "Executes 4-step atomic saga under write-ahead log reverse compensation guarantees.",
        "operationId": "executeX402Tool",
        "responses": {
          "200": {
            "description": "Saga executed successfully. Goldilocks STARK root issued."
          }
        }
      }
    },
    "/v1/x402/telemetry": {
      "get": {
        "summary": "Query M2M Telemetry & Treasury Ledger",
        "description": "Returns verified metrics on transactions executed, Stripe Treasury cleared revenue, and Goldilocks STARK roots.",
        "operationId": "getX402Telemetry",
        "responses": {
          "200": {
            "description": "Telemetry snapshot."
          }
        }
      }
    },
    "/api/agent/verify-bullion": {
      "post": {
        "summary": "NobleProofs Bullion Verification & Acoustic Assay",
        "description": "Validates precious metals via acoustic resonance frequency and intrinsic melt value.",
        "x-402-payment": {
          "priceUsd": 0.05,
          "priceSats": 100,
          "rail": "STRIPE_MPP_OR_L402",
          "headerAuth": "X-ELTAV-KEY",
          "lightningAuth": "Authorization: L402 <macaroon>:<preimage>"
        },
        "responses": {
          "200": {
            "description": "Verification succeeded with audit proof"
          },
          "402": {
            "description": "Payment Required with L402 challenge"
          }
        }
      }
    },
    "/api/agent/card-valuation": {
      "post": {
        "summary": "RelicLedger Card Valuation & Comps",
        "description": "Queries real-time median comps and valuation for PSA/BGS/SGC graded sports cards.",
        "x-402-payment": {
          "priceUsd": 0.03,
          "priceSats": 60,
          "rail": "STRIPE_MPP_OR_L402",
          "headerAuth": "X-ELTAV-KEY",
          "lightningAuth": "Authorization: L402 <macaroon>:<preimage>"
        },
        "responses": {
          "200": {
            "description": "Valuation succeeded with audit proof"
          },
          "402": {
            "description": "Payment Required with L402 challenge"
          }
        }
      }
    },
    "/tracteonCoiVerify": {
      "post": {
        "summary": "Tracteon OS Certificate of Insurance Compliance Audit",
        "description": "Audits ACORD 25 insurance certificates for subcontractor compliance.",
        "x-402-payment": {
          "priceUsd": 0.25,
          "priceSats": 500,
          "rail": "STRIPE_MPP_OR_L402",
          "headerAuth": "X-ELTAV-KEY",
          "lightningAuth": "Authorization: L402 <macaroon>:<preimage>"
        },
        "responses": {
          "200": {
            "description": "COI audit succeeded with audit proof"
          },
          "402": {
            "description": "Payment Required with L402 challenge"
          }
        }
      }
    },
    "/prepay-credits": {
      "post": {
        "summary": "Tracteon OS Autonomous Credit Prepay Checkout Session",
        "description": "Creates an authentic Stripe Checkout Session to purchase prepaid credit packs for autonomous ACORD 25 COI insurance risk auditing.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "packId": {
                    "type": "string",
                    "enum": [
                      "pack_10",
                      "pack_50",
                      "pack_250"
                    ],
                    "default": "pack_10",
                    "description": "Credit pack tier: $10 (40 audits), $50 (200 audits), or $250 (1,000 audits)"
                  },
                  "customerEmail": {
                    "type": "string",
                    "description": "Customer contact email for license receipt"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Returns Stripe checkout session URL for credit funding",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "checkoutUrl": {
                      "type": "string"
                    },
                    "sessionId": {
                      "type": "string"
                    },
                    "packId": {
                      "type": "string"
                    },
                    "credits": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/prepay-success": {
      "get": {
        "summary": "Tracteon OS Prepay Key Fulfillment & Credit Allocation",
        "description": "Verifies completed Stripe checkout session and provisions API key credits into Firestore.",
        "parameters": [
          {
            "name": "session_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Stripe checkout session ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Key fulfillment confirmed with updated credit balance"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "x402_spt": {
        "type": "apiKey",
        "in": "header",
        "name": "Payment-Credential",
        "description": "Stripe Shared Payment Token (SPT) formatted as 'SPT <token>' for x402 settlement."
      }
    }
  }
}