> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mailofly.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Invent a New Signal

> Teach Mailofly about a brand-new signal and what goodies it can carry in its backpack.

Before your app starts shouting signals to Mailofly, you can register a new event definition!

This teaches Mailofly what name the signal will use (like `user.signed_up`) and what properties to expect in its backpack (like `first_name` or `plan`).

### Body

<ParamField body="name" type="string" required>
  The unique name for this signal! Usually written with dot notation, like `"user.signup"` or `"item.purchased"`.
</ParamField>

<ParamField body="schema" type="object">
  A map of expected backpack items and their types (`string`, `number`, or `boolean`). For example:

  ```json theme={null}
  {
    "first_name": "string",
    "amount": "number",
    "is_trial": "boolean"
  }
  ```
</ParamField>

### Response

<ResponseField name="object" type="string">
  Always says `"event"`.
</ResponseField>

<ResponseField name="id" type="string">
  The unique ID badge assigned to this new signal definition.
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST 'https://api.mailofly.com/events' \
    -H 'Authorization: Bearer mf_live_xxxxxxxx' \
    -H 'Content-Type: application/json' \
    -d '{
      "name": "user.signup",
      "schema": {
        "first_name": "string",
        "plan": "string"
      }
    }'
  ```

  ```javascript Node.js theme={null}
  import { Mailofly } from "@mailofly/node";

  const mailofly = new Mailofly("mf_live_xxxxxxxx");

  const eventDef = await mailofly.events.create({
    name: "user.signup",
    schema: {
      first_name: "string",
      plan: "string"
    }
  });

  console.log("Invented signal ID:", eventDef.id);
  ```
</RequestExample>

<ResponseExample>
  ```json 201 Created theme={null}
  {
    "object": "event",
    "id": "evt_4b219081-3a11-4821-b810-091827361821"
  }
  ```
</ResponseExample>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.