{
  "openapi": "3.1.0",
  "info": {
    "title": "ToolMint Record Hygiene JSON",
    "version": "0.1.0",
    "description": "Clean owner/contact records: name normalization, owner type (individual/entity/trust/estate/government), offline USPS-style address formatting, absentee-owner flag, NANP phone E.164, email syntax, dedupe clusters. Pure compute on the data you send; nothing stored or looked up. Not CASS-certified. Phones are not DNC-scrubbed. Pay per call with USDC on Base via x402.",
    "x-guidance": "POST /clean with JSON {records:[{id,name,owner,mailing_address,property_address,phones,emails}], options:{dedupe:true}}. Up to 500 records per call, body max 1 MB. Malformed bodies get a free 400 (or 413) before any payment. Unpaid valid calls receive HTTP 402 (USDC on Base). Every phone output carries \"TCPA/DNC check required before any call or text\". Free: /, /health, /openapi.json, /.well-known/x402.",
    "contact": {
      "email": "toolmint.dev@gmail.com",
      "name": "ToolMint"
    }
  },
  "paths": {
    "/health": {
      "get": {
        "operationId": "health",
        "summary": "Liveness",
        "security": [],
        "responses": {
          "200": {
            "description": "ok"
          }
        }
      }
    },
    "/clean": {
      "post": {
        "operationId": "record_hygiene_clean",
        "summary": "Clean, classify and dedupe up to 500 owner/contact records",
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.002000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ],
          "network": "eip155:8453",
          "payTo": "0xfbF7413bcB3a604936775C96FDbe0b0C9c9E37F5",
          "asset": "USDC",
          "scheme": "exact",
          "amountAtomic": "2000"
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "records"
                ],
                "properties": {
                  "records": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 500,
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": [
                            "string",
                            "number"
                          ]
                        },
                        "name": {
                          "type": "string"
                        },
                        "owner": {
                          "type": "string"
                        },
                        "mailing_address": {
                          "oneOf": [
                            {
                              "type": "string",
                              "maxLength": 500,
                              "description": "One-line address; commas between street, city, state ZIP help parsing"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "line1": {
                                  "type": "string"
                                },
                                "line2": {
                                  "type": "string"
                                },
                                "city": {
                                  "type": "string"
                                },
                                "state": {
                                  "type": "string"
                                },
                                "zip": {
                                  "type": [
                                    "string",
                                    "number"
                                  ]
                                }
                              }
                            }
                          ]
                        },
                        "property_address": {
                          "oneOf": [
                            {
                              "type": "string",
                              "maxLength": 500,
                              "description": "One-line address; commas between street, city, state ZIP help parsing"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "line1": {
                                  "type": "string"
                                },
                                "line2": {
                                  "type": "string"
                                },
                                "city": {
                                  "type": "string"
                                },
                                "state": {
                                  "type": "string"
                                },
                                "zip": {
                                  "type": [
                                    "string",
                                    "number"
                                  ]
                                }
                              }
                            }
                          ]
                        },
                        "phones": {
                          "type": "array",
                          "maxItems": 20,
                          "items": {
                            "type": "string"
                          }
                        },
                        "emails": {
                          "type": "array",
                          "maxItems": 20,
                          "items": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  },
                  "options": {
                    "type": "object",
                    "properties": {
                      "dedupe": {
                        "type": "boolean",
                        "default": true
                      },
                      "nameOrder": {
                        "type": "string",
                        "enum": [
                          "auto",
                          "first-last",
                          "last-first"
                        ],
                        "default": "auto"
                      }
                    }
                  }
                }
              },
              "example": {
                "records": [
                  {
                    "id": "a1",
                    "owner": "SMITH JOHN & MARY",
                    "mailing_address": {
                      "line1": "123 north main street apartment 4",
                      "city": "Springfield",
                      "state": "il",
                      "zip": "62701"
                    },
                    "property_address": "456 Oak Avenue, Springfield, IL 62702",
                    "phones": [
                      "(217) 555-0142",
                      "217.744.1234"
                    ],
                    "emails": [
                      "John.Smith@Example.com"
                    ]
                  }
                ],
                "options": {
                  "dedupe": true
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Cleaned records, dedupe clusters, notes, notice"
          },
          "400": {
            "description": "Malformed JSON, wrong types, or more than 500 records (free, checked before payment)"
          },
          "402": {
            "description": "Payment Required"
          },
          "413": {
            "description": "Body larger than 1 MB (free, checked before payment)"
          },
          "503": {
            "description": "Payment service unavailable (not charged)"
          }
        }
      }
    }
  }
}