{
  "openapi": "3.1.0",
  "info": {
    "title": "IERhub Texas electrician license verify API",
    "version": "1.0.0",
    "description": "Two ways to check a Texas electrician license against the public TDLR file. The verify route /api/license/{number} returns the status and the expired fee steps, 100 calls a day for each key. The MCP endpoint /api/mcp answers JSON-RPC 2.0 tool calls for AI assistants, 100 calls a day for each key or address. Keys are issued by email to staff@ierhub.com."
  },
  "servers": [{ "url": "https://ierhub.com" }],
  "paths": {
    "/api/license/{number}": {
      "get": {
        "operationId": "verifyLicense",
        "summary": "Verify one license by number",
        "security": [{ "apiKey": [] }],
        "parameters": [
          { "name": "number", "in": "path", "required": true, "schema": { "type": "string", "pattern": "^[0-9A-Za-z-]{1,20}$" } },
          { "name": "type", "in": "query", "required": false, "description": "The TDLR license type, for a number that more than one type holds.", "schema": { "type": "string" } }
        ],
        "responses": {
          "200": {
            "description": "The public record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["type", "number", "expires", "state"],
                  "properties": {
                    "type": { "type": "string" },
                    "number": { "type": "string" },
                    "county": { "type": ["string", "null"] },
                    "expires": { "type": "string", "format": "date" },
                    "state": { "type": "string", "enum": ["active", "expired_under_90d", "expired_90d_to_18m", "expired_18m_to_36m", "expired_over_36m"] },
                    "renewalFee": { "type": "number" },
                    "lateFee": { "type": "number", "description": "Fee of the 18 to 36 month mail route. Only for an expired state." },
                    "mailBy": { "type": "string", "format": "date", "description": "The 36 month date. Only for an expired state." },
                    "pulled": { "type": ["string", "null"], "format": "date" },
                    "matches": { "type": "array", "items": { "type": "object" } }
                  }
                }
              }
            }
          },
          "401": { "description": "The X-API-Key header is missing or wrong." },
          "404": { "description": "No license in the TDLR file matches the number." },
          "429": { "description": "More than 100 calls today for this key." },
          "503": { "description": "The license file is not reachable at this moment." }
        }
      }
    },
    "/api/mcp": {
      "post": {
        "operationId": "mcpJsonRpc",
        "summary": "100 calls a day for each key or address",
        "description": "Model Context Protocol endpoint over HTTP. Lists and calls nine tools for Texas electrician license lookup. Server card: https://ierhub.com/.well-known/mcp/server-card.json",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "jsonrpc",
                  "id",
                  "method"
                ],
                "properties": {
                  "jsonrpc": {
                    "type": "string",
                    "enum": [
                      "2.0"
                    ]
                  },
                  "id": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "integer"
                      }
                    ]
                  },
                  "method": {
                    "type": "string",
                    "enum": [
                      "initialize",
                      "ping",
                      "tools/list",
                      "tools/call"
                    ]
                  },
                  "params": {
                    "type": "object",
                    "description": "For tools/call: name (tool name) and arguments (object)."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "A JSON-RPC 2.0 reply with result or error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "jsonrpc",
                    "id"
                  ],
                  "properties": {
                    "jsonrpc": {
                      "type": "string",
                      "enum": [
                        "2.0"
                      ]
                    },
                    "id": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "integer"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "result": {
                      "type": "object"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "integer"
                        },
                        "message": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "More than 100 calls today for this key or address."
          }
        }
      }
    }
  },
  "components": { "securitySchemes": { "apiKey": { "type": "apiKey", "in": "header", "name": "X-API-Key" } } }
}
