API Maker

The backend engine for the AI era

EventsEpisode 21 5:10 9 chapters November 2026

Event-Driven APIs: React to Saves, Code and HTTP Calls

Code that reacts to what happens: after a save, from your code, or over HTTP, without a queue or a worker to run. Follow the events of Calm Home: an order saved, a row written behind the answer, a chain of events emitted from code, and a careless loop stopped by API Maker.

In the playlists The complete course Events & realtime

Chapters

What you will learn

  • An event and its trigger
  • A listener that runs behind the answer
  • A real save fires it
  • An event emitted from code
  • A chain of events
  • A careless line, and a loop stopped
In the docsEvents
Transcript620 words · click a time to play from there

Intro

Events are code that reacts when something happens: after a save, from your code, or over HTTP. You do not need a queue, or a worker to run. In this video, Calm Home saves an order, writes a row after the answer, runs a chain of events, and stops a loop.

Reactions, the usual way

Reacting to a save is usually messy. Side effects are packed into the API that saves. Or you install a message queue and its workers, just for a few lines of code. And one day, two handlers call each other for ever. With API Maker, an event names the APIs that start it. Its listeners run after the answer is sent, in any language. And a chain that comes back to itself is refused.

In this video: an event and what starts it, a listener, a real save, a chain started from code, and a loop that is stopped.

An event and its trigger

Open APIs and Logic, then Events. Click Add New, and name it orders/placed. The slash makes a folder. Turn on Automatically Trigger On API Hit, and click Add. Pick Instance APIs, then mysql, then sales, then orders, and Save single-multiple. Add it to the event. Now every save of an order starts this event. Save it. Open the folder orders, pick the event, and add a listener. Name it log-event.

Its code gets the answer of the save in g.req.eventData. For each saved order, it writes a row in order_events. Save it.

A real save

Open API Testing. Pick mysql, then sales, then orders, and Save single-multiple. In the body, we put a new order, CH-2026-0950. Send. The order is saved, and the answer comes back at once. The event runs after the answer. Now pick order_events, and Get all, with a find. We ask for the rows from the event. Here is the row that log-event wrote: PLACED, for that order.

A chain from code

A listener can also start another event from code. award-points is a second listener of orders/placed. It starts customers/points with g.sys.system.emitEvent, and waits for its answer. The listener of customers/points, named loyalty, gives one point for every ten spent. To see the whole chain, pick System APIs, then Emit event. In the body, we send orders/placed, with the data that a save sends. Send. Both listeners answer, in their order.

log-event logged the order. And award-points carries the answer of customers/points:

A loop stopped

twelve points. Now we add a careless line. loyalty starts orders/placed again. So orders/placed would start customers/points, which would start orders/placed, for ever. Pick System APIs, then Emit event. Open the Body tab, with the same body. Send. The answer is four hundred: circular chain found in event emitting. It shows orders/placed, customers/points, orders/placed. A chain can go as deep as it needs. But going back to an event that is still running is refused.

Good to know

Good to know. Listeners run in their order. If one fails, the next one still runs. Each listener has a time limit. If you leave it empty, it uses the time limit of the sandbox. Custom APIs and system APIs can start an event too, and listeners can be written in eight languages. Over HTTP, Emit event needs a System API Setting, like every system API. Video nineteen shows it.

Built on standards

Side effects are declared in one place. They are not hidden inside the API. Every reaction has a name, an order, a time limit, and its history in Git. And a loop is refused, even in code that an AI assistant wrote.

Recap

To sum up. Events start from the APIs you choose. Listeners run after the answer. Code can start a chain of events. And loops are refused. Next: WebSockets, for live data without a realtime server. API Maker. Build faster, spend smarter, deliver better.