{
  "openapi": "3.1.0",
  "info": {
    "title": "Sedes LLC Formation API",
    "description": "Public API for LLC formation, state requirements, pricing quotes, and compliance. Sedes is the first AI-native business formation service. Use this API to check state requirements, get formation quotes, file LLCs, and monitor compliance.",
    "version": "1.0.0",
    "contact": {
      "name": "Sedes API Support",
      "url": "https://sedesra.com/api-docs",
      "email": "support@aedilis.app"
    },
    "license": {
      "name": "Proprietary"
    }
  },
  "servers": [
    {
      "url": "https://sedesra.com/api/v1",
      "description": "Production"
    }
  ],
  "paths": {
    "/states": {
      "get": {
        "summary": "List all US states with LLC formation data",
        "description": "Returns LLC formation requirements, fees, privacy features, and compliance info for all 50 states + DC. Supports filtering by anonymous LLC availability and income tax status.",
        "operationId": "listStates",
        "parameters": [
          {
            "name": "anonymous",
            "in": "query",
            "description": "Filter to states that allow anonymous LLCs",
            "schema": { "type": "string", "enum": ["true"] }
          },
          {
            "name": "noIncomeTax",
            "in": "query",
            "description": "Filter to states with no state income tax",
            "schema": { "type": "string", "enum": ["true"] }
          }
        ],
        "responses": {
          "200": {
            "description": "List of states",
            "content": {
              "application/json": {
                "example": {
                  "success": true,
                  "data": {
                    "states": [
                      {
                        "code": "WY",
                        "name": "Wyoming",
                        "llcFilingFee": 100,
                        "annualReportFee": 60,
                        "franchiseTax": null,
                        "anonymousLlcAllowed": true,
                        "memberDisclosure": false,
                        "stateIncomeTax": false,
                        "processingDays": 15,
                        "seriesLlcAllowed": true,
                        "chargingOrderExclusive": true
                      }
                    ],
                    "count": 51
                  }
                }
              }
            }
          }
        }
      }
    },
    "/states/{code}": {
      "get": {
        "summary": "Get detailed LLC formation info for a specific state",
        "description": "Returns comprehensive data including filing fees, compliance requirements, privacy features, tax rates, pros/cons, and estimated costs for forming an LLC in the specified state.",
        "operationId": "getState",
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "description": "2-letter US state code (e.g., WY, CA, TX)",
            "schema": { "type": "string", "pattern": "^[A-Z]{2}$" }
          }
        ],
        "responses": {
          "200": { "description": "State detail" },
          "404": { "description": "State not found" }
        }
      }
    },
    "/recommend-state": {
      "post": {
        "summary": "Get AI-powered state recommendation for LLC formation",
        "description": "Analyzes your business type, location, privacy needs, and budget to recommend the optimal US state for LLC formation. Returns top 3 recommendations with scores, reasons, and cost comparisons.",
        "operationId": "recommendState",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "businessType": { "type": "string", "description": "Type of business (freelance, ecommerce, real_estate, startup, consulting)" },
                  "homeState": { "type": "string", "description": "2-letter state code where you live" },
                  "privacyLevel": { "type": "string", "enum": ["standard", "privacy", "anonymous"] },
                  "budget": { "type": "string", "enum": ["low", "medium", "high"] },
                  "entityType": { "type": "string", "enum": ["llc", "corp", "s_corp", "series_llc"] }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "description": "Top 3 state recommendations with scores and reasons" }
        }
      }
    },
    "/check-name": {
      "post": {
        "summary": "Check if a business name is available for LLC formation",
        "description": "Validates the business name format and checks availability in the specified state. Returns availability status, state-specific naming requirements, and alternative name suggestions.",
        "operationId": "checkName",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["name", "state"],
                "properties": {
                  "name": { "type": "string", "description": "Proposed business name (must include LLC designator)" },
                  "state": { "type": "string", "description": "2-letter state code" }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "description": "Name availability result with suggestions" }
        }
      }
    },
    "/quote": {
      "post": {
        "summary": "Get a transparent, itemized formation quote",
        "description": "Calculates the exact cost of forming an LLC including state filing fees, Sedes service fee ($29), and optional add-ons. Includes comparison with competitor pricing. No hidden fees.",
        "operationId": "getQuote",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["state"],
                "properties": {
                  "state": { "type": "string", "description": "2-letter state code" },
                  "entityType": { "type": "string", "default": "llc" },
                  "addOns": {
                    "type": "array",
                    "items": { "type": "string", "enum": ["nominee_organizer", "nominee_manager", "expedited_filing", "second_entity"] }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "description": "Itemized quote with competitor comparison" }
        }
      }
    },
    "/formations": {
      "post": {
        "summary": "Start an LLC formation",
        "description": "Initiates the LLC formation process. Returns a payment URL to complete the order. Requires authentication.",
        "operationId": "startFormation",
        "security": [{ "bearerAuth": [] }, { "apiKey": [] }],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["state", "businessName"],
                "properties": {
                  "state": { "type": "string" },
                  "entityType": { "type": "string", "default": "llc" },
                  "businessName": { "type": "string" },
                  "managementType": { "type": "string", "enum": ["member_managed", "manager_managed"] },
                  "members": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": { "type": "string" },
                        "title": { "type": "string" },
                        "ownershipPercent": { "type": "number" }
                      }
                    }
                  },
                  "privacyLevel": { "type": "string", "enum": ["standard", "privacy", "anonymous"] }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "description": "Formation started with payment URL" },
          "401": { "description": "Authentication required" }
        }
      }
    },
    "/formations/{id}": {
      "get": {
        "summary": "Check formation status",
        "description": "Returns the current status of an LLC formation order including filing status, documents, and compliance items.",
        "operationId": "getFormation",
        "security": [{ "bearerAuth": [] }, { "apiKey": [] }],
        "parameters": [
          { "name": "id", "in": "path", "required": true, "schema": { "type": "string" } }
        ],
        "responses": {
          "200": { "description": "Formation details and status" }
        }
      }
    },
    "/compliance/requirements": {
      "post": {
        "summary": "Get compliance requirements for a state and entity type",
        "description": "Returns all ongoing compliance obligations including annual reports, franchise taxes, publication requirements, and tax deadlines for the specified state and entity type.",
        "operationId": "getComplianceRequirements",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["state"],
                "properties": {
                  "state": { "type": "string" },
                  "entityType": { "type": "string", "default": "llc" }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "description": "List of compliance requirements with deadlines and costs" }
        }
      }
    },
    "/health": {
      "get": {
        "summary": "API health check",
        "operationId": "healthCheck",
        "responses": {
          "200": {
            "description": "Service status",
            "content": {
              "application/json": {
                "example": { "status": "ok", "service": "sedes", "version": "1.0.0" }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key",
        "description": "API key for programmatic access. Get yours at https://sedesra.com/dashboard/api-keys"
      },
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Firebase ID token for authenticated users"
      }
    }
  }
}
