API Documentation

Automatic API reference generation

PRO FEATURE

CodeContext Pro automatically generates comprehensive API documentation from your code. It analyzes function signatures, extracts JSDoc comments, understands TypeScript types, and creates beautiful, interactive API references that developers love.

Why API Docs Matter

Developer Experience

Help developers integrate faster

Reduce Support

Answer questions before they're asked

Increase Adoption

Good docs = more users

What CodeContext Documents

Functions & Methods

  • Function signatures
  • Parameter types and descriptions
  • Return values
  • Async/await handling
  • Usage examples

Classes & Interfaces

  • Class hierarchies
  • Constructor documentation
  • Properties and methods
  • Interface definitions
  • Type relationships

REST APIs

  • Endpoint documentation
  • Request/response schemas
  • Authentication methods
  • Error codes
  • Rate limiting info

Advanced Features

  • GraphQL schemas
  • WebSocket events
  • CLI commands
  • Configuration options
  • Plugin APIs

Example API Documentation

# API Reference

## Classes

### UserManager

Manages user authentication and profile operations.

#### Constructor

```typescript
new UserManager(config: UserManagerConfig)
```

**Parameters:**
- `config` (UserManagerConfig) - Configuration options
  - `apiKey` (string) - API key for authentication
  - `baseUrl` (string) - Base URL for API requests
  - `timeout?` (number) - Request timeout in milliseconds (default: 5000)

#### Methods

##### authenticate

Authenticates a user with email and password.

```typescript
async authenticate(email: string, password: string): Promise<AuthResponse>
```

**Parameters:**
- `email` (string) - User email address
- `password` (string) - User password

**Returns:** Promise<AuthResponse>
- `token` (string) - JWT authentication token
- `user` (User) - User profile object
- `expiresIn` (number) - Token expiration time in seconds

**Example:**
```typescript
const userManager = new UserManager({ apiKey: 'your-api-key' });

try {
  const { token, user } = await userManager.authenticate(
    'user@example.com',
    'password123'
  );
  console.log('Authenticated:', user.name);
} catch (error) {
  console.error('Authentication failed:', error.message);
}
```

**Throws:**
- `AuthenticationError` - Invalid credentials
- `NetworkError` - Connection failed
- `ValidationError` - Invalid email format

Supported Languages

JavaScript/TypeScript

  • • JSDoc comments
  • • TypeScript types
  • • ES6+ features
  • • React components

Python

  • • Docstrings
  • • Type hints
  • • Class documentation
  • • Module structure

Java

  • • Javadoc comments
  • • Annotations
  • • Package structure
  • • Interface docs

Go

  • • Package comments
  • • Function docs
  • • Struct definitions
  • • Interface docs

Rust

  • • Doc comments
  • • Trait documentation
  • • Module structure
  • • Examples

More Coming

  • • C/C++
  • • Ruby
  • • PHP
  • • Swift

Interactive Documentation Features

Pro API documentation includes interactive features:

Try It Out

Live API playground where users can test endpoints directly from the docs

Code Generation

Generate client code in multiple languages with a single click

Search & Filter

Quickly find the endpoints or methods developers need

Version Switching

Support multiple API versions with easy switching

API Documentation Configuration

Customize API documentation generation:

{
  "generation": {
    "api": {
      "includePrivate": false,
      "includeInternal": false,
      "groupBy": "module",
      "sortBy": "alphabetical",
      "includeExamples": true,
      "exampleLanguages": ["javascript", "python", "curl"],
      "authentication": {
        "type": "bearer",
        "location": "header"
      },
      "baseUrl": "https://api.example.com/v1"
    }
  }
}

Getting Started with API Docs

Pro Feature

API documentation generation is available exclusively for Pro users.

1Upgrade to Pro: codecontext upgrade
2Generate API docs: codecontext generate api
3Find your docs in API.md

Related Topics

);