{
  "openapi": "3.1.0",
  "info": {
    "title": "Matrix Agent Tools Commercial API",
    "version": "1.0.0",
    "description": "Base Mainnet autonomous per-job API. Use the live catalogue for route availability. Product-specific input schemas and MCP transport details are outside this document."
  },
  "servers": [
    {
      "url": "https://agents.matrixdigitalltd.com"
    }
  ],
  "paths": {
    "/v1/agent/catalog": {
      "get": {
        "operationId": "getCatalogue",
        "summary": "Get current product availability and pricing",
        "security": [],
        "responses": {
          "200": {
            "description": "API response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "default": {
            "description": "Request rejected, held, or otherwise unavailable"
          }
        }
      }
    },
    "/v1/agent/enrol/challenge": {
      "post": {
        "operationId": "createEnrollmentChallenge",
        "summary": "Request a wallet ownership challenge",
        "security": [],
        "responses": {
          "200": {
            "description": "API response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "default": {
            "description": "Request rejected, held, or otherwise unavailable"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "wallet": {
                    "type": "string",
                    "pattern": "^0x[a-fA-F0-9]{40}$"
                  },
                  "credential_sha256": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  }
                },
                "required": [
                  "wallet",
                  "credential_sha256"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/v1/agent/enrol/register": {
      "post": {
        "operationId": "registerMachine",
        "summary": "Register a wallet-enrolled machine",
        "security": [],
        "responses": {
          "200": {
            "description": "API response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "default": {
            "description": "Request rejected, held, or otherwise unavailable"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "challenge": {},
                  "challenge_mac": {
                    "type": "string"
                  },
                  "signature": {
                    "type": "string"
                  }
                },
                "required": [
                  "challenge",
                  "challenge_mac",
                  "signature"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/v1/agent/quotes": {
      "post": {
        "operationId": "createQuote",
        "summary": "Request a per-job commercial quotation",
        "security": [
          {
            "MachineBearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "API response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "default": {
            "description": "Request rejected, held, or otherwise unavailable"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "route": {
                    "type": "string",
                    "description": "Currently available route from the live catalogue"
                  },
                  "payload": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "Product-specific validated input"
                  },
                  "idempotency_key": {
                    "type": "string"
                  }
                },
                "required": [
                  "route",
                  "payload",
                  "idempotency_key"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/v1/agent/jobs/{quote_id}/payment": {
      "parameters": [
        {
          "name": "quote_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          }
        }
      ],
      "post": {
        "operationId": "submitPayment",
        "summary": "Request or submit an x402 payment for an existing quotation",
        "security": [
          {
            "MachineBearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "API response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "default": {
            "description": "Request rejected, held, or otherwise unavailable"
          },
          "202": {
            "description": "Payment or execution reconciliation pending"
          },
          "402": {
            "description": "x402 payment required",
            "headers": {
              "PAYMENT-REQUIRED": {
                "schema": {
                  "type": "string"
                },
                "description": "Encoded x402 payment requirements"
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false
              }
            }
          }
        },
        "parameters": [
          {
            "name": "PAYMENT-SIGNATURE",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Encoded x402 v2 payment payload. Omit when requesting the initial payment challenge."
          }
        ]
      }
    },
    "/v1/agent/jobs/{quote_id}/status": {
      "parameters": [
        {
          "name": "quote_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          }
        }
      ],
      "get": {
        "operationId": "getJobStatus",
        "summary": "Get owned quotation, payment and job status",
        "security": [
          {
            "MachineBearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "API response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "default": {
            "description": "Request rejected, held, or otherwise unavailable"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "MachineBearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "Wallet-enrolled machine credential"
      }
    }
  },
  "externalDocs": {
    "url": "https://agents.matrixdigitalltd.com/llms.txt"
  }
}
