{
  "openapi": "3.1.0",
  "info": {
    "title": "StormDue public API",
    "version": "1.0.0",
    "summary": "Read-only facts about US industrial stormwater permits.",
    "description": "Read-only, no key. The same answers as the StormDue pages and MCP server (https://stormdue.com/mcp). Every response carries its sources, a last_checked date and two notices. StormDue reminds and keeps records. It does not file anything with the agency and does not certify or guarantee compliance. Check each duty against your permit; you are responsible for your filings. StormDue does not guarantee that these facts are accurate or current. Verify them with your agency before you rely on them. Rate limited per IP address (about 60 requests a minute)."
  },
  "servers": [
    {
      "url": "https://stormdue.com/api/v1"
    }
  ],
  "externalDocs": {
    "url": "https://stormdue.com/mcp",
    "description": "MCP server and other agent access"
  },
  "paths": {
    "/states": {
      "get": {
        "operationId": "listStates",
        "summary": "Every state's industrial stormwater permit, agency and official link",
        "responses": {
          "200": {
            "description": "All jurisdictions",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "last_checked",
                    "sources",
                    "notices",
                    "links"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/State"
                      }
                    },
                    "last_checked": {
                      "type": "string",
                      "format": "date",
                      "description": "When the facts used were last checked against their sources."
                    },
                    "sources": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Source"
                      }
                    },
                    "notices": {
                      "$ref": "#/components/schemas/Notices"
                    },
                    "links": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string",
                        "format": "uri"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Rate limited: wait a minute",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/states/{code}": {
      "get": {
        "operationId": "getState",
        "summary": "One state's permit facts",
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 2,
              "maxLength": 2
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Permit facts",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "last_checked",
                    "sources",
                    "notices",
                    "links"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/State"
                    },
                    "last_checked": {
                      "type": "string",
                      "format": "date",
                      "description": "When the facts used were last checked against their sources."
                    },
                    "sources": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Source"
                      }
                    },
                    "notices": {
                      "$ref": "#/components/schemas/Notices"
                    },
                    "links": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string",
                        "format": "uri"
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Unknown state",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited: wait a minute",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/industry": {
      "get": {
        "operationId": "checkIndustry",
        "summary": "Federal stormwater lists that name an SIC code",
        "description": "A 4-digit SIC code returns its title, the 40 CFR 122.26(b)(14) category and the EPA 2021 MSGP sector that list it, each with a proof link. Words or a 2-3 digit prefix return matching codes. Never says whether a facility needs a permit.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 100
            },
            "examples": {
              "code": {
                "value": "5093"
              },
              "words": {
                "value": "scrap metal"
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Coverage facts",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "last_checked",
                    "sources",
                    "notices",
                    "links"
                  ],
                  "properties": {
                    "data": {
                      "type": "object"
                    },
                    "last_checked": {
                      "type": "string",
                      "format": "date",
                      "description": "When the facts used were last checked against their sources."
                    },
                    "sources": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Source"
                      }
                    },
                    "notices": {
                      "$ref": "#/components/schemas/Notices"
                    },
                    "links": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string",
                        "format": "uri"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing or invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited: wait a minute",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/no-exposure": {
      "get": {
        "operationId": "noExposure",
        "summary": "The no-exposure checklist, or its result for given answers",
        "description": "Without A to K: the eleven questions of 40 CFR 122.26(g)(4)(iii). With them (yes or no each): outcome may_certify, exposure or incomplete.",
        "parameters": [
          {
            "name": "A",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "yes",
                "no"
              ]
            }
          },
          {
            "name": "B",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "yes",
                "no"
              ]
            }
          },
          {
            "name": "C",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "yes",
                "no"
              ]
            }
          },
          {
            "name": "D",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "yes",
                "no"
              ]
            }
          },
          {
            "name": "E",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "yes",
                "no"
              ]
            }
          },
          {
            "name": "F",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "yes",
                "no"
              ]
            }
          },
          {
            "name": "G",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "yes",
                "no"
              ]
            }
          },
          {
            "name": "H",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "yes",
                "no"
              ]
            }
          },
          {
            "name": "I",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "yes",
                "no"
              ]
            }
          },
          {
            "name": "J",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "yes",
                "no"
              ]
            }
          },
          {
            "name": "K",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "yes",
                "no"
              ]
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 2,
              "maxLength": 2
            },
            "description": "USPS code, e.g. CA"
          }
        ],
        "responses": {
          "200": {
            "description": "Checklist or result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "last_checked",
                    "sources",
                    "notices",
                    "links"
                  ],
                  "properties": {
                    "data": {
                      "type": "object"
                    },
                    "last_checked": {
                      "type": "string",
                      "format": "date",
                      "description": "When the facts used were last checked against their sources."
                    },
                    "sources": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Source"
                      }
                    },
                    "notices": {
                      "$ref": "#/components/schemas/Notices"
                    },
                    "links": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string",
                        "format": "uri"
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Unknown state",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited: wait a minute",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/duties": {
      "get": {
        "operationId": "permitDuties",
        "summary": "A permit's duties and next due dates, when its rules have passed review",
        "description": "Gated like the site: if the state's rules have not passed review, data.available is false and data.state has the permit facts. Each duty lists its further steps in sub_deadlines (id, title, rule, next_due, citation); a step whose timing is unsettled has display: question and no date. next_12_months includes dated steps, with ids of the form <duty>#<step>.",
        "parameters": [
          {
            "name": "state",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 2,
              "maxLength": 2
            },
            "description": "USPS code, e.g. CA"
          },
          {
            "name": "coverage",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "noi (full permit) or nec (no-exposure)"
          }
        ],
        "responses": {
          "200": {
            "description": "Duties, or the not-yet-reviewed state",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "last_checked",
                    "sources",
                    "notices",
                    "links"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "required": [
                        "available"
                      ],
                      "properties": {
                        "available": {
                          "type": "boolean"
                        }
                      }
                    },
                    "last_checked": {
                      "type": "string",
                      "format": "date",
                      "description": "When the facts used were last checked against their sources."
                    },
                    "sources": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Source"
                      }
                    },
                    "notices": {
                      "$ref": "#/components/schemas/Notices"
                    },
                    "links": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string",
                        "format": "uri"
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Unknown state",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited: wait a minute",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Source": {
        "type": "object",
        "required": [
          "name",
          "url"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "section": {
            "type": "string"
          },
          "retrieved": {
            "type": "string",
            "format": "date"
          }
        }
      },
      "Notices": {
        "type": "object",
        "required": [
          "short",
          "verify"
        ],
        "properties": {
          "short": {
            "type": "string"
          },
          "verify": {
            "type": "string"
          },
          "draft": {
            "type": "string"
          },
          "stale": {
            "type": "string"
          }
        }
      },
      "State": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "agency": {
            "type": "string"
          },
          "permit": {
            "type": "string"
          },
          "official_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "duties_available": {
            "type": "boolean"
          },
          "rules_status": {
            "type": "string"
          },
          "page": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error",
          "message"
        ],
        "properties": {
          "error": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "docs": {
            "type": "string"
          }
        }
      }
    }
  }
}