{
 "openapi": "3.1.0",
 "info": {
  "title": "ALL AI FORMS public catalog API",
  "version": "1.1.0",
  "description": "Read-only, free, no-auth catalog API for every live ALL AI FORMS listing (official blank forms, our templates which are not official government forms, request letters, contract templates, and step-by-step workflow guides). We do not fill in or prepare forms for you. Not a government agency. Not legal advice. CORS is open. Please cache responses (max-age=3600). Default page size is 50, maximum 200. The full static dump is also at /api/forms.json and /api/listings.json."
 },
 "servers": [
  {
   "url": "https://allaiforms.com"
  }
 ],
 "paths": {
  "/api/forms": {
   "get": {
    "operationId": "searchForms",
    "summary": "Search and filter the live catalog",
    "parameters": [
     {
      "name": "q",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "Search title, description, and id. Alias: search, query."
     },
     {
      "name": "state",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "State code (TX), name (Texas), or jurisdiction (US-TX)."
     },
     {
      "name": "type",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "enum": [
        "court",
        "government",
        "template",
        "letter",
        "workflow",
        "contract"
       ]
      }
     },
     {
      "name": "category",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "default": 50,
       "minimum": 1,
       "maximum": 200
      }
     },
     {
      "name": "offset",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "default": 0,
       "minimum": 0
      }
     },
     {
      "name": "format",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "enum": [
        "json",
        "csv"
       ]
      },
      "description": "csv returns the same rows as /api/forms.csv"
     }
    ],
    "responses": {
     "200": {
      "description": "Page of matching listings",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "api_version": {
           "type": "string"
          },
          "total": {
           "type": "integer"
          },
          "count": {
           "type": "integer"
          },
          "limit": {
           "type": "integer"
          },
          "offset": {
           "type": "integer"
          },
          "items": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/Listing"
           }
          }
         }
        }
       }
      }
     }
    }
   }
  },
  "/api/forms/{id}": {
   "get": {
    "operationId": "getForm",
    "summary": "Get one listing by id (form, workflow, or contract)",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      },
      "example": "US-TX-205"
     }
    ],
    "responses": {
     "200": {
      "description": "Listing",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Form"
        }
       }
      }
     },
     "404": {
      "description": "Not found"
     }
    }
   }
  },
  "/api/forms.json": {
   "get": {
    "operationId": "listFormsDump",
    "summary": "Full static dump of forms, workflows, and contracts",
    "responses": {
     "200": {
      "description": "Manifest"
     }
    }
   }
  },
  "/api/forms/{id}.json": {
   "get": {
    "operationId": "getFormJson",
    "summary": "Same as /api/forms/{id}, static file",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Listing"
     },
     "404": {
      "description": "Not found"
     }
    }
   }
  },
  "/api/listings.json": {
   "get": {
    "operationId": "listListings",
    "summary": "Slim catalog used by /api/forms search (every live item)",
    "responses": {
     "200": {
      "description": "Slim catalog"
     }
    }
   }
  },
  "/openapi.json": {
   "get": {
    "operationId": "openapi",
    "summary": "This OpenAPI document",
    "responses": {
     "200": {
      "description": "OpenAPI 3.1"
     }
    }
   }
  },
  "/mcp": {
   "get": {
    "operationId": "mcpDiscover",
    "summary": "Read-only MCP discovery (tools search_forms, find_forms, get_form, list_states, list_categories)",
    "responses": {
     "200": {
      "description": "MCP descriptor"
     }
    }
   },
   "post": {
    "operationId": "mcpJsonRpc",
    "summary": "JSON-RPC MCP: initialize, tools/list, tools/call (search_forms, get_form). No auth.",
    "responses": {
     "200": {
      "description": "JSON-RPC result"
     }
    }
   }
  },
  "/catalog.json": {
   "get": {
    "operationId": "catalog",
    "summary": "Legacy simple catalog",
    "responses": {
     "200": {
      "description": "Catalog"
     }
    }
   }
  },
  "/api/find": {
   "get": {
    "operationId": "findForms",
    "summary": "Describe-to-catalog matcher (read-only; never invents an official form)",
    "parameters": [
     {
      "name": "q",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string"
      },
      "description": "Plain-language description, e.g. form a Texas LLC"
     }
    ],
    "responses": {
     "200": {
      "description": "Closest listings we already sell, grouped by type",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     }
    }
   }
  },
  "/api/identify": {
   "get": {
    "operationId": "identifyForm",
    "summary": "Match an official form URL, file name, or title against the catalog (match / possible / none). Read-only.",
    "parameters": [
     {
      "name": "url",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "Official form URL"
     },
     {
      "name": "name",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "PDF file name"
     },
     {
      "name": "t",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "Title or first line of text"
     }
    ],
    "responses": {
     "200": {
      "description": "Match result",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     }
    }
   }
  },
  "/api/forms.csv": {
   "get": {
    "operationId": "exportFormsCsv",
    "summary": "Catalog export as CSV (same filters as /api/forms; no personal data). This is a one-time export of public catalog rows.",
    "parameters": [
     {
      "name": "q",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "Search text"
     },
     {
      "name": "state",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "State code, name, or jurisdiction"
     },
     {
      "name": "type",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "court, government, template, letter, workflow, contract"
     },
     {
      "name": "category",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "Category slug"
     }
    ],
    "responses": {
     "200": {
      "description": "CSV with a header row: id,title,type,official_government_form,state,state_name,category,price,currency,page_url,pay_url,official_source_url,issuing_agency",
      "content": {
       "text/csv": {
        "schema": {
         "type": "string"
        }
       }
      }
     }
    }
   }
  }
 },
 "components": {
  "schemas": {
   "Listing": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string"
     },
     "title": {
      "type": "string"
     },
     "description": {
      "type": "string"
     },
     "type": {
      "type": "string",
      "enum": [
       "court",
       "government",
       "template",
       "letter",
       "workflow",
       "contract"
      ]
     },
     "category": {
      "type": "string"
     },
     "state": {
      "type": "string"
     },
     "state_name": {
      "type": "string"
     },
     "price": {
      "type": "number"
     },
     "currency": {
      "type": "string"
     },
     "page_url": {
      "type": "string",
      "format": "uri"
     },
     "pay_url": {
      "type": "string",
      "format": "uri"
     }
    }
   },
   "Form": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string"
     },
     "title": {
      "type": "string"
     },
     "description": {
      "type": "string"
     },
     "type": {
      "type": "string"
     },
     "category": {
      "type": "string"
     },
     "summary": {
      "type": "string"
     },
     "official_status": {
      "type": "string"
     },
     "page_url": {
      "type": "string",
      "format": "uri"
     },
     "pay_url": {
      "type": "string",
      "format": "uri"
     },
     "json_url": {
      "type": "string",
      "format": "uri"
     },
     "price": {
      "type": "object",
      "properties": {
       "amount": {
        "type": "number"
       },
       "currency": {
        "type": "string"
       },
       "billing": {
        "type": "string"
       }
      }
     }
    }
   }
  }
 }
}
