# API Documentation Generator

> AI-powered API documentation generation tool that auto-generates comprehensive API docs from source code, including OpenAPI/Swagger specs, Postman collections, and markdown documentation with examples and authentication details.

- Skill: `xspoonai/api-documentation-generator` (Agent Skill, multi-file: 6 files)
- Install (CLI): `npx skillmds@latest add xspoonai/api-documentation-generator`
- Raw SKILL.md: https://api.skillmd.com/api/skills/xspoonai/api-documentation-generator/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Docs & Writing
- Author: XSpoonAi (https://skillmd.com/u/xspoonai)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/xspoonai/api-documentation-generator

---


## Usage Examples

### Generate OpenAPI Specification
```python
from scripts.openapi_generator import OpenAPIGenerator

generator = OpenAPIGenerator()
spec = generator.generate_spec(
    source_code=api_code,
    framework="fastapi",
    include_examples=True
)
print(f"OpenAPI version: {spec['openapi']}")
print(f"Endpoints: {len(spec['paths'])}")
```

### Create Postman Collection
```python
from scripts.postman_generator import PostmanGenerator

generator = PostmanGenerator()
collection = generator.create_collection(
    endpoints=endpoints,
    auth_schemes=["bearer", "api_key"]
)
print(f"Collection: {collection['info']['name']}")
print(f"Requests: {len(collection['item'])}")
```

### Generate Markdown Documentation
```python
from scripts.markdown_generator import MarkdownGenerator

generator = MarkdownGenerator()
markdown = generator.generate_docs(
    endpoints=endpoints,
    include_examples=True
)
print(f"Documentation generated: {len(markdown)} characters")
```

### Analyze API Code
```python
from scripts.code_analyzer import CodeAnalyzer

analyzer = CodeAnalyzer()
analysis = analyzer.analyze_code(
    source_code=api_code,
    framework="fastapi"
)
print(f"Endpoints found: {analysis['endpoint_count']}")
print(f"Schemas detected: {analysis['schema_count']}")
```

## Output Format

All modules return structured JSON:

```json
{
  "documentation_type": "string",
  "format": "openapi|markdown|postman|html",
  "endpoints_documented": number,
  "schemas_generated": number,
  "examples_included": boolean,
  "authentication": ["array"],
  "openapi_spec": "object",
  "postman_collection": "object",
  "markdown_content": "string",
  "validation_status": "valid|warning|error",
  "recommendations": ["array of actionable items"]
}
```

## Severity Levels

| Level | Meaning | Impact | Action |
|-------|---------|--------|--------|
| CRITICAL | Missing authentication documentation | High risk | Document immediately |
| HIGH | Incomplete endpoint documentation | Moderate risk | Complete within sprint |
| MEDIUM | Missing request/response examples | Low-moderate risk | Add examples |
| LOW | Minor formatting inconsistency | Low risk | Consider for future |

## Version & Support

- **Version**: 1.0.0
- **Released**: February 2026
- **Status**: Production Ready
- **Confidence**: 93%

## Future Enhancements (v1.1.0)

- GraphQL schema documentation
- WebSocket endpoint documentation
- gRPC service documentation
- Automated changelog generation
- Multi-version API documentation
- Interactive API playground generation
- SDK code generation
- API diff comparison between versions
- Automated testing from documentation
- Integration with API management platforms

---

