api.json

reference

by Christian Clausen

on Jun 29, 2025 (created Nov 14, 2024) • 1 min

The api.json file, is one of the special-purpose files in the event-configuration folder. This file specifies which events can be whitelisted and optionally how the HTTP endpoint should behave.

File Format

The format for the file is

interface ApiConfig { [event: string]: { waitFor?: number, } }

Where waitFor is in milliseconds. If a $reply event is posted within that time, that event's payload is returned to the caller. Otherwise, Queued job. is returned. The default timeout is 5000 milliseconds (5 seconds).

Example

In this example, we have events get-data and add-data, the latter of which will wait for 2 seconds:

api.json
{ "get-data": { }, "add-data": { "waitFor": 2000 } }

Remember to Deploy It

Changes to the event configurations only take effect after we've deployed the repository. We can deploy event-configuration with the CLI:

$ mm deploy
Christian Clausen
Nov 14, 2024