# Send events

> **Info:** TypeScript SDK v4 is now in beta. See the v4 docs and migration guide.

Send events to Inngest. Functions with matching event triggers will be invoked.

```ts
import { inngest } from "./client";

await inngest.send({
  name: "app/account.created",
  data: {
    accountId: "645e9f6794e10937e9bdc201",
    billingPlan: "pro",
  },
  user: {
    external_id: "645ea000129f1c40109ca7ad",
    email: "taylor@example.com",
  }
})
```

To send events from within of the context of a function, use [`step.sendEvent()`](/docs-markdown/reference/typescript/v3/functions/step-send-event).

***

## `inngest.send(eventPayload | eventPayload[], options): Promise<{ ids: string[] }>`

- `eventPayload` (object | object\[]): An event payload object or an array of event payload objects.The event name. We recommend using lowercase dot notation for names, prepending prefixes/ with a slash for organization.Any data to associate with the event. Will be serialized as JSON.Any relevant user identifying data or attributes associated with the event. This data is encrypted at rest.An external identifier for the user. Most commonly, their user id in your system.A unique ID used to idempotently trigger function runs.  If duplicate event IDs are seen,
  only the first event will trigger function runs. Read the idempotency guide here.A timestamp integer representing the time (in milliseconds) at which the event occurred. Defaults to the time the Inngest receives the event.If the ts time is in the future, function runs will be scheduled to start at the given time.   This has the same effect as running await step.sleepUntil(event.ts) at
  the start of the function.Note: This does not apply to functions waiting for events. Functions waiting for events will immediately resume, regardless of the timestamp.A version identifier for a particular event payload. e.g. "2023-04-14.1"

* `options` (object): The environment to send the events to.

```ts
// Send a single event
await inngest.send({
  name: "app/post.created",
  data: { postId: "01H08SEAXBJFJNGTTZ5TAWB0BD" }
});

// Send an array of events
await inngest.send([
  {
    name: "app/invoice.created",
    data: { invoiceId: "645e9e024befa68763f5b500" }
  },
  {
    name: "app/invoice.created",
    data: { invoiceId: "645e9e08f29fb563c972b1f7" }
  },
]);

// Send user data that will be encrypted at rest
await inngest.send({
  name: "app/account.created",
  data: { billingPlan: "pro" },
  user: {
    external_id: "6463da8211cdbbcb191dd7da",
    email: "test@example.com"
  }
});

// Specify the idempotency id, version, and timestamp
await inngest.send({
  // Use an id specific to the event type & payload
  id: "cart-checkout-completed-ed12c8bde",
  name: "storefront/cart.checkout.completed",
  data: { cartId: "ed12c8bde" },
  user: { external_id: "6463da8211cdbbcb191dd7da" },
  ts: 1684274328198,
  v: "2024-05-15.1"
});
```

### Return values

The function returns a promise that resolves to an object with an array of Event IDs that were sent. These events can be used to look up the event in the Inngest dashboard or via [the REST API](https://api-docs.inngest.com/v1/events/GetEvent).

```ts
const { ids } = await inngest.send([
  {
    name: "app/invoice.created",
    data: { invoiceId: "645e9e024befa68763f5b500" }
  },
  {
    name: "app/invoice.created",
    data: { invoiceId: "645e9e08f29fb563c972b1f7" }
  },
]);
/**
 * ids = [
 *   "01HQ8PTAESBZPBDS8JTRZZYY3S",
 *   "01HQ8PTFYYKDH1CP3C6PSTBZN5"
 * ]
 */
```

## User data encryption 🔐

All data sent in the `user` object is fully encrypted at rest.

> **Callout:** ⚠️ When replaying a function, event.user will be empty. This will be fixed in the future, but for now assume that you cannot replay functions that rely on event.user data.

In the future, this object will be used to support programmatic deletion via API endpoint to support certain right-to-be-forgotten flows in your system. This will use the `user.external_id` property for lookup.

## Usage limits

See [usage limits][usage-limits] for more details.

[usage-limits]: /docs-markdown/usage-limits/inngest#events