# Send events
Source: https://www.inngest.com/docs/reference/events/send

description = `Send one or more events to Inngest via inngest.send() in the TypeScript SDK.`

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

```ts
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/reference/functions/step-send-event).

---

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

<Row>
  <Col>
    <Properties>
      <Property name="eventPayload" type="object | object[]" required>
        An event payload object or an array of event payload objects.

        <Properties nested={true}>
          <Property name="name" type="string" required>
            The event name. We recommend using lowercase dot notation for names, prepending `prefixes/` with a slash for organization.
          </Property>
          <Property name="data" type="object" required>
            Any data to associate with the event. Will be serialized as JSON.
          </Property>
          <Property name="user" type="object">
            Any relevant user identifying data or attributes associated with the event. **This data is encrypted at rest.**
            <Properties nested>
              <Property name="external_id" type="string">
                An external identifier for the user. Most commonly, their user id in your system.
              </Property>
            </Properties>
          </Property>
          <Property name="id" type="string">
            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](/docs/guides/handling-idempotency).
          </Property>
          <Property name="ts" type="number">
            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.
          </Property>
          <Property name="v" type="string">
            A version identifier for a particular event payload. e.g. `"2023-04-14.1"`
          </Property>
        </Properties>
      </Property>
      <Property name="options" type="object" version="v3.21.0+">
        <Properties nested={true}>
          <Property name="env" type="string">
            The [environment](/docs/platform/environments) to send the events to.
          </Property>
        </Properties>
      </Property>
    </Properties>
  </Col>
  <Col>
  ```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"
  });
  ```
  </Col>
</Row>

### 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/docs/inngest-api/pswkqb7u3obet-get-an-event).

```ts
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 variant="warning">
  <span className="text-yellow-300">⚠️</span> When [replaying a function](/docs/platform/replay), `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.
</Callout>

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/usage-limits/inngest#events