Database

Custom actions

Add your own endpoints to a table when the five generated ones are not enough.

A custom action is an endpoint you define on a table, backed by a handler. It is how you express anything the generated CRUD cannot: a multi-condition query, a workflow, a calculation, an external call.

POST /{appUid}/autocrud/{table}/actions/{action}

When to reach for one

  • The query needs more than one equality — a date range, an OR, a join.
  • The operation is a workflow, not a write. "Refund this order" touches several tables and must be atomic.
  • You want a narrower permission than a whole table. orders:refund is a far better thing to grant an agent than orders:update.

That last point is the one people miss. A custom action lets you grant an intent rather than a capability, which matters enormously when the caller is an AI agent.

Defining one

Actions are configured on the table in the console and backed by a handler. Each carries its own policy key, so it is authorized independently of the table's CRUD.

They are agent tools too

A custom action with a policy bound to an agent's role becomes one of that agent's tools automatically, with an input schema derived from the action's own schema. You do not register it anywhere.

This is the cleanest way to give an agent real power safely: write the risky operation once, as a handler that enforces its own rules, and expose that rather than the raw table.

Next

On this page