---
title: "io.sendEvents()"
sidebarTitle: "sendEvents()"
description: "`io.sendEvents()` allows you to send multiple events from inside a Job run. The sent events will trigger any Jobs that are listening for those events (based on the name)."
---

If you want to send multiple events from outside a run (e.g. just from your backend) you should use [client.sendEvents()](/sdk/triggerclient/instancemethods/sendevents) instead.

Use [eventTrigger()](/sdk/eventtrigger) on a Job to listen for events.

For single events, use [io.sendEvent()](/sdk/io/sendevent) instead.

## Parameters

<Snippet file="stable-key-param.mdx" />

<Snippet file="send-events-params.mdx" />

## Returns

<Snippet file="send-events-return.mdx" />

<RequestExample>

```ts Send multiple events
//this Job sends multiple events that triggers the second job
client.defineJob({
  id: "job-1",
  name: "First job",
  version: "0.0.1",
  trigger: cronTrigger({
    cron: "0 9 * * *", // 9am every day (UTC)
  }),
  run: async (payload, io, ctx) => {
    //sends "new.user" events with a userId in the payload
    await io.sendEvents("send-events", [
      {
        name: "new.user",
        payload: {
          userId: "u_12345",
        },
      },
      {
        name: "new.user",
        payload: {
          userId: "u_67890",
        },
      },
    ]);
  },
});

client.defineJob({
  id: "job-2",
  name: "Second job",
  version: "0.0.1",
  //subscribes to the "new.user" event
  trigger: eventTrigger({
    name: "new.user",
    schema: z.object({
      userId: z.string(),
    }),
  }),
  run: async (payload, io, ctx) => {
    await io.logger.log("New user created", { userId: payload.userId });
    //do stuff with the new user
  },
});
```

</RequestExample>
