Send an event

API reference

await fetch("https://app.loops.so/api/v1/events/send", {
  method: "POST",
  headers: {
    "Authorization": "Bearer <your-api-key>",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    email: "[email protected]",
    eventName: "testEvent",
  }),
});

Send an event with event properties

Include data that can be used in your loop emails triggered by the event.

API reference

await fetch("https://app.loops.so/api/v1/events/send", {
  method: "POST",
  headers: {
    "Authorization": "Bearer <your-api-key>",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    email: "[email protected]",
    eventName: "testEvent",
    eventProperties: {
      "testProperty": "testValue",
    },
  }),
});

Send an event and update the contact

Include contact properties to update the contact as the event is sent.

API reference

await fetch("https://app.loops.so/api/v1/events/send", {
  method: "POST",
  headers: {
    "Authorization": "Bearer <your-api-key>",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    email: "[email protected]",
    eventName: "testEvent",
    planName: "Pro", // Contact property
  }),
});

Send an event with an idempotency key

Add an Idempotency-Key header to the request to prevent duplicate requests.

API reference

await fetch("https://app.loops.so/api/v1/events/send", {
  method: "POST",
  headers: {
    "Authorization": "Bearer <your-api-key>",
    "Content-Type": "application/json"
    "Idempotency-Key": "550e8400-e29b-41d4-a716-446655440000",
  },
  body: JSON.stringify({
    email: "[email protected]",
    eventName: "testEvent",
  }),
});