Guide
Events

Events

An event is a named SQL handler — the unit of logic behind every API endpoint, webhook, and subscription. Each event has a string identifier (used as NEXT "event_id" in CALL chains) and up to four SQL methods, one per HTTP verb.

Requires an active configuration. Select one on the Settings page first.

The Events page

The four methods

MethodHTTP verbPurpose
GETGETRead / select data
POSTPOSTCreate / process an incoming body
PUTPUTUpdate
DELETEDELETEDelete

An event only needs the methods it uses — an endpoint exposes exactly the verbs whose handlers contain SQL.

Layout

Two columns: a searchable event list on the left (each row shows the display name, the event_id, and the last-modified date) and the editor on the right. Use + New Event to create one.

Creating an event

  1. Click New Event and give it a name and an event_id (the slug used to reference it).

  2. Fill in the SQL for the methods you need. For example, a POST handler that upserts users:

    INSERT INTO dictionary.users(ref, id, name)
    SELECT uuid(x.id), x.id, x.name
    FROM &params AS x(id int, name text)
    ON CONFLICT(ref) DO UPDATE SET name = x.name;
  3. Save the event. It is now selectable when you build an API endpoint.

Reusing a Playground query

Next to the method tabs is a From history picker (history icon). It lists your recent Playground queries so you can drop one straight into a method — the picker stays open after a selection so you can try several.

Calling external services

Event SQL can invoke CALL providers to reach outside the database — Telegram, AI models, webhooks, Server-Sent Events, and agents. See AI & external services and CALL functions for the full set, for example:

SELECT CALL(TG_SEND_MESSAGE "bot" FROM (
    SELECT &chat_id AS chat_id, 'Order ready!' AS text TYPE OBJECT
)) AS sent;

Versioning

When branches exist, a snapshot selector appears next to Save. Choose a branch to save the event to that branch (the button becomes Save to snapshot) instead of production — see Versions.


Related: