{
  "openapi": "3.1.0",
  "info": {
    "title": "Snoffle API",
    "version": "0.3.2",
    "description": "Would people and AI assistants find this product, and would a buyer's agent buy it? Paid: answers 402 with a USDC-on-Base quote and a PayPal link until a key is sent. $9 for one report, or a monthly pass for any of your sites: Starter $19 a month (3 reports a month) or Pro $49 a month (12 reports a month). A deep check takes about 90 seconds. A paid key runs the deep check by default. deep=0 is the plain-rules check: not charged, needs no report, limited to 10 a day per key (429, code rules_cap). The same URL checked in the last 12 hours returns the saved report, free for the key that already received it (`cached: true`); send fresh=1 after a deploy, which uses one report. For an Apify actor link, Snoffle grades the listing: readiness = the listing reads, found = store search finds it, traction = people use and rate it."
  },
  "servers": [
    {
      "url": "https://snoffle.broke2builtai.com"
    }
  ],
  "components": {
    "securitySchemes": {
      "key": {
        "type": "apiKey",
        "in": "header",
        "name": "x-snoffle-key",
        "description": "The key from access.key or the paid page; keys look like snf_…"
      },
      "bearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "The same key as a Bearer token."
      }
    }
  },
  "paths": {
    "/api/snoffle/ticket": {
      "post": {
        "summary": "Reach a person: a support ticket, or a request for a fixed quote",
        "description": "Emails a person, who replies to `email`. Spends nothing and returns no key. Have it done for you: from $499 by fixed quote; we reply by email; nothing is charged until the price is agreed. To request it: POST https://snoffle.broke2builtai.com/api/snoffle/ticket with JSON {\"email\": <where the person should reply>, \"message\": <what you want done>, \"site\": <the site>, \"kind\": \"done\"}. There is no checkout and no way to pay for it through the API.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "email",
                  "message"
                ],
                "properties": {
                  "email": {
                    "type": "string",
                    "description": "Where the person should reply."
                  },
                  "message": {
                    "type": "string",
                    "minLength": 4,
                    "maxLength": 4000
                  },
                  "site": {
                    "type": "string",
                    "description": "The site this is about."
                  },
                  "kind": {
                    "type": "string",
                    "description": "Short word for the subject line; \"done\" asks for a quote on Have it done for you."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sent. Body: {ok: true, id}, the ticket id."
          },
          "400": {
            "description": "The email or the message is not usable. Body: {error}."
          },
          "429": {
            "description": "Too many tickets. Body: {error}."
          },
          "502": {
            "description": "It did not send; email eli@broke2builtai.com. Body: {error}."
          },
          "503": {
            "description": "Tickets are off here; email eli@broke2builtai.com. Body: {error}."
          }
        }
      }
    },
    "/api/status": {
      "get": {
        "summary": "Service status and prices",
        "responses": {
          "200": {
            "description": "Status JSON"
          }
        }
      }
    },
    "/api/check": {
      "get": {
        "summary": "Check a product page",
        "security": [
          {
            "key": []
          },
          {
            "bearer": []
          },
          {}
        ],
        "parameters": [
          {
            "name": "url",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Product URL, or an Apify actor link; a bare host is fine."
          },
          {
            "name": "deep",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1"
              ]
            },
            "description": "A paid key runs the deep check by default. deep=0 is the plain-rules check: not charged, needs no report, limited to 10 a day per key (429, code rules_cap)."
          },
          {
            "name": "fresh",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1"
              ]
            },
            "description": "The same URL checked in the last 12 hours returns the saved report, free for the key that already received it (`cached: true`); send fresh=1 after a deploy, which uses one report."
          },
          {
            "name": "x-snoffle-quote",
            "in": "header",
            "schema": {
              "type": "string"
            },
            "description": "The pay.usdc.quote you paid."
          },
          {
            "name": "x-snoffle-tx",
            "in": "header",
            "schema": {
              "type": "string"
            },
            "description": "The Base transaction hash of that payment."
          }
        ],
        "responses": {
          "200": {
            "description": "Report JSON: scores (overall, readiness, found, traction, visitors, converts), verdict, rivals, strategy, fixes, handoff; access.key and access.reportsLeft when a paid key was used; cached: true when it is the saved report from the last 12 hours; delta and next after a key's second report on a site. appraisal: own price, rival prices (linked, dated), the price band when 3 or more are comparable, where you sit, a realistic price with its formula, traffic from public signals such as Chrome UX Report presence and Apify Store stats, and a yearly figure only when those signals bound the traffic (with an assumed 1%–3% conversion, or gross Apify runs × the per-event price). Snoffle gathers all of it from the URL; there are no traffic inputs."
          },
          "400": {
            "description": "Bad URL, or a refused link. `code`: `bad_url` (no url, a URL that is not public http(s), or a body that is not JSON); `not_an_actor` (an apify.com link that is not an actor).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        false
                      ]
                    },
                    "code": {
                      "type": "string",
                      "enum": [
                        "bad_url",
                        "not_an_actor"
                      ]
                    },
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required, or the key or payment cannot run this report. Body has `pay.usdc` (one report, $9), `pay.usdcMonthly` (Starter, $19 a month, 3 reports a month) or `pay.usdcPro` (Pro, $49 a month, 12 reports a month), each with amount, to, token, chainId 8453, quote, expiresInSeconds; and `pay.paypal.url` (one report, $9), `pay.paypal.monthly` (Starter, $19 a month) or `pay.paypal.pro` (Pro, $49 a month) (`pay.paypal.single` is the same link as `pay.paypal.url`). A monthly pass is paid once for one month (31 days from payment) and holds its reports for any of your sites; nothing renews by itself, and buying another month adds a new key with its own reports. Without a key, deep=0 is the free check: the plain-rules score and the top 3 problems, 3 a day per address (429, code free_cap). Any other check without a key or a paid quote answers 402 (400 for a missing or refused URL). The USDC amount is the price plus a unique fraction of a cent (under one cent) that identifies your payment; send exactly that amount. Pay the USDC quote and repeat the request with x-snoffle-quote and x-snoffle-tx (Before 3 confirmations it answers 409 `pending`; retry in a few seconds. The call that carries x-snoffle-quote and x-snoffle-tx waits for the report (about 90 seconds); keep the connection open. If it drops, repeat the same request with the same headers: while the first run can still deliver you get 409 `running` (it can stay running for up to 5 minutes; poll every retryAfterSeconds, at most 30 s), then the report: the saved one, or a new run if the first never delivered. A run that never delivers gives its report back, so you are never charged twice.), or have a human pay by PayPal and send the key they get. When a key or payment was sent, `code` says why it cannot run: `invalid` (the key is not valid or has expired); `used_up` (the key has used every report it came with); `other_site` (this One report key is for a different site; a report on this one needs its own key (a Starter or Pro key works on any site)); `quote` (the quote id is unknown or too old (pay the quote within 2 hours; a paid quote can be redeemed for 24 hours); ask for a new one); `used` (that payment was already redeemed); `bad_hash` (x-snoffle-tx is not a transaction hash); `failed` (the transaction failed on-chain); `too_old` (the transaction predates the quote); `late` (the payment was sent after the quote expired); `amount_mismatch` (the USDC amount is not exactly the quote); `not_to_us` (the transaction did not send USDC to the quoted address); `unknown` (no transaction with that hash on Base yet; wait a few seconds and retry).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        false
                      ]
                    },
                    "code": {
                      "type": "string",
                      "enum": [
                        "bad_url",
                        "not_an_actor",
                        "invalid",
                        "used_up",
                        "other_site",
                        "quote",
                        "used",
                        "bad_hash",
                        "failed",
                        "too_old",
                        "late",
                        "amount_mismatch",
                        "not_to_us",
                        "pending",
                        "rpc",
                        "unknown",
                        "running",
                        "unreadable",
                        "rules_cap"
                      ]
                    },
                    "error": {
                      "type": "string"
                    },
                    "pay": {
                      "type": "object"
                    },
                    "price": {
                      "type": "object"
                    },
                    "example": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Wait and retry the same call. `code`: `pending` (seen on Base, not yet 3 confirmations; retry in a few seconds); `rpc` (Base RPCs did not answer; retry in a minute); `running` (this check is already running for this key; it takes about 90 seconds, then the same call returns it at no extra cost). Before 3 confirmations it answers 409 `pending`; retry in a few seconds. A `running` body carries `retryAfterSeconds`.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        false
                      ]
                    },
                    "code": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "rpc",
                        "running"
                      ]
                    },
                    "retryAfterSeconds": {
                      "type": "integer"
                    },
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "`code`: `unreadable` (the page could not be read (blocked, empty, not HTML, or SnoffleBot is disallowed); tell your human what it returned, do not guess a score).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        false
                      ]
                    },
                    "code": {
                      "type": "string",
                      "enum": [
                        "unreadable"
                      ]
                    },
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "`code`: `rules_cap` (this key has used its 10 uncharged plain-rules checks today; send deep=1 (uses a report)). A paid key runs the deep check by default. deep=0 is the plain-rules check: not charged, needs no report, limited to 10 a day per key (429, code rules_cap).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        false
                      ]
                    },
                    "code": {
                      "type": "string",
                      "enum": [
                        "rules_cap"
                      ]
                    },
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Check a product page (JSON body)",
        "security": [
          {
            "key": []
          },
          {
            "bearer": []
          },
          {}
        ],
        "parameters": [
          {
            "name": "x-snoffle-quote",
            "in": "header",
            "schema": {
              "type": "string"
            },
            "description": "The pay.usdc.quote you paid."
          },
          {
            "name": "x-snoffle-tx",
            "in": "header",
            "schema": {
              "type": "string"
            },
            "description": "The Base transaction hash of that payment."
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "url"
                ],
                "properties": {
                  "url": {
                    "type": "string"
                  },
                  "deep": {
                    "type": "boolean",
                    "description": "A paid key runs the deep check by default. deep=0 is the plain-rules check: not charged, needs no report, limited to 10 a day per key (429, code rules_cap)."
                  },
                  "fresh": {
                    "type": "boolean",
                    "description": "The same URL checked in the last 12 hours returns the saved report, free for the key that already received it (`cached: true`); send fresh=1 after a deploy, which uses one report."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Report JSON: scores (overall, readiness, found, traction, visitors, converts), verdict, rivals, strategy, fixes, handoff; access.key and access.reportsLeft when a paid key was used; cached: true when it is the saved report from the last 12 hours; delta and next after a key's second report on a site. appraisal: own price, rival prices (linked, dated), the price band when 3 or more are comparable, where you sit, a realistic price with its formula, traffic from public signals such as Chrome UX Report presence and Apify Store stats, and a yearly figure only when those signals bound the traffic (with an assumed 1%–3% conversion, or gross Apify runs × the per-event price). Snoffle gathers all of it from the URL; there are no traffic inputs."
          },
          "400": {
            "description": "Bad URL, or a refused link. `code`: `bad_url` (no url, a URL that is not public http(s), or a body that is not JSON); `not_an_actor` (an apify.com link that is not an actor).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        false
                      ]
                    },
                    "code": {
                      "type": "string",
                      "enum": [
                        "bad_url",
                        "not_an_actor"
                      ]
                    },
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required, or the key or payment cannot run this report. Body has `pay.usdc` (one report, $9), `pay.usdcMonthly` (Starter, $19 a month, 3 reports a month) or `pay.usdcPro` (Pro, $49 a month, 12 reports a month), each with amount, to, token, chainId 8453, quote, expiresInSeconds; and `pay.paypal.url` (one report, $9), `pay.paypal.monthly` (Starter, $19 a month) or `pay.paypal.pro` (Pro, $49 a month) (`pay.paypal.single` is the same link as `pay.paypal.url`). A monthly pass is paid once for one month (31 days from payment) and holds its reports for any of your sites; nothing renews by itself, and buying another month adds a new key with its own reports. Without a key, deep=0 is the free check: the plain-rules score and the top 3 problems, 3 a day per address (429, code free_cap). Any other check without a key or a paid quote answers 402 (400 for a missing or refused URL). The USDC amount is the price plus a unique fraction of a cent (under one cent) that identifies your payment; send exactly that amount. Pay the USDC quote and repeat the request with x-snoffle-quote and x-snoffle-tx (Before 3 confirmations it answers 409 `pending`; retry in a few seconds. The call that carries x-snoffle-quote and x-snoffle-tx waits for the report (about 90 seconds); keep the connection open. If it drops, repeat the same request with the same headers: while the first run can still deliver you get 409 `running` (it can stay running for up to 5 minutes; poll every retryAfterSeconds, at most 30 s), then the report: the saved one, or a new run if the first never delivered. A run that never delivers gives its report back, so you are never charged twice.), or have a human pay by PayPal and send the key they get. When a key or payment was sent, `code` says why it cannot run: `invalid` (the key is not valid or has expired); `used_up` (the key has used every report it came with); `other_site` (this One report key is for a different site; a report on this one needs its own key (a Starter or Pro key works on any site)); `quote` (the quote id is unknown or too old (pay the quote within 2 hours; a paid quote can be redeemed for 24 hours); ask for a new one); `used` (that payment was already redeemed); `bad_hash` (x-snoffle-tx is not a transaction hash); `failed` (the transaction failed on-chain); `too_old` (the transaction predates the quote); `late` (the payment was sent after the quote expired); `amount_mismatch` (the USDC amount is not exactly the quote); `not_to_us` (the transaction did not send USDC to the quoted address); `unknown` (no transaction with that hash on Base yet; wait a few seconds and retry).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        false
                      ]
                    },
                    "code": {
                      "type": "string",
                      "enum": [
                        "bad_url",
                        "not_an_actor",
                        "invalid",
                        "used_up",
                        "other_site",
                        "quote",
                        "used",
                        "bad_hash",
                        "failed",
                        "too_old",
                        "late",
                        "amount_mismatch",
                        "not_to_us",
                        "pending",
                        "rpc",
                        "unknown",
                        "running",
                        "unreadable",
                        "rules_cap"
                      ]
                    },
                    "error": {
                      "type": "string"
                    },
                    "pay": {
                      "type": "object"
                    },
                    "price": {
                      "type": "object"
                    },
                    "example": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Wait and retry the same call. `code`: `pending` (seen on Base, not yet 3 confirmations; retry in a few seconds); `rpc` (Base RPCs did not answer; retry in a minute); `running` (this check is already running for this key; it takes about 90 seconds, then the same call returns it at no extra cost). Before 3 confirmations it answers 409 `pending`; retry in a few seconds. A `running` body carries `retryAfterSeconds`.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        false
                      ]
                    },
                    "code": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "rpc",
                        "running"
                      ]
                    },
                    "retryAfterSeconds": {
                      "type": "integer"
                    },
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "`code`: `unreadable` (the page could not be read (blocked, empty, not HTML, or SnoffleBot is disallowed); tell your human what it returned, do not guess a score).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        false
                      ]
                    },
                    "code": {
                      "type": "string",
                      "enum": [
                        "unreadable"
                      ]
                    },
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "`code`: `rules_cap` (this key has used its 10 uncharged plain-rules checks today; send deep=1 (uses a report)). A paid key runs the deep check by default. deep=0 is the plain-rules check: not charged, needs no report, limited to 10 a day per key (429, code rules_cap).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        false
                      ]
                    },
                    "code": {
                      "type": "string",
                      "enum": [
                        "rules_cap"
                      ]
                    },
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}