{
  "openapi": "3.1.0",
  "info": {
    "title": "Delco Plumber Now agent API",
    "version": "1.0.0",
    "description": "Get a person connected with a Delaware County, PA plumber now: instant typical price range, coverage check, and call/text (610) 362-5950. Free plumber referrals, for AI agents acting for a person. Check coverage and a typical price range, then give the person (610) 362-5950 to call or text, or (with their explicit consent) submit a contact request. Delco Plumber Now is a free referral service (a d/b/a of Aifurman LLC), not a plumbing contractor. It does not warrant or guarantee any work; the homeowner must verify license and insurance. Typical ranges are not quotes: the independent plumber confirms the actual price before any work. An MCP server with the same tools is at https://delcoplumbernow.com/mcp.",
    "contact": {
      "name": "Delco Plumber Now (Aifurman LLC)",
      "email": "hello@delcoplumbernow.com",
      "url": "https://delcoplumbernow.com"
    }
  },
  "servers": [
    {
      "url": "https://delcoplumbernow.com"
    }
  ],
  "paths": {
    "/api/agent/v1/coverage": {
      "get": {
        "operationId": "checkCoverage",
        "summary": "Is this town or ZIP covered?",
        "parameters": [
          {
            "name": "location",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "19083"
          }
        ],
        "responses": {
          "200": {
            "description": "Coverage answer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Coverage"
                }
              }
            }
          }
        }
      }
    },
    "/api/agent/v1/price-range": {
      "get": {
        "operationId": "getPriceRange",
        "summary": "Typical price range for a plumbing problem (not a quote)",
        "parameters": [
          {
            "name": "problem",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "toilet keeps running"
          },
          {
            "name": "location",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "Havertown"
          }
        ],
        "responses": {
          "200": {
            "description": "Typical range with disclaimer",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/agent/v1/contact": {
      "get": {
        "operationId": "getContactInfo",
        "summary": "How the person can reach Delco Plumber Now",
        "responses": {
          "200": {
            "description": "Phone (call/text), email, website, consent text",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/agent/v1/chat": {
      "post": {
        "operationId": "chat",
        "summary": "Multi-turn chat with the Delco Plumber Now assistant",
        "description": "Send {message} to start; reply includes conversation_id. Send it back with each next message. The assistant gives typical ranges, points to call/text, asks for a phone or email, and files a contact request once the person explicitly agrees. Limits: 30 messages per conversation, 60 per client per hour.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "message"
                ],
                "properties": {
                  "message": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "conversation_id": {
                    "type": "string",
                    "pattern": "^c_[a-f0-9]{16}$"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Reply with conversation_id (and contact_request when filed)"
          },
          "429": {
            "description": "Rate limit"
          }
        }
      }
    },
    "/api/agent/v1/contact-request": {
      "post": {
        "operationId": "requestContact",
        "summary": "Ask Delco Plumber Now to contact the person (explicit consent required)",
        "description": "Only submit after the person agrees to: \"I ask Delco Plumber Now (Andrew Furman, Aifurman LLC) to contact me about this plumbing request at the phone number and/or email I provided.\". We store the request, email a confirmation if an email is given, and may call back. We only text after the person texts us; the response includes a prefilled text to send. Max 3 requests per contact per day.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ContactRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Received; next steps for the person"
          },
          "400": {
            "description": "Missing consent or fields"
          },
          "429": {
            "description": "Too many requests for this contact today"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Coverage": {
        "type": "object",
        "properties": {
          "covered": {
            "type": "boolean"
          },
          "level": {
            "type": "string",
            "enum": [
              "primary",
              "delaware-county",
              "none"
            ]
          },
          "town": {
            "type": "string"
          },
          "zip": {
            "type": "string"
          },
          "page": {
            "type": "string"
          },
          "note": {
            "type": "string"
          }
        }
      },
      "ContactRequest": {
        "type": "object",
        "required": [
          "consent",
          "problem",
          "location"
        ],
        "properties": {
          "consent": {
            "type": "boolean",
            "const": true,
            "description": "I ask Delco Plumber Now (Andrew Furman, Aifurman LLC) to contact me about this plumbing request at the phone number and/or email I provided."
          },
          "name": {
            "type": "string"
          },
          "phone": {
            "type": "string",
            "description": "US phone number"
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "problem": {
            "type": "string"
          },
          "location": {
            "type": "string"
          },
          "preferred_contact": {
            "type": "string",
            "enum": [
              "text",
              "call",
              "email"
            ]
          }
        }
      }
    }
  }
}