# Sending events

To start, make sure you have [installed the Inngest SDK](/docs/sdk/overview).

In order to send events, you'll need to instantiate the `Inngest` client. We recommend doing this in a single file and exporting the client so you can import it anywhere in your app. In production, you'll need an event key, which [we'll cover below](#setting-an-event-key).

<GuideSelector
  options={[
    { key: 

typescript", title: "TypeScript" },
    { key: "go", title: "Go" },
    { key: "python", title: "Python" },
  ]}
>

<GuideSection show="typescript">

```ts {{ filename: 'inngest/client.ts' }}
inngest = new Inngest({ id: "acme-storefront-app" }); // Use your app's ID
```

Now with this client, you can send events from anywhere in your app. You can send a single event, or [multiple events at once](#sending-multiple-events-at-once).

```ts {{ filename: 'app/api/checkout/route.ts' }}
// This sends an event to Inngest.
await inngest.send({
  // The event name
  name: "storefront/cart.checkout.completed",
  // The event's data
  data: {
    cartId: "ed12c8bde",
    itemIds: ["9f08sdh84", "sdf098487", "0fnun498n"],
    account: {
      id: 123,
      email: "test@example.com",
    },
  },
});
```

<Callout>

👉 `send()` is an asynchronous method that returns a `Promise`. You should always use `await` or `.then()` to ensure that the method has finished sending the event to Inngest. Serverless functions can shut down very quickly, so skipping `await` may result in events failing to be sent.

</Callout>

</GuideSection>

<GuideSection show="python">

```python {{ filename: 'src/inngest/client.py' }}
import inngest

inngest_client = inngest.Inngest(app_id="acme-storefront-app")
```

Now with this client, you can send events from anywhere in your app. You can send a single event, or [multiple events at once](#sending-multiple-events-at-once).

```python {{ filename: 'src/api/checkout/route.py' }}
import inngest
from src.inngest.client import inngest_client

await inngest_client.send(
  inngest.Event(
    name="storefront/cart.checkout.completed",
    data={
      "cartId": "ed12c8bde",
      "itemIds": ["9f08sdh84", "sdf098487", "0fnun498n"],
      "account": {
        "id": 123,
        "email": "test@example.com",
      },
    },
  )
)
```

<Callout>

👉 `send()` is meant to be called asynchronously using `await`. For synchronous code, [use the `send_sync()` method instead](/docs/reference/python/client/send).

</Callout>

</GuideSection>

<GuideSection show="go">

```go {{ title: "Go" }}
!snippet:path=snippets/go/docs/clients/new_client_acme_storefront_app.go
```

Now with this client, you can send events from anywhere in your app. You can send a single event, or [multiple events at once](#sending-multiple-events-at-once).

```go {{ title: "Go" }}
!snippet:path=snippets/go/docs/events/checkout_completed.go
```

</GuideSection>

Sending this event, named `storefront/cart.checkout.completed`, to Inngest will do two things:

1. Automatically run any [functions](/docs/functions) that are triggered by this specific event, passing the event payload to the function's arguments.
2. Store the event payload in Inngest cloud. You can find this in the **Events** tab of the dashboard.

<Callout>

💡 One event can trigger multiple functions, enabling you to consume a single event in multiple ways. This is different than traditional message queues where only one worker can consume a single message. Learn about [the fan-out approach here](/docs/guides/fan-out-jobs).

</Callout>

## Setting an Event Key

In production, your application will need an "Event Key" to send events to Inngest. This is a secret key that is used to authenticate your application and ensure that only your application can send events to a given [environment](/docs/platform/environments) in your Inngest account.

You can learn [how to create an Event Key here](/docs/events/creating-an-event-key). Once you have a key, you can set it in one of two ways:

1. Set an `INNGEST_EVENT_KEY` environment variable with your Event Key. **This is the recommended approach.**
2. Pass the Event Key to the `Inngest` constructor as the `eventKey` option:

<GuideSection show="typescript">
```ts {{ filename: 'inngest/client.ts' }}
// NOTE - It is not recommended to hard-code your Event Key in your code.
new Inngest({ id: "your-app-id", eventKey: "xyz..." });
```
</GuideSection>

<GuideSection show="python">
```python {{ filename: 'src/inngest/client.py' }}
import inngest