curl --request POST \
--url https://gateway.molpha.io/v1/x402/execute \
--header 'Content-Type: application/json' \
--data '
{
"signatures_required": 3,
"registry_version": 42,
"apiConfig": {
"url": "https://api.example.com/v1/price",
"method": "GET",
"headers": {},
"responseParser": "$.data.price",
"valueTransform": "multiply:1e6"
}
}
'const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
signatures_required: 3,
registry_version: 42,
apiConfig: {
url: 'https://api.example.com/v1/price',
method: 'GET',
headers: {},
responseParser: '$.data.price',
valueTransform: 'multiply:1e6'
}
})
};
fetch('https://gateway.molpha.io/v1/x402/execute', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://gateway.molpha.io/v1/x402/execute"
payload = {
"signatures_required": 3,
"registry_version": 42,
"apiConfig": {
"url": "https://api.example.com/v1/price",
"method": "GET",
"headers": {},
"responseParser": "$.data.price",
"valueTransform": "multiply:1e6"
}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://gateway.molpha.io/v1/x402/execute"
payload := strings.NewReader("{\n \"signatures_required\": 3,\n \"registry_version\": 42,\n \"apiConfig\": {\n \"url\": \"https://api.example.com/v1/price\",\n \"method\": \"GET\",\n \"headers\": {},\n \"responseParser\": \"$.data.price\",\n \"valueTransform\": \"multiply:1e6\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"status": "completed",
"data": {
"attestation": {
"payload": {
"value": "<string>",
"sourceId": "<string>",
"registryVersion": 42,
"signaturesRequired": 3,
"timestamp": 1700100000000
},
"signature": {
"signature": "<string>",
"commitment": "<string>",
"signersBitmap": "<string>"
}
},
"value": "42150125000000",
"fresh": true,
"configHash": "<string>",
"aggregation": {
"mode": "tolerance",
"rule": "median",
"maxDeviationBps": 50,
"maxAgeMs": 2000,
"numeric": {
"type": "int256",
"decimals": 8
}
}
}
}{
"error": "validation failed"
}{
"x402Version": 2,
"error": "<string>",
"resource": {
"url": "https://gateway.molpha.io/v1/x402/execute",
"description": "Molpha oracle round",
"mimeType": "application/json"
},
"accepts": [
{
"scheme": "exact",
"network": "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",
"amount": "1030",
"asset": "<string>",
"payTo": "<string>",
"maxTimeoutSeconds": 60,
"extra": {}
}
],
"extensions": {
"upstream": {
"provider": "<string>",
"resource": "<string>",
"signaturesRequired": 123,
"redundancyBuffer": 123,
"nodeCount": 123,
"eligibleSetSize": 123,
"supportedX402Versions": [
123
],
"error": "<string>"
}
}
}{
"error": "validation failed"
}{
"error": "validation failed"
}{
"error": "validation failed"
}Execute an x402 pay-per-request round
x402 v2 exact Solana payment to the protocol treasury; no subscription required.
curl --request POST \
--url https://gateway.molpha.io/v1/x402/execute \
--header 'Content-Type: application/json' \
--data '
{
"signatures_required": 3,
"registry_version": 42,
"apiConfig": {
"url": "https://api.example.com/v1/price",
"method": "GET",
"headers": {},
"responseParser": "$.data.price",
"valueTransform": "multiply:1e6"
}
}
'const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
signatures_required: 3,
registry_version: 42,
apiConfig: {
url: 'https://api.example.com/v1/price',
method: 'GET',
headers: {},
responseParser: '$.data.price',
valueTransform: 'multiply:1e6'
}
})
};
fetch('https://gateway.molpha.io/v1/x402/execute', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://gateway.molpha.io/v1/x402/execute"
payload = {
"signatures_required": 3,
"registry_version": 42,
"apiConfig": {
"url": "https://api.example.com/v1/price",
"method": "GET",
"headers": {},
"responseParser": "$.data.price",
"valueTransform": "multiply:1e6"
}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://gateway.molpha.io/v1/x402/execute"
payload := strings.NewReader("{\n \"signatures_required\": 3,\n \"registry_version\": 42,\n \"apiConfig\": {\n \"url\": \"https://api.example.com/v1/price\",\n \"method\": \"GET\",\n \"headers\": {},\n \"responseParser\": \"$.data.price\",\n \"valueTransform\": \"multiply:1e6\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"status": "completed",
"data": {
"attestation": {
"payload": {
"value": "<string>",
"sourceId": "<string>",
"registryVersion": 42,
"signaturesRequired": 3,
"timestamp": 1700100000000
},
"signature": {
"signature": "<string>",
"commitment": "<string>",
"signersBitmap": "<string>"
}
},
"value": "42150125000000",
"fresh": true,
"configHash": "<string>",
"aggregation": {
"mode": "tolerance",
"rule": "median",
"maxDeviationBps": 50,
"maxAgeMs": 2000,
"numeric": {
"type": "int256",
"decimals": 8
}
}
}
}{
"error": "validation failed"
}{
"x402Version": 2,
"error": "<string>",
"resource": {
"url": "https://gateway.molpha.io/v1/x402/execute",
"description": "Molpha oracle round",
"mimeType": "application/json"
},
"accepts": [
{
"scheme": "exact",
"network": "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",
"amount": "1030",
"asset": "<string>",
"payTo": "<string>",
"maxTimeoutSeconds": 60,
"extra": {}
}
],
"extensions": {
"upstream": {
"provider": "<string>",
"resource": "<string>",
"signaturesRequired": 123,
"redundancyBuffer": 123,
"nodeCount": 123,
"eligibleSetSize": 123,
"supportedX402Versions": [
123
],
"error": "<string>"
}
}
}{
"error": "validation failed"
}{
"error": "validation failed"
}{
"error": "validation failed"
}Headers
Base64 x402 v2 payment payload. Omit on the first request to receive the 402 requirements.
Body
x402 execute request
Request body for POST /v1/x402/execute. It carries no timestamp and no payer, amount, signature or payment reference; payment is in PAYMENT-SIGNATURE.
Requested quorum for this round. Must be at least protocol min_signers and at most the current node count.
3
Active on-chain registry version. Must match the current version.
42
Off-chain HTTP API configuration. Its canonical hash is the source ID.
Hide child attributes
Hide child attributes
Target API URL. Must use http or https.
"https://api.example.com/v1/price"
HTTP method. Required: GET, POST, PUT, PATCH, DELETE, HEAD or OPTIONS. It is hashed into the source ID as sent.
"GET"
JSONPath expression to extract the value from the API response.
"$.data.price"
Optional post-parse transform (e.g. multiply:1e6).
"multiply:1e6"
Selects median tolerance mode. Omit it for exact mode. It is part of the source ID; "mode":"exact" is rejected.
Hide child attributes
Hide child attributes
tolerance "tolerance"
median "median"
Largest allowed deviation from the lower median, in basis points.
50
Largest allowed age of an observation, in milliseconds. Must be greater than 0.
x >= 12000
End-to-end encryption envelope for private API configs. Omit for plaintext configs.
Hide child attributes
Hide child attributes
Ephemeral public key used to encrypt the config (hex).
Symmetric encryption nonce (12 bytes, hex).
Encrypted API configuration payload (hex).
Base64 x402 payloads for a paywalled API source, one per node in the round's eligible set. They pay the source, never Molpha.
Declare a paywalled API source to be quoted in extensions.upstream before running the round.
Response
Signed aggregate; the payment is confirmed
Successful round response, shared by POST /v1/round/execute and POST /v1/x402/execute. The attestation payload and Schnorr signature are what verifiers consume.
"completed"
Hide child attributes
Hide child attributes
Hide child attributes
Hide child attributes
Hide child attributes
Hide child attributes
Fixed 32-byte packed value (hex). Unsigned in exact mode, signed int256 in tolerance mode.
32-byte source ID (hex), the canonical API-config hash.
42
3
Gateway-assigned round time in unix milliseconds.
1700100000000
Decimal rendering of payload.value (trailing zeros trimmed).
"42150125000000"
true
API-config commitment echoed from the node round (currently equal to sourceId).
Echo of the request's median-tolerance policy; present only in tolerance mode.
Hide child attributes
Hide child attributes
tolerance "tolerance"
median "median"
Largest allowed deviation from the lower median, in basis points.
50
Largest allowed age of an observation, in milliseconds. Must be greater than 0.
x >= 12000