# Reference

- [Endpoints](#endpoints)
- [List parameters](#list-parameters)
- [A resource](#a-resource)
- [A page](#a-page)
- [Errors](#errors)
- [Commands](#commands)

Paths below are for a repository named `posts` with the default prefix.

## Endpoints

| Request | Action | Success | Body |
| --- | --- | --- | --- |
| `GET /api/restify/posts` | `Index` | `200` | [A page](#a-page) |
| `GET /api/restify/posts/{id}` | `Show` | `200` | `{ "data": resource }` |
| `POST /api/restify/posts` | `Store` | `201`, with a `Location` header | `{ "data": resource }` |
| `PUT /api/restify/posts/{id}` | `Update` | `200` | `{ "data": resource }` |
| `POST /api/restify/posts/{id}` | `Update` | `200` | `{ "data": resource }`, as `PUT` |
| `PATCH /api/restify/posts/{id}` | `Update` | `200` | `{ "data": resource }` |
| `DELETE /api/restify/posts/{id}` | `Delete` | `204` | Empty |
| `DELETE /api/restify/documents/{id}/field/{field}` | `Update` | `204`, or `404` when `{field}` isn't a deletable file field | Empty. Deletes one file field's file. See [Files and images](files.md#replacing-and-deleting-files) |
| `GET /api/restify/posts/actions` and `/{id}/actions` | The action's `can_see` | `200` | `{ "data": [action, ..] }` |
| `POST /api/restify/posts/actions?action={key}` (or `/action`) | The action's `can_run` | `200` | What `handle` returned |
| `POST /api/restify/posts/{id}/actions?action={key}` (or `/{id}/action`) | The action's `can_run` | `200` | What `handle` returned |
| `GET /api/restify/posts/getters` and `/{id}/getters` | The getter's `can_see` | `200` | `{ "data": [getter, ..] }` |
| `GET /api/restify/posts/getters/{key}` | The getter's `can_run` | `200` | What `handle` returned |
| `GET /api/restify/posts/{id}/getters/{key}` | The getter's `can_run` | `200` | What `handle` returned |
| `GET /api/restify/posts/filters` | `AllowRestify` | `200` | `{ "data": [filter, ..] }`. See [Listing the filters](filtering.md#listing-the-filters) |
| `POST /api/restify/posts/apply-restify-advanced-filters` | `Index` | `200` | [A page](#a-page), filtered by the body's `filters`. See [Advanced filters](filtering.md#advanced-filters) |
| `GET /api/restify/search?search=..` | `AllowRestify` and `Show`, in each repository added with `global_search` | `200` | `{ "data": [result, ..] }`. See [Global search](filtering.md#global-search) |
| `POST /api/restify/posts/bulk` | `StoreBulk`, once | `200` | `{ "data": [model, ..] }`, each model's own JSON |
| `POST /api/restify/posts/bulk/update` | `UpdateBulk`, per item | `200` | `{}` |
| `DELETE /api/restify/posts/bulk/delete` | `DeleteBulk`, per item | `200` | `[]` |
| `GET /api/restify/posts/{id}/comments` and `/{id}/comments/{commentId}` | `Show` on the post, then the comments' own action | As `GET /comments` and `GET /comments/{id}` | Only the post's comments. See [Relationships](relationships.md#nested-routes) |
| `POST`, `PUT`, `PATCH`, `DELETE` under `/api/restify/posts/{id}/comments` | `Show` and `Update` on the post, then the comments' own action | As the comments' own routes | The post's key is set on a new comment |
| `POST /api/restify/teams/{id}/attach/users` | `Attach("users")`, per user | `201` | `{ "data": [join row, ..] }` |
| `POST /api/restify/teams/{id}/detach/users` | `Detach("users")`, per user | `204` | Empty |
| `POST /api/restify/teams/{id}/sync/users` | `Sync("users")`, once | `200` | `[]` |
| `POST /mcp/restify` | | `200`, or `202` for a notification | A JSON-RPC message |
| `GET /api/restify/profile` | `Show`, on the logged-in user | `200` | `{ "data": resource }` |
| `PUT` or `POST /api/restify/profile` | `Update`, on the logged-in user | `200` | `{ "data": resource }` |
| `POST /api/register` | None | `200` | resource, with `meta.token` |
| `POST /api/login` | None | `200` | resource, with `meta.token` |
| `POST /api/logout` | None | `200` | `{ "message": "Successfully logged out." }` |
| `POST /api/forgotPassword` | None | `200` | `{ "message": "Reset password link sent to your email." }` |
| `POST /api/resetPassword` | None | `200` | `{ "message": "Your password has been successfully reset." }` |
| `POST /api/verify/{id}/{hash}` | None; the link's signature | `302` | Empty; `location` is your frontend's page |

These routes are only there when the application turns them on: `profile` adds the profile, `auth` adds register, login and logout, `password_reset` adds forgot and reset password, and `email_verification` adds verify. See [Authentication](authentication.md).

Every request is first asked for `Action::AllowRestify`, without a model. See [Authorization](authorization.md).

Create and update take a JSON object of the input struct's fields, at the top level: `{ "title": "Hello" }`. So does an action, and an action on the list also takes `repositories`. See [Actions and getters](actions.md).

The three bulk endpoints take a JSON array: of `Store` inputs, of `{ "id": .., ..fields }`, or of ids. See [Bulk operations](bulk.md).

## List parameters

| Parameter | Example | Does |
| --- | --- | --- |
| `search` | `?search=rust` | Keeps rows where a search column contains the text |
| A filter column or scope | `?votes=10`, `?filter[votes]=10`, `?body=null` | Keeps rows that match, as the field's kind of match compares. See [Filtering](filtering.md#filters) |
| `-` and a filter column or scope | `?-votes=10`, `?filter[-votes]=10` | Keeps rows that don't match |
| `sort` | `?sort=-votes,title` | Sorts; a leading `-` is descending. The key breaks ties |
| `page` or `page[number]` | `?page=2` | The page; default `1` |
| `perPage` or `page[size]` | `?perPage=50` | The page size; default `PER_PAGE`, at most `RESTIFY_MAX_PER_PAGE` when the application sets it |
| `related` | `?related=user,comments.user`, `?related=user[name]` | Loads the relationships the repository lists, with a dot for nested ones and `[a\|b]` to pick columns. Other names are ignored. Show takes it too. See [Relationships](relationships.md) |
| `include` | `?include=user` | The same as `related`, read only when `related` is absent |
| `relatablePerPage` | `?relatablePerPage=5` | How many related models a list relationship loads for each record. See [Relationships](relationships.md#limiting-lists-with-relatableperpage) |
| `filters` | `?filters=<base64 JSON>` | The [advanced filters](filtering.md#advanced-filters) |
| `group_by` | `?group_by=user_id` | Groups by `groupable` columns. See [Grouping](filtering.md#grouping) |
| `withMeta` | `?withMeta=true` | Adds each listed record's `meta`. See [Authorization](authorization.md#what-the-user-may-do-with-a-record) |

Any other parameter is ignored, as are filters and sorts on columns the repository doesn't mark.

## A resource

```json
{
    "id": "2",
    "type": "posts",
    "attributes": {
        "user_id": 1,
        "title": "Restify",
        "body": "APIs for humans and agents",
        "excerpt": "APIs for humans and...",
        "votes": 30,
        "featured": 0,
        "rating": "3.00",
        "published_at": "2026-01-03T12:30:00.000000Z",
        "created_at": "2026-01-03T12:00:00.000000Z"
    }
}
```

`id` is the model's key as a string. `type` is the repository's `resource_type`, the model's table by default. `attributes` holds the repository's [fields](fields.md), in the order it lists them: the ones the view shows and the request may see. This is the example app's post as an admin sees it; a list leaves `body` out, and another user doesn't get `featured`.

A shown resource also has `meta`, with what the user may do with it. See [Authorization](authorization.md#what-the-user-may-do-with-a-record). A listed resource has it only with `?withMeta=true`, and leaves `attributes` out when it shows no field.

A request with `?related=` adds a `relationships` key. Each loaded relationship is a resource of the related repository, a list of them, or the related model's own JSON for one declared with `Related::raw`. See [Relationships](relationships.md#what-a-response-contains).

## A page

```json
{
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 3,
        "path": "https://example.com/api/restify/posts",
        "per_page": 15,
        "to": 15,
        "total": 42
    },
    "links": {
        "first": "https://example.com/api/restify/posts?page=1",
        "next": "https://example.com/api/restify/posts?page=2",
        "path": "https://example.com/api/restify/posts",
        "prev": null,
        "filters": "/api/restify/posts/filters"
    },
    "data": [resource, resource]
}
```

As in Restify for PHP, there is no `last` link, a page link carries the page number alone, and `filters` is a path without the host.

## Errors

| Status | When | Body |
| --- | --- | --- |
| `401` | The middleware found no user | `{ "message": "Unauthenticated." }` |
| `403` | A request to the MCP server from a browser page on another origin that the CORS settings don't list for its path. See [MCP](mcp.md#calling-the-mcp-server-from-a-browser) | `{ "jsonrpc": "2.0", "error": { "code": -32600, "message": "The request's origin isn't allowed." } }` |
| `403` | `authorize`, a policy, or the input's own check refused | `{ "message": "This action is unauthorized." }`, or another text of [Authorization](authorization.md#what-a-refusal-looks-like) |
| `404` | No model has the key, or `query` leaves it out | `{ "message": "No query results for model [Post]." }` |
| `404` | No action or getter has the key, or no route has the path | `{ "message": ".." }`, such as `Action not found.` |
| `404` | The path's first part names no repository, such as `/api/restify/widgets` | `{ "message": "Repository widgets not found." }` (Restify for PHP answers `500`: a PHP bug) |
| `422` | The input is invalid | `{ "message": "..", "errors": { "field": [".."] } }` |
| `422` | `?group_by=` names a column that isn't `groupable` | `{ "message": "The column [..] is not allowed for grouping. Allowed columns are: .." }` |
| `422` | `?filters=` isn't base64 of a JSON list or object | `{ "message": "..", "errors": { "filters": [".."] } }` (Restify for PHP answers `500`: a PHP bug) |

A bulk request's field errors name the item by its position, such as `1.title`. See [Bulk operations](bulk.md#errors).

An MCP tool returns an error as a tool result with `isError: true`, in the words of Laravel's MCP server. See [MCP](mcp.md#when-a-call-fails).

## Commands

| Command | Does |
| --- | --- |
| `laravel restify:list` | Prints each repository, its endpoint and its columns, then its actions and getters |
| `laravel restify:list --json` | Prints the same as JSON, with the MCP tool names. An action or getter the MCP server doesn't serve, such as one of a repository with no `const MCP`, has no tool: `-` in the table, `null` in the JSON |
| `laravel restify:install` | Writes the two skills for AI coding agents to `.agents/skills` and `.claude/skills` |
| `laravel restify:install --path <dir>` | Writes them to another application directory |
| `laravel restify:openapi` | Prints the [OpenAPI document](openapi.md) as JSON |
| `laravel restify:openapi --output <path>` | Writes it to a file |
| `laravel restify:import <manifest>` | Writes an application's Restify code from a PHP application's `restify:export` file (feature `import`). Takes `--check`, `--migrations`, `--force` and `--path`. See [Migrating from Restify for PHP](migrating-from-php.md#import) |
