crudadmin/api exposes the admin models through a REST API at /admin/api/v1. It also serves an OpenAPI description, so API clients and AI agents learn the models without further documentation. Rows are read and written through the same code as the administration. Permissions, scopeAdminRows(), validation, uploads, history, admin rules and model events apply the same way.

Requirements

  • CrudAdmin 6 and crudadmin/framework 6.0.1 or newer
  • crudadmin/helpers for the login and every data endpoint. Without it, only the Swagger UI of signed in administrators is registered.

Installation

The service provider is discovered automatically. The package has no config file to publish and no commands. Its options live in config/admin.php, see REST API configuration.

What is exposed

Every registered admin model is available at /admin/api/v1/models/{table}. There is no opt-in. Access is limited by:
  • the permissions of the signed in administrator
  • the abilities of the token, read or write
  • $insertable, $editable and $deletable of the model
Rows contain the id, foreign keys, fields and the timestamps. Password fields, inaccessible fields and $hidden attributes are never returned.

Quick start

The full reference of the endpoints, tokens, parameters and responses is on the REST API page.