{
  "openapi": "3.0.3",
  "info": {
    "title": "TradeExecutor.ai Public Commerce API",
    "version": "2.0.0",
    "description": "Agent-facing API for TradeExecutor.ai. **There is no one-time-purchase product.**\nTradeExecutor.ai is a monthly subscription platform — free to create an account and\nmonitor, paid tiers to enable live execution. Pricing and tier details live at\nhttps://tradeexecutor.ai/pricing, not in this API.\n\nThe one-time-purchase products this API used to sell (`robot_basic`/`robot_complete`)\nare retired. `/catalog` and `/products/{code}` return no products; `POST /checkout`\nreturns `410 product_retired`. `/checkout/{session_id}` and `/license/verify` remain\nonly to look up licenses issued before the product was retired — they do not issue\nnew ones.\n\nReal subscription purchasing through this agent-commerce surface (Stripe subscription\nprice IDs, webhook-driven account/tier upgrade) is not implemented yet. Until it is,\nan agent transacting on a user's behalf should direct them to `signup_url` to create\nan account and choose a plan directly.\n\nAll responses include an `X-Request-Id` header and, on errors, a `request_id` field\nin the body.\n",
    "contact": {
      "email": "support@tradeexecutor.ai"
    },
    "license": {
      "name": "Proprietary"
    }
  },
  "servers": [
    {
      "url": "https://tradeexecutor.ai/api/public/v1",
      "description": "Production"
    }
  ],
  "tags": [
    {
      "name": "health",
      "description": "Service status"
    },
    {
      "name": "catalog",
      "description": "Product discovery (retired — see description)"
    },
    {
      "name": "checkout",
      "description": "Purchase flow (retired for new purchases — see description)"
    },
    {
      "name": "license",
      "description": "Historical license verification only"
    }
  ],
  "paths": {
    "/health": {
      "get": {
        "tags": [
          "health"
        ],
        "summary": "Service health check",
        "description": "Returns API health and current Stripe mode. Agents should verify `stripe_mode` is `test` before running automated test flows.",
        "operationId": "getHealth",
        "responses": {
          "200": {
            "description": "Service is healthy",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HealthResponse"
                },
                "example": {
                  "status": "ok",
                  "stripe_mode": "live",
                  "version": "2.0.0",
                  "timestamp": "2026-09-03T12:00:00Z",
                  "request_id": "req_abc123"
                }
              }
            }
          }
        }
      }
    },
    "/catalog": {
      "get": {
        "tags": [
          "catalog"
        ],
        "summary": "Product catalog (empty — see notice)",
        "description": "The one-time-purchase catalog is retired. Always returns an empty `products` array\nwith a `notice` and `signup_url` pointing to the real subscription tiers.\n",
        "operationId": "getCatalog",
        "responses": {
          "200": {
            "description": "Catalog returned (empty — subscription platform, no one-time products)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CatalogResponse"
                },
                "example": {
                  "merchant": {
                    "name": "TradeExecutor.ai",
                    "legal_name": "8675-309 LLC",
                    "url": "https://tradeexecutor.ai",
                    "contact": "support@tradeexecutor.ai",
                    "currency": "USD",
                    "jurisdiction": "US-FL"
                  },
                  "products": [],
                  "notice": "TradeExecutor.ai is a subscription platform (free monitoring tier, paid execution tiers). There is no one-time-purchase product. See signup_url for current tiers and to create an account.",
                  "signup_url": "https://tradeexecutor.ai/pricing",
                  "schema_version": "1.1.0",
                  "request_id": "req_abc123"
                }
              }
            }
          }
        }
      }
    },
    "/products/{code}": {
      "get": {
        "tags": [
          "catalog"
        ],
        "summary": "Single product lookup (always not found — see notice)",
        "description": "The one-time-purchase catalog is retired — every code returns `404`. Kept for backward compatibility with older agent integrations.",
        "operationId": "getProduct",
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Historical product code (e.g. robot_basic, robot_complete) — no longer resolvable to a real product."
          }
        ],
        "responses": {
          "404": {
            "description": "No one-time-purchase product exists",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RetiredNoticeResponse"
                },
                "example": {
                  "error": "not_found",
                  "message": "No one-time-purchase product exists. TradeExecutor.ai is a subscription platform — see https://tradeexecutor.ai/pricing for current tiers.",
                  "signup_url": "https://tradeexecutor.ai/pricing",
                  "request_id": "req_abc123"
                }
              }
            }
          }
        }
      }
    },
    "/inventory": {
      "get": {
        "tags": [
          "catalog"
        ],
        "summary": "License inventory (retired — no cap under a subscription model)",
        "description": "There is no license cap under a subscription model — this always returns a\n`notice` pointing to `signup_url` rather than a remaining/cap count.\n",
        "operationId": "getInventory",
        "responses": {
          "200": {
            "description": "Notice response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string"
                },
                "example": "public, max-age=60"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InventoryNoticeResponse"
                },
                "example": {
                  "notice": "TradeExecutor.ai is a subscription platform with no license cap. See signup_url for current tiers.",
                  "signup_url": "https://tradeexecutor.ai/pricing",
                  "updated_at": "2026-09-03T12:00:00Z",
                  "request_id": "req_abc123"
                }
              }
            }
          }
        }
      }
    },
    "/checkout": {
      "post": {
        "tags": [
          "checkout"
        ],
        "summary": "Create a purchase (retired — always 410)",
        "description": "The one-time-purchase product this endpoint used to sell is retired. This always\nreturns `410 product_retired` with `signup_url`. There is no agent-commerce path\nto a real subscription purchase yet — direct the user to `signup_url` to create an\naccount and choose a plan themselves.\n",
        "operationId": "createCheckout",
        "responses": {
          "410": {
            "description": "Product retired",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RetiredNoticeResponse"
                },
                "example": {
                  "error": "product_retired",
                  "message": "The one-time-purchase product (robot_basic/robot_complete) is retired. TradeExecutor.ai is now a subscription platform — create a free account and choose a plan at signup_url.",
                  "signup_url": "https://tradeexecutor.ai/pricing",
                  "request_id": "req_abc123"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimitError"
                }
              }
            }
          }
        }
      }
    },
    "/checkout/{session_id}": {
      "get": {
        "tags": [
          "checkout"
        ],
        "summary": "Historical checkout session status",
        "description": "Looks up a checkout session from before the one-time product was retired. No new\nsessions can be created (`POST /checkout` returns `410`), so this only resolves\npre-existing sessions.\n",
        "operationId": "getCheckoutStatus",
        "parameters": [
          {
            "name": "session_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Stripe Checkout session ID (starts with cs_)"
          }
        ],
        "responses": {
          "200": {
            "description": "Session status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckoutStatusResponse"
                }
              }
            }
          },
          "404": {
            "description": "Session not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/license/verify": {
      "get": {
        "tags": [
          "license"
        ],
        "summary": "Verify a historical license key",
        "description": "Verifies a license key issued before the one-time product was retired, for the\ngiven email address. Returns generic `not_found` on mismatch to prevent email\nenumeration. No new licenses are issued.\n",
        "operationId": "verifyLicense",
        "parameters": [
          {
            "name": "license_key",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "TSAI-ABCD-EFGH-JKMN-PQRS"
          },
          {
            "name": "email",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "email"
            },
            "example": "buyer@example.com"
          }
        ],
        "responses": {
          "200": {
            "description": "Verification result",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/LicenseValidResponse"
                    },
                    {
                      "$ref": "#/components/schemas/LicenseInvalidResponse"
                    }
                  ]
                },
                "examples": {
                  "valid": {
                    "value": {
                      "valid": true,
                      "product_code": "robot_complete",
                      "status": "active",
                      "issued_at": "2026-04-24T12:05:22Z",
                      "request_id": "req_abc123"
                    }
                  },
                  "invalid": {
                    "value": {
                      "valid": false,
                      "reason": "not_found",
                      "request_id": "req_abc123"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimitError"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "HealthResponse": {
        "type": "object",
        "required": [
          "status",
          "stripe_mode",
          "version",
          "timestamp"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "ok"
            ]
          },
          "stripe_mode": {
            "type": "string",
            "enum": [
              "test",
              "live"
            ],
            "description": "Current Stripe key mode — never cached"
          },
          "version": {
            "type": "string"
          },
          "timestamp": {
            "type": "string",
            "format": "date-time"
          },
          "request_id": {
            "type": "string"
          }
        }
      },
      "Merchant": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "legal_name": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "contact": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "jurisdiction": {
            "type": "string"
          }
        }
      },
      "CatalogResponse": {
        "type": "object",
        "required": [
          "merchant",
          "products",
          "notice",
          "signup_url",
          "schema_version"
        ],
        "properties": {
          "merchant": {
            "$ref": "#/components/schemas/Merchant"
          },
          "products": {
            "type": "array",
            "items": {},
            "description": "Always empty — the one-time-purchase catalog is retired."
          },
          "notice": {
            "type": "string"
          },
          "signup_url": {
            "type": "string",
            "format": "uri"
          },
          "schema_version": {
            "type": "string"
          },
          "request_id": {
            "type": "string"
          }
        }
      },
      "RetiredNoticeResponse": {
        "type": "object",
        "required": [
          "error",
          "message",
          "signup_url"
        ],
        "properties": {
          "error": {
            "type": "string",
            "enum": [
              "not_found",
              "product_retired"
            ]
          },
          "message": {
            "type": "string"
          },
          "signup_url": {
            "type": "string",
            "format": "uri"
          },
          "request_id": {
            "type": "string"
          }
        }
      },
      "InventoryNoticeResponse": {
        "type": "object",
        "required": [
          "notice",
          "signup_url",
          "updated_at"
        ],
        "properties": {
          "notice": {
            "type": "string"
          },
          "signup_url": {
            "type": "string",
            "format": "uri"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "request_id": {
            "type": "string"
          }
        }
      },
      "CheckoutStatusResponse": {
        "type": "object",
        "required": [
          "session_id",
          "status",
          "payment_status",
          "license_issued"
        ],
        "properties": {
          "session_id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "open",
              "complete",
              "expired"
            ]
          },
          "payment_status": {
            "type": "string",
            "enum": [
              "paid",
              "unpaid",
              "no_payment_required"
            ]
          },
          "license_issued": {
            "type": "boolean"
          },
          "license_key_redacted": {
            "type": "string",
            "nullable": true,
            "description": "Last 4 characters visible — full key delivered by email only"
          },
          "license_delivered_to_email": {
            "type": "string",
            "nullable": true
          },
          "completed_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "request_id": {
            "type": "string"
          }
        }
      },
      "LicenseValidResponse": {
        "type": "object",
        "required": [
          "valid",
          "product_code",
          "status",
          "issued_at"
        ],
        "properties": {
          "valid": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "product_code": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "active"
            ]
          },
          "issued_at": {
            "type": "string",
            "format": "date-time"
          },
          "request_id": {
            "type": "string"
          }
        }
      },
      "LicenseInvalidResponse": {
        "type": "object",
        "required": [
          "valid",
          "reason"
        ],
        "properties": {
          "valid": {
            "type": "boolean",
            "enum": [
              false
            ]
          },
          "reason": {
            "type": "string",
            "enum": [
              "not_found"
            ]
          },
          "request_id": {
            "type": "string"
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "required": [
          "error",
          "message"
        ],
        "properties": {
          "error": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "request_id": {
            "type": "string"
          }
        }
      },
      "RateLimitError": {
        "type": "object",
        "required": [
          "error",
          "retry_after_seconds"
        ],
        "properties": {
          "error": {
            "type": "string",
            "enum": [
              "rate_limited"
            ]
          },
          "message": {
            "type": "string"
          },
          "retry_after_seconds": {
            "type": "integer"
          }
        }
      }
    }
  }
}