Skip to main content
Hooks allow you to execute custom code in response to Directus events.

Creating a Hook

Hook Structure

Event Types

Item Events

  • items.create
  • items.update
  • items.delete
  • items.promote
  • items.sort

Authentication Events

  • auth.login
  • auth.create
  • auth.update

Server Events

  • server.start
  • server.stop

Request Events

  • request
  • response

Filter Hooks

Modify data before it’s processed:

Action Hooks

Execute code after an action:

Context

Hooks receive context with:

Next Steps

Operations

Create flow operations

Endpoints

Create API endpoints