Source: https://fyno.docs.pageloop.ai/api-reference/fire-an-event/post-wsid-version-event-bulk

# Notify multiple users

POST `https://api.fyno.io/v1/{WSID}/{version}/event/bulk`

This API enables you to notify multiple users with one event trigger.

Before firing your first notification event, you must perform the following actions in your Fyno account:

- Create a Template
- Create an Event
- Create an API Key
- And obtain your workspace ID from the API Keys page.

## Authorization

#### Authorization (header, string, required)

Enter your API Key. If you don't have it already, you can create one from the API Keys page within your Fyno account

## Path Parameters

#### WSID (path, string, required)

Enter your workspace ID. You can obtain this value from the API Keys page within your Fyno account.

#### version (path, enum (string), required) — allowed: live, test

Enter the version for which you wish to fire the notification.

## Body

#### batch (body, array of object, required)

Your batch payload must specify at least _`distinct_id`_ or _`to`_ while firing a notification event.

If the payload contains:

- **Option 1:** ONLY _`to`_ (and no _`distinct_id`_) - the event uses all destination values from the _`to`_ object (as it is).

- **Option 2:** ONLY _`distinct_id`_ (and no _`to`_) - the event uses all destination values (such as SMS, WhatsApp, Email, Push, Voice and so on) from the user's profile and sends the notification.

- **Option 3:** BOTH _`distinct_id`_ and _`to`_ - the `to` and `distinct_id` channel data merges (`to` object take precedences) and sends the notification. The sent notification is tagged to the ID specified, which can be then used to search the logs by using `distinct_id`.

#### event (body, string, required)

Enter the name of the event you wish to fire.

## Response

#### 202

Request accepted successfully and it will be processed asynchronously.

#### event (string)

#### received\_time (number)

#### request\_id (string)

#### response (array of object)

#### properties

#### discord (object)

#### email (object)

#### inapp (object)

#### push (object)

#### seq (integer)

#### slack (object)

#### sms (object)

#### teams (object)

#### voice (object)

#### whatsapp (object)

#### 400

Event name does not exist

#### \_message (string, required)

#### status (string, required)

#### 401

API Key or Workspace ID is invalid. User is unauthorised.

#### \_message (string, required)

#### status (string, required)

#### Request

```bash cURL
curl -X POST 'https://api.fyno.io/v1/{WSID}/{version}/event/bulk' \
  -H 'Authorization: Bearer <token>' \
  -H 'Content-Type: application/json' \
  -d '{"batch": [{}], "event": "event_name"}'
```

```javascript JavaScript
const res = await fetch('https://api.fyno.io/v1/{WSID}/{version}/event/bulk', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer <token>',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({"batch": [{}], "event": "event_name"}),
});
const data = await res.json();
```

```python Python
import requests

res = requests.post(
    'https://api.fyno.io/v1/{WSID}/{version}/event/bulk',
    headers={'Authorization': 'Bearer <token>'},
    json={"batch": [{}], "event": "event_name"}
)
data = res.json()
```

#### Response

```json 202
{
  "event": "event_name",
  "received_time": 1672991866453,
  "request_id": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
  "response": [
    {
      "discord": {
        "destination": "\u2026",
        "msg_id": "\u2026",
        "status": "\u2026"
      },
      "email": {
        "destination": "\u2026",
        "msg_id": "\u2026",
        "status": "\u2026"
      },
      "inapp": {
        "destination": "\u2026",
        "msg_id": "\u2026",
        "status": "\u2026"
      },
      "push": {
        "destination": "\u2026",
        "msg_id": "\u2026",
        "status": "\u2026"
      },
      "seq": 1,
      "slack": {
        "destination": "\u2026",
        "msg_id": "\u2026",
        "status": "\u2026"
      },
      "sms": {
        "destination": "\u2026",
        "msg_id": "\u2026",
        "status": "\u2026"
      },
      "teams": {
        "destination": "\u2026",
        "msg_id": "\u2026",
        "status": "\u2026"
      },
      "voice": {
        "destination": "\u2026",
        "msg_id": "\u2026",
        "status": "\u2026"
      },
      "whatsapp": {
        "destination": "\u2026",
        "msg_id": "\u2026",
        "status": "\u2026"
      }
    }
  ]
}
```

```json 400
{
  "_message": "The notification event name 'event_name' is invalid or does not exists on prod",
  "status": "error"
}
```

```json 401
{
  "_message": "Invalid API details",
  "status": "error"
}
```
