{
  "openapi": "3.1.0",
  "info": {
    "title": "Swapper Agent API",
    "version": "1.0.0",
    "summary": "Private swaps. Deterministic API.",
    "description": "Public HTTPS API for deterministic XMR <> USDC agent workflows."
  },
  "servers": [
    {
      "url": "https://www.xmrtousdc.xyz/api/v1"
    }
  ],
  "externalDocs": {
    "description": "Quickstart and trust metadata",
    "url": "https://www.xmrtousdc.xyz/api/v1/agent/quickstart"
  },
  "x-discovery": {
    "agentJson": "https://www.xmrtousdc.xyz/.well-known/agent.json",
    "agentJsonAlias": "https://www.xmrtousdc.xyz/agent.json",
    "jwks": "https://www.xmrtousdc.xyz/.well-known/jwks.json",
    "aiPlugin": "https://www.xmrtousdc.xyz/.well-known/ai-plugin.json",
    "securityTxt": "https://www.xmrtousdc.xyz/.well-known/security.txt",
    "openapiWellKnown": "https://www.xmrtousdc.xyz/.well-known/openapi.json",
    "llms": "https://www.xmrtousdc.xyz/llms.txt",
    "llmsFull": "https://www.xmrtousdc.xyz/llms-full.txt",
    "sitemap": "https://www.xmrtousdc.xyz/sitemap.xml"
  },
  "tags": [
    {
      "name": "discovery"
    },
    {
      "name": "agent"
    },
    {
      "name": "swap"
    },
    {
      "name": "support"
    }
  ],
  "paths": {
    "/health": {
      "get": {
        "tags": [
          "discovery"
        ],
        "summary": "API health",
        "operationId": "health",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/agent/quickstart": {
      "get": {
        "tags": [
          "discovery",
          "agent"
        ],
        "summary": "Agent quickstart payload",
        "operationId": "agentQuickstart",
        "responses": {
          "200": {
            "description": "Quickstart",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentQuickstart"
                }
              }
            }
          }
        }
      }
    },
    "/agent/capabilities": {
      "get": {
        "tags": [
          "agent"
        ],
        "summary": "Supported chains/directions",
        "operationId": "agentCapabilities",
        "responses": {
          "200": {
            "description": "Capabilities",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/agent/swap/plan": {
      "post": {
        "tags": [
          "agent",
          "swap"
        ],
        "summary": "Validate intent and list missing inputs",
        "operationId": "agentSwapPlan",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentPlanRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Plan response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/agent/swap/quote": {
      "post": {
        "tags": [
          "agent",
          "swap"
        ],
        "summary": "Get quote",
        "operationId": "agentSwapQuote",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentSwapRequestBase"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Quote response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/agent/swap/create": {
      "post": {
        "tags": [
          "agent",
          "swap"
        ],
        "summary": "Create order and return funding instructions",
        "operationId": "agentSwapCreate",
        "parameters": [
          {
            "name": "idempotency-key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Strongly recommended for retry-safe writes."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentSwapRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Create response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "409": {
            "description": "Idempotency conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/agent/swap/execute": {
      "post": {
        "tags": [
          "agent",
          "swap"
        ],
        "summary": "Quote + create in one call",
        "operationId": "agentSwapExecute",
        "parameters": [
          {
            "name": "idempotency-key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Strongly recommended for retry-safe writes."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentSwapRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Execute response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/agent/swap/status/{orderId}": {
      "get": {
        "tags": [
          "agent",
          "swap"
        ],
        "summary": "Get normalized order status",
        "operationId": "agentSwapStatus",
        "parameters": [
          {
            "name": "orderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "verify",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Status response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/agent/support/tickets": {
      "post": {
        "tags": [
          "agent",
          "support"
        ],
        "summary": "Create support ticket",
        "operationId": "agentSupportCreate",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SupportRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Ticket created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AgentQuickstart": {
        "type": "object",
        "required": [
          "ok",
          "operation",
          "brand",
          "trust",
          "links",
          "quickstart"
        ],
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "operation": {
            "type": "string"
          },
          "brand": {
            "type": "object"
          },
          "trust": {
            "type": "object"
          },
          "links": {
            "type": "object"
          },
          "quickstart": {
            "type": "object"
          },
          "examples": {
            "type": "object"
          }
        }
      },
      "AgentPlanRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "direction": {
            "type": "string",
            "example": "x2u"
          },
          "chain": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "integer"
              }
            ],
            "example": "arbitrum"
          },
          "amount": {
            "type": "string",
            "example": "0.8"
          },
          "to": {
            "type": "string"
          },
          "hasFunds": {
            "type": "boolean"
          }
        }
      },
      "AgentSwapRequestBase": {
        "type": "object",
        "required": [
          "direction",
          "chain",
          "amount"
        ],
        "additionalProperties": false,
        "properties": {
          "direction": {
            "type": "string",
            "enum": [
              "x2u",
              "u2x"
            ]
          },
          "chain": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "integer"
              }
            ]
          },
          "amount": {
            "type": "string",
            "example": "0.8"
          }
        }
      },
      "AgentSwapRequest": {
        "allOf": [
          {
            "$ref": "#/components/schemas/AgentSwapRequestBase"
          },
          {
            "type": "object",
            "required": [
              "to"
            ],
            "properties": {
              "to": {
                "type": "string",
                "example": "0x1111111111111111111111111111111111111111"
              },
              "sessionId": {
                "type": "string",
                "format": "uuid"
              }
            }
          }
        ]
      },
      "SupportRequest": {
        "type": "object",
        "required": [
          "message"
        ],
        "properties": {
          "message": {
            "type": "string"
          },
          "category": {
            "type": "string",
            "default": "agent"
          },
          "orderId": {
            "type": "string"
          },
          "sessionId": {
            "type": "string",
            "format": "uuid"
          },
          "walletAddress": {
            "type": "string"
          }
        }
      },
      "ErrorEnvelope": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  }
}