Skip to main content

What Are API Types?

API types allow you to segment your API documentation based on different consumers or use cases. Each API type represents a distinct set of routes with its own prefix, making it easy to generate targeted documentation.

Admin API

Backend management endpoints for administrators

Mobile API

Optimized endpoints for mobile applications

Site API

Public-facing endpoints for web clients

Configuration

API types are configured in config/openapi.php:

Configuration Options

Type: string (required)The route prefix that identifies this API type. Routes starting with this prefix will be included in this API type’s documentation.
The prefix must match exactly. Use lowercase and avoid trailing slashes.
Type: string (optional)Reference to the route file where this API type’s routes are defined. This is informational and helps developers understand where routes are located.
Type: string (optional)A detailed description of what this API type is for. Used in generated documentation.
Type: string (optional)The display name used in Postman collections and Insomnia workspaces. This is how the API type will appear in folder structures.
Type: string (optional)An emoji or icon identifier used for visual distinction in documentation.
Type: array (optional)Middleware groups applied to this API type’s routes. Used for documenting security requirements.
Type: boolean (default: true)Whether this API type is active. Disabled API types are completely ignored during generation.
Setting enabled: false prevents any routes with this prefix from appearing in documentation.

How API Types Work

Route Matching

Routes are assigned to API types based on their URI prefix:

Internal Matching Logic

Filtering by API Type

Generate Specific API Types

Generate documentation for specific API types only:

Filter Effect on Output

When API types are filtered, the generated title reflects the selection:

Validation & Error Handling

The package validates API types before generation:

Invalid API Type

Disabled API Type

Organization in Output

Postman Collection Structure

Insomnia Workspace Structure

OpenAPI Tags

Each API type is reflected in OpenAPI tags:

Adding Custom API Types

You can easily add your own API types:
1

Define API Type

Add your configuration to config/openapi.php:
2

Create Routes

Define routes with the matching prefix:
3

Generate Documentation

The new API type is automatically recognized and documented.

Best Practices

Consistent Naming
  • Use lowercase for prefixes: admin, not Admin
  • Use descriptive folder_name values: API Admin instead of just Admin
  • Keep icons consistent across similar API types
Logical Separation
  • Separate by consumer: admin, mobile, web
  • Or by domain: payments, users, products
  • Avoid mixing both strategies in the same application
Security Configuration
  • Document middleware requirements in the config
  • Use different authentication schemes per API type
  • Consider rate limiting per API type

Common Use Cases

Separate APIs for web, mobile, and admin:
Benefits:
  • Mobile team only sees mobile endpoints
  • Admin team has separate documentation
  • Different rate limits per platform
Use API types for versioning:
Generate separate documentation for each version to avoid confusion.
Document internal vs external APIs:

Next Steps

Environments

Configure deployment environments for your API types

Routes Configuration

Advanced route filtering and exclusion patterns