API
API features in Larasonic
Larasonic comes with built-in API capabilities powered by Laravel Sanctum, allowing you to easily create and manage API tokens for authentication. It also includes automatic API documentation generation using Scribe.
π API Authentication
Larasonic uses Laravel Sanctum for API authentication. You can generate tokens in two ways:
Via Web Interface
Visit /api/tokens
in your browser to manage API tokens (requires appropriate permissions). Here you can:
- Create new tokens with specific abilities
- View existing tokens
- Revoke tokens
Via API
This is not supported yet. Please let us know if you need this feature in the roadmap
Using Tokens
Include the token in your API requests:
For more details on API authentication, check out the Laravel Sanctum documentation.
π API Documentation
Larasonic uses Scribe to automatically generate comprehensive API documentation. This includes:
- Interactive API documentation
- Postman collection export
- OpenAPI (Swagger) specification
- Request/response examples
To generate the documentation:
The docs will be available at /docs
by default.
π Example Endpoints
Hereβs a sample API endpoint from the app/Http/Controllers/ApiUserController.php
:
For API documentation features, visit the Scribe documentation.