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

# Send an event

> Learn how to send an event to Masivo's REST API

<Note>
  Check the complete list of parameters and responses of the [`POST Emit
      event`](/api-reference/behavior/events/post)
</Note>

### What is an event?

A Customer Event is any action performed by a customer that can activate certain behavior-based campaigns.
For instance, events can include actions like completing a purchase, submitting a survey, or registering on your platform.

You can send different types of events to Masivo, which will monitor them and apply your configured rules to distribute rewards through campaigns.
However, only events that match the campaign's specific criteria will successfully trigger those campaigns.

### Emit an Event

When emitting an event, the customer, brand, and event type must be defined and included in the request. The other values are optional, depending on the nature of the event to be emitted.

```typescript theme={null}
const payload = {
  customer_id: "unique-customer-id",
  brand_id: "unique-brand-id",
  type: "PURCHASE",
  // Optional: ISO 8601 timestamp with a timezone (UTC Z or an explicit offset)
  issued_at: "2026-03-25T10:00:00.000Z",
  // Optional values
  order: {
    purchase_id: "unique-purchase-id",
    channel_id: "unique-channel-id",
    store_id: "unique-store-id",
    value: 20.95,
    discounted_value: 10.95,
    products: [
      {
        sku: "<string>",
        amount: 123,
        value: 123,
        discounted_value: 123,
        redeem: [
          {
            id: "3c90c3cc-0d44-4b50-8888-8dd25736052a",
            amount: 1,
          },
        ],
        tags: {},
        metadata: {},
      },
    ],
    shipping: {
      value: 3.25,
      discounted_value: 2.25,
      redeem: [
        {
          id: "3c90c3cc-0d44-4b50-8888-8dd25736052a",
          amount: 1,
        },
      ],
      tags: {},
      metadata: {},
    },
    payment_method: "CREDIT", "CREDIT" | "DEBIT"
    redeem: [
      {
        id: "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        amount: 1,
      },
    ],
    metadata: {},
  },
  fulfilled: true,
  reserve: 1,
  redeem: [
    {
      id: "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      amount: 1,
    },
  ],
  tags: {},
  metadata: {},
}

const response = await fetch("https://app.masivo.ai/api/storefront/v1/behavior/events", {
  method: "POST",
  headers: { Authorization: `Bearer ${accessToken}` },
  body: JSON.stringify(payload)
});
```

<Tip>
  The `issued_at` field is optional. If omitted, the server will use the current time. When provided, it must be a valid ISO 8601 date that is **not in the future** and **not older than 72 hours**.

  Always include timezone information. Send UTC with `Z` (recommended), such as `2026-03-25T10:00:00.000Z`, or include an explicit offset, such as `2026-03-25T05:00:00.000-05:00`. These two examples represent the same moment. Do not append `Z` to a local time without converting it to UTC first.
</Tip>

### Fulfill an event

If the `fulfilled` attribute has been sent as `false` in the body of the [POST Emit event](/api-reference/behavior/events/post) endpoint,
the event will be placed in a standby state. The reward won't be added to the wallet until `fulfilled` is `true`.

<Note>
  It is important to note that when the event was not emitted with `fulfill` set to `true`, the rewards will not be redeemed until it is explicitly fulfilled.

  It is also worth mentioning that the event will expire after 24 hours (by default depending on `reserve` value) if it has not been set to fulfill.
</Note>

In this case, you will need to manually execute the fulfill if you want the event to be processed.

For this, it is necessary to send the event id of the event to the [PATCH Fulfill event](/api-reference/behavior/events/\[eventId]/fulfill/patch) endpoint.

```typescript theme={null}
const response = await fetch(
  `https://app.masivo.ai/api/storefront/v1/behavior/events/${eventId}/fulfill`,
  {
    method: "PATCH",
    headers: { Authorization: `Bearer ${accessToken}` }
  }
);
```

After the event has been successfully fulfilled, The reward will be added to the wallet.

### Reverse an event

If you want to reverse an event and all actions resulting from it, you must send the event id to the [`POST
Reverse event`](/api-reference/behavior/events/\[eventId]/reverse/delete) endpoint, including a reason in the body of the request.

```typescript theme={null}
const payload = {
  reason: "<message>" // The reason why you are reversing the event
};

const response = await fetch(
  `https://app.masivo.ai/api/storefront/v1/behavior/events/${eventId}/reverse`,
  {
    method: "POST",
    headers: {
      Authorization: `Bearer ${accessToken}`,
      "Content-Type": "application/json"
    },
    body: JSON.stringify(payload)
  }
);
```

Once the event has been reversed, all accumulation, redemption, and updating of customer metrics will be reversed.

<Note>
  It is important to note that once an event has been reversed, its `STATUS` will change to `"REVERSED"`.
</Note>

### What happens when an event expires?

An event expires when it's hasn't been sent with `fulfill` in `true` and it's been 24 hours since that.
The amount of days for expiration time can be extended by sending `reserve` in the body of the request.

### What happens if the event is reversed when is still unfulfilled?

If an event is emitted with `fulfill` in `false` and then it is reversed, the event will be cancelled. The `status` in the response of the request will be set in `"CANCELLED"`.

### How reserves can be extended?

The reserve days can be extended by setting the `reserve` attribute in the `body` of the [`POST Emit event`](/api-reference/behavior/events/post) endpoint. So the value sent in `reserve`
will be equal to the number of days the reserves will be extended.

## Related architecture

* [Activity & events](/resources/data-architecture#activity-events) — Loyalty vs tracking-only processing and what each path updates
* [Marketing & destinations](/resources/data-architecture#marketing-destinations) — How emitted events can trigger journeys and destination sync
