API: CRUD & Index Queries
The API adapter exposes REST routes under its configured prefix. The default is /api/admin. A route works only when the API package is installed, the Resource is registered, the Resource opts into the requested operation, and the caller passes the configured authentication and authorization checks.
Resource endpoints
| Method | Path | What it does |
|---|---|---|
GET | /api/admin/resources/{resource} | Lists records readable through this Resource. |
POST | /api/admin/resources/{resource} | Creates a record using its API create allowlist. |
GET | /api/admin/resources/{resource}/{record} | Shows one record. |
PATCH | /api/admin/resources/{resource}/{record} | Updates an allowed subset of fields. |
DELETE | /api/admin/resources/{resource}/{record} | Deletes a record when the Resource enables deletion. |
{resource} is the registered slug, such as customers; {record} is the model's route key. The prefix can be changed in config/seviaflow-api.php.
Filter, search, sort and paginate the index
Index parameters are combined with the Resource's table definition. Search uses columns configured as searchable, sorting uses configured sortable columns, and filter values are matched to filters declared on the Resource table.
| Parameter | Example | Meaning |
|---|---|---|
search | search=acme | Searches the Resource's searchable columns. The API trims the value and limits it to 200 characters. |
sort | sort=name | Requests sorting by a column declared sortable in table(). |
direction | direction=asc | Sets ascending or descending order. If omitted, the direction defaults to ascending. |
filter[key] | filter[status]=active | Sets a value for a filter whose name is status. The accepted values depend on that filter's type and options. |
per_page | per_page=25 | Sets page size. The default is 15; the configured maximum is 100. |
page | page=2 | Selects the result page. It defaults to page 1. |
GET /api/admin/resources/customers?search=acme&sort=name&direction=asc&per_page=25&page=1&filter[status]=active
For a filter to affect results, declare it in the Resource's table() definition. The same filter and query behavior is used by the UI list and API index.
Read the response
{
"data": [
{ "id": 42, "name": "Acme Ltd", "status": "active" }
],
"meta": {
"current_page": 1,
"per_page": 25,
"total": 1
}
}
data contains only the fields in the Resource's API readable([...]) allowlist. meta.current_page and meta.per_page describe the returned page. meta.total is included when the configured pagination mode is length-aware.
Authorization and errors
Every list and record operation is checked through Core Resource authorization. The configured API middleware authenticates the request; Resource permissions and Laravel policies decide what the authenticated user may do. A missing or invalid credential normally returns 401; a user who is authenticated but not permitted receives 403. Read Authorization before exposing real records.
Use Exposing a Resource to configure the field and operation allowlists. The API package does not install Sanctum or create credentials for your application.
Get Started