{
  "openapi": "3.1.0",
  "info": {
    "title": "Mom's Guy request API",
    "version": "1.0.0",
    "description": "Ask Mom's Guy to find an owner-run local pro for a person in Downers Grove, IL. Mom's Guy texts the person to confirm (agent requests need a YES by text before any pro is contacted), then rounds up Mom's picks for that job. Free for the person. Only submit when the person asked you to and agreed to be contacted. To skip the wait, the person can call a pick directly: see https://momsguy.com/llms.txt",
    "contact": {
      "url": "https://momsguy.com/for-ai/"
    }
  },
  "servers": [
    {
      "url": "https://momsguy.com"
    }
  ],
  "paths": {
    "/api/request": {
      "post": {
        "operationId": "submitRequest",
        "summary": "Tell Mom what broke",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Request"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Received (ok: true), or out of area (ok: false, code: out_of_area). Relay `message` to the person.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Reply"
                }
              }
            }
          },
          "400": {
            "description": "Missing or invalid fields. `message` says what to fix.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Reply"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests for this IP or phone number.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Reply"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Request": {
        "type": "object",
        "required": [
          "service",
          "urgency",
          "zip",
          "name",
          "phone",
          "consent",
          "submitted_by"
        ],
        "properties": {
          "service": {
            "type": "string",
            "enum": [
              "plumbing",
              "roofing",
              "hvac",
              "landscaping",
              "electrical",
              "home-generators",
              "house-cleaning",
              "locksmith",
              "movers",
              "pest-control",
              "tree-service",
              "window-cleaning",
              "gutter-cleaning"
            ],
            "description": "The job type."
          },
          "job": {
            "type": "string",
            "maxLength": 300,
            "description": "What broke, in a few words. Example: \"Water heater leaking at the base\"."
          },
          "urgency": {
            "type": "string",
            "enum": [
              "asap",
              "weeks",
              "whenever"
            ],
            "description": "asap = today or tomorrow; weeks = next couple of weeks; whenever = still planning."
          },
          "zip": {
            "type": "string",
            "pattern": "^[0-9]{5}$",
            "description": "Where the job is. Downers Grove-area zips are served (for example 60515, 60516)."
          },
          "name": {
            "type": "string",
            "maxLength": 80
          },
          "phone": {
            "type": "string",
            "description": "US mobile number. Mom’s Guy texts this number first."
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "contact": {
            "type": "string",
            "enum": [
              "text",
              "call",
              "email"
            ],
            "default": "text"
          },
          "notes": {
            "type": "string",
            "maxLength": 1000
          },
          "submitted_by": {
            "type": "string",
            "enum": [
              "person",
              "agent"
            ],
            "description": "Use \"agent\" when you submit on someone’s behalf."
          },
          "agent_name": {
            "type": "string",
            "maxLength": 60,
            "description": "Your name, for example \"Claude\" or \"ChatGPT\"."
          },
          "consent": {
            "type": "boolean",
            "const": true,
            "description": "True only if the person asked you to request help and agreed to be texted, called or emailed about it."
          }
        }
      },
      "Reply": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "code": {
            "type": "string",
            "enum": [
              "received",
              "invalid",
              "out_of_area",
              "rate_limited"
            ]
          },
          "status": {
            "type": "string",
            "description": "needs_text_confirmation for agent requests, new for people."
          },
          "message": {
            "type": "string",
            "description": "Plain-language status to relay to the person."
          }
        }
      }
    }
  }
}