{
  "openapi": "3.1.0",
  "info": {
    "title": "SalesHose API",
    "version": "1.0.0",
    "description": "Public embed API plus MPP/x402-paid agent resources. Free form endpoints require no payment; /api/agent/* and /api/mpp/* require HTTP 402 settlement via x402 on Base Sepolia.",
    "contact": {
      "name": "SalesHose",
      "url": "https://saleshose.com/docs"
    }
  },
  "servers": [
    {
      "url": "https://saleshose.com"
    }
  ],
  "x-service-info": {
    "categories": [
      "ai",
      "sales",
      "forms",
      "lead-qualification"
    ],
    "docs": {
      "homepage": "https://saleshose.com/",
      "apiReference": "https://saleshose.com/docs",
      "llms": "https://saleshose.com/llms.txt"
    }
  },
  "paths": {
    "/api/forms/{slug}": {
      "get": {
        "summary": "Get a form's public config (title, theme, blocks)",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Form config",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "slug": {
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    },
                    "config": {
                      "type": "object"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found or unpublished"
          }
        }
      }
    },
    "/api/forms/{slug}/responses": {
      "post": {
        "summary": "Submit (or partial-capture) a response; returns lead score and resolved ending",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "data": {
                    "type": "object",
                    "description": "Answers keyed by each block's name",
                    "additionalProperties": true
                  },
                  "completed": {
                    "type": "boolean",
                    "default": true
                  },
                  "id": {
                    "type": "string",
                    "description": "Stable id for partial-capture upsert"
                  },
                  "meta": {
                    "type": "object",
                    "additionalProperties": true
                  }
                },
                "required": [
                  "data"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Saved",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "id": {
                      "type": "string"
                    },
                    "score": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "ending": {
                      "type": [
                        "object",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/forms/{slug}/responses/{id}/booked": {
      "post": {
        "summary": "Mark a response as meeting booked",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Marked booked",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/forms/{slug}/events": {
      "post": {
        "summary": "Record a funnel event (view, start, complete)",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "view",
                      "start",
                      "complete"
                    ]
                  },
                  "session": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/mpp/demo": {
      "get": {
        "summary": "MPP payment discovery probe",
        "description": "Confirms MPP payment discovery and HTTP 402 x402 handling for AI agents.",
        "x-payment-info": {
          "offers": [
            {
              "amount": "1000",
              "currency": "usd",
              "description": "Per-request access via HTTP 402 (x402 exact scheme, Base Sepolia USDC). Retry with Payment-Signature after payment.",
              "intent": "charge",
              "method": "tempo"
            }
          ]
        },
        "responses": {
          "200": {
            "description": "Successful response"
          },
          "402": {
            "description": "Payment Required"
          },
          "404": {
            "description": "Not found"
          }
        }
      }
    },
    "/api/agent/pricing": {
      "get": {
        "summary": "Machine-readable pricing",
        "description": "Returns pricing.md — SalesHose plan details for AI agents (EUR, per-account metering).",
        "x-payment-info": {
          "offers": [
            {
              "amount": "1000",
              "currency": "usd",
              "description": "Per-request access via HTTP 402 (x402 exact scheme, Base Sepolia USDC). Retry with Payment-Signature after payment.",
              "intent": "charge",
              "method": "tempo"
            }
          ]
        },
        "responses": {
          "200": {
            "description": "Successful response"
          },
          "402": {
            "description": "Payment Required"
          },
          "404": {
            "description": "Not found"
          }
        }
      }
    },
    "/api/agent/overview": {
      "get": {
        "summary": "Site overview for agents",
        "description": "Returns llms.txt — product summary, embed instructions, and public API pointers.",
        "x-payment-info": {
          "offers": [
            {
              "amount": "1000",
              "currency": "usd",
              "description": "Per-request access via HTTP 402 (x402 exact scheme, Base Sepolia USDC). Retry with Payment-Signature after payment.",
              "intent": "charge",
              "method": "tempo"
            }
          ]
        },
        "responses": {
          "200": {
            "description": "Successful response"
          },
          "402": {
            "description": "Payment Required"
          },
          "404": {
            "description": "Not found"
          }
        }
      }
    },
    "/api/agent/forms": {
      "post": {
        "summary": "Create a form + workspace (agent API, no auth)",
        "description": "Provision a live lead-qualification form in one call — for AI agents building a site. Pass {prompt} for an AI-built scored form, or explicit {title, blocks}. Optional webhook_url (https) receives each completed lead. Returns the hosted form URL, embed snippets, and a one-time claim_url the human owner uses to take over the workspace. Rate limit: 10 creations per IP per day. The same capability is exposed as MCP tools at /mcp.",
        "operationId": "agentCreateForm",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "prompt": {
                    "type": "string",
                    "description": "Natural-language description of the form to build"
                  },
                  "title": {
                    "type": "string"
                  },
                  "blocks": {
                    "type": "array",
                    "items": {
                      "type": "object"
                    },
                    "description": "Explicit block definitions (alternative to prompt)"
                  },
                  "webhook_url": {
                    "type": "string",
                    "format": "uri",
                    "description": "https URL that receives each completed lead as JSON"
                  },
                  "theme": {
                    "type": "object"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Form created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "form": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "slug": {
                          "type": "string"
                        },
                        "title": {
                          "type": "string"
                        },
                        "url": {
                          "type": "string"
                        },
                        "questions": {
                          "type": "integer"
                        }
                      }
                    },
                    "embed": {
                      "type": "object",
                      "properties": {
                        "inline": {
                          "type": "string"
                        },
                        "popup": {
                          "type": "string"
                        },
                        "bubble": {
                          "type": "string"
                        }
                      }
                    },
                    "claim_url": {
                      "type": "string",
                      "description": "One-time handover URL — give it to the human owner"
                    },
                    "api": {
                      "type": "object"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "prompt_or_blocks_required / invalid_blocks"
          },
          "429": {
            "description": "rate_limited (10 per IP per day)"
          },
          "502": {
            "description": "generation_failed — retry or pass explicit blocks"
          }
        }
      }
    }
  }
}
