---
updatedAt: 2026-04-21T04:23:54.000Z
agentTools:
  projectIndex: https://developer.blueshift.com/llms.txt
---

# Send bulk events

Use this endpoint to send multiple events from your server or use javascript events that call the API.

## API at a glance

**Description:** This API allows you to send multiple events in a single API call from your server or using JavaScript events. This is network-efficient and reduces the number of connections needed.

## Authentication & testing

<details>
  <summary><strong>Testing the API on this page</strong></summary>
  <h3>How to try it here</h3>

  <ul>
    <li>Use your <strong>Event API Key</strong> as the <strong>Username</strong> (leave <strong>Password</strong> blank).</li>

    <Image align="center" border={true} src="https://files.readme.io/9f1ceaf8c6bac9991f794229e8afe96ed6101151b62f8df040e34b08eb6bdf5f-Events-API-Key.png" />

    <li>Select the appropriate API endpoint based on your Blueshift region.</li>

    <img src="https://files.readme.io/a567ea5d40fd528b7651d01be5932921690ecbe9786b366284cb2bd48f05ff7d-API_-_Select_Region_-_With_Highlights.png" alt="API - Select Region" width="75%" />

    <li>Enter the necessary parameters and click <strong>Try It</strong> to run the request.</li>
  </ul>
</details>

<details>
  <summary><strong>Authentication using Base64 encoding</strong></summary>
  <h3>Note for developers</h3>

  <p>
    API requests require authentication using HTTP Basic Authentication with an API key.
    The Event API key serves as the username, while the password field should be left empty.
    The format to encode is: <code>your\_event\_api\_key:</code> (note the trailing colon).
  </p>

  <p>
    This string must be Base64-encoded and included in the request's Authorization header
    as follows:
  </p>

  <pre><code>Authorization: Basic encoded\_value</code></pre>

  <p>
    You can generate the encoded value using a trusted
    <a href="https://gchq.github.io/CyberChef/#recipe=To_Base64('A-Za-z0-9%2B/%3D')" target="_blank">Base64 encoder</a>.
  </p>
</details>

***

<h4>Postman collection</h4>

<p>
  <strong>Try it with Postman:</strong>
  Explore the API using <a href="https://developer.blueshift.com/reference/test-apis#postman-collection" target="_blank">Blueshift's Postman collection.</a>
</p>

***

## Things to know before you start

* **Network efficiency:** The bulk API call reduces the number of connections needed compared to individual event calls.
* **Bulk sending:** You can send multiple events in bulk as part of an array.
* **Payload limits:** The maximum size of a payload is 1MB or 30 events per payload.
* **Rate limiting:** We recommend limiting the number of bulk calls to 5 per second (or 150 events/sec).
* **Required identifier fields:** Each event must provide values for at least one of: `customer_id`, `event`, `device_id`, `cookie`, or `email`.
* **Best practice:** If possible, provide values for more than one identifier field per event.
* **Anonymous users:** For anonymous users, specify at least the value for the `cookie`.
* **Use case:** Best for batch processing of events, importing historical data, or high-volume event tracking scenarios.

## Request parameters

<details>
  <summary><strong>Check out the request parameters</strong></summary>

### **Body parameters**

| Parameter | Type    | Required | Description                                                         |
| :-------- | :------ | :------- | :------------------------------------------------------------------ |
| `events`  | `array` | ✅ Yes    | An array of event objects. Each object follows the structure below. |

### **Event object properties**

> **Note:** Each event must provide at least one of: `customer_id`, `event`, `device_id`, `cookie`, or `email`.

| Parameter             | Type     | Required | Description                                                                                                        |
| :-------------------- | :------- | :------- | :----------------------------------------------------------------------------------------------------------------- |
| `event`               | `string` | ✅ Yes    | Specify the name of the event (e.g., `identify`, `view`, `add_to_cart`, `purchase`, `search`, custom event names). |
| `customer_id`         | `string` | ❌ No     | Specify the customer ID.                                                                                           |
| `email`               | `string` | ❌ No     | Specify the user's email address.                                                                                  |
| `device_id`           | `string` | ❌ No     | Specify the UUID of the device.                                                                                    |
| `device_type`         | `string` | ❌ No     | Specify the type of the device (e.g., `ios`, `android`).                                                           |
| `device_tokens`       | `string` | ❌ No     | Specify the token of the device.                                                                                   |
| `device_idfa`         | `string` | ❌ No     | Specify the advertising identifier (IDFA) on the device.                                                           |
| `device_idfv`         | `string` | ❌ No     | Specify the identifier for vendor (IDFV) on the device.                                                            |
| `device_manufacturer` | `string` | ❌ No     | Specify the manufacturer of the device.                                                                            |
| `os_name`             | `string` | ❌ No     | Specify the OS name.                                                                                               |
| `network_carrier`     | `string` | ❌ No     | Specify the carrier on the mobile device.                                                                          |
| `ip`                  | `string` | ❌ No     | Specify the IP address of the device.                                                                              |
| `latitude`            | `string` | ❌ No     | Specify the latitude of the user's location.                                                                       |
| `longitude`           | `string` | ❌ No     | Specify the longitude of the user's location.                                                                      |
| `subscription_groups` | `array`  | ❌ No     | Specify the user's subscription preferences. See structure below.                                                  |

### **Subscription groups object**

| Parameter    | Type      | Description                                                         |
| :----------- | :-------- | :------------------------------------------------------------------ |
| `id`         | `string`  | The ID of the subscription group.                                   |
| `subscribed` | `boolean` | Enter `true` if the user is subscribed, or `false` if unsubscribed. |

</details>

## Example requests & responses

<details>
  <summary><strong>Send bulk events</strong></summary>

**Request**

```bash
curl --request POST \
     --url https://api.getblueshift.com/api/v1/bulkevents \
     --header 'accept: application/json' \
     --header 'authorization: Basic <YOUR_EVENT_API_KEY>' \
     --header 'content-type: application/json' \
     --data '{
       "events": [
         {
           "customer_id": "abc812122",
           "event": "identify",
           "device_type": "ios",
           "device_tokens": "49244924492449244924492449244924492449244924",
           "device_id": "8abe3faa-d48d-4e4a-00ca-beae01f1c987",
           "device_idfa": "4d031ed8-c40e-57d4-9c99-a3e308d8cd78",
           "device_idfv": "6d031ec8-e40c-47d4-9c99-b3e308d8ed78",
           "device_manufacturer": "apple",
           "os_name": "ios",
           "network_carrier": "verizon",
           "ip": "201.44.11.21",
           "email": "jane.doe@acme.com",
           "latitude": "212.99333",
           "longitude": "-12.39334",
           "subscription_groups": [
             {
               "id": "newsletter",
               "subscribed": true
             },
             {
               "id": "weekly_promo",
               "subscribed": false
             }
           ]
         },
         {
           "customer_id": "812123",
           "event": "purchase",
           "ip": "201.44.11.22",
           "email": "jane.doe@acme.com",
           "revenue": "31.24"
         }
       ]
     }'
```

**Response**

```json
{
  "status": "ok",
  "count": 2
}
```

</details>

<details>
<summary><strong>API error responses</strong></summary>

<Callout icon="📘" theme="info">
  ### Note

  The following error codes are commonly returned by Blueshift APIs. Depending on the specific endpoint, not all may apply.
</Callout>

<Table>
  <thead>
    <tr>
      <th>
        Status code
      </th>

      <th>
        Description
      </th>

      <th>
        Example responses
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        **400 Bad Request**
      </td>

      <td>
        The request is invalid due to missing or incorrect parameters. This includes missing fields, invalid values, formatting issues, or conflicts such as duplicate data.
      </td>

      <td>
        `{ "errors": { "name": ["can't be blank"] } }`

        `{ "errors": { "startdate": ["can't be blank"] } }`
      </td>
    </tr>

    <tr>
      <td>
        **401 Unauthorized**
      </td>

      <td>
        API authentication failed due to an invalid or missing API key.
      </td>

      <td>
        `{ "message": "Not authorized" }`
      </td>
    </tr>

    <tr>
      <td>
        **403 Forbidden**
      </td>

      <td>
        The API key does not have sufficient permissions to perform this action.
      </td>

      <td>
        `{ "message": "Permission denied" }`
      </td>
    </tr>

    <tr>
      <td>
        **404 Not Found**
      </td>

      <td>
        The specified campaign was not found. Verify the campaign UUID.
      </td>

      <td>
        `{ "message": "Campaign not found" }`
      </td>
    </tr>

    <tr>
      <td>
        **422 Unprocessable Entity**
      </td>

      <td>
        * The campaign cannot be paused due to its current status (e.g., already completed or archived).
        * One or more scheduling parameters may be invalid (if applicable).
      </td>

      <td>
        `{ "message": "Campaign cannot be paused in its current status." }`

        `{ "message": "Invalid schedule values" }`
      </td>
    </tr>

    <tr>
      <td>
        **429 Too Many Requests**
      </td>

      <td>
        The request limit has been exceeded. Reduce request frequency.
      </td>

      <td>
        `{ "message": "Rate limit exceeded" }`
      </td>
    </tr>

    <tr>
      <td>
        **500 Internal Server Error**
      </td>

      <td>
        An unexpected server error occurred. Contact support if the issue persists.
      </td>

      <td>
        `{ "message": "Internal Server Error - Please contact support for more information." }`
      </td>
    </tr>

    <tr>
      <td>
        **502 Bad Gateway**
      </td>

      <td>
        The server received an invalid response. Retry the request.
      </td>

      <td>
        `{ "message": "Bad Gateway - Please retry the request." }`
      </td>
    </tr>

    <tr>
      <td>
        **503 Service Unavailable**
      </td>

      <td>
        The service is temporarily unavailable. Try again later.
      </td>

      <td>
        `{ "message": "Service Unavailable - The service is temporarily unavailable. Try again later." }`
      </td>
    </tr>

    <tr>
      <td>
        **504 Gateway Timeout**
      </td>

      <td>
        The server took too long to respond. Retry the request with exponential backoff.
      </td>

      <td>
        `{ "message": "Gateway Timeout - The server took too long to respond. Retry with exponential backoff." }`
      </td>
    </tr>
  </tbody>
</Table>

</details>

# OpenAPI definition

```json
{
  "openapi": "3.0.0",
  "info": {
    "description": "These APIs will help you manage different workflows in Blueshift. Our powerful REST APIs provide an easy way to integrate your data and third party applications with Blueshift.",
    "version": "1.0.0",
    "title": "Blueshift APIs",
    "contact": {
      "email": "support@getblueshift.com"
    }
  },
  "tags": [
    {
      "name": "Event",
      "description": "Use the event APIs to send events from your servers."
    }
  ],
  "paths": {
    "/api/v1/bulkevents": {
      "post": {
        "summary": "Send bulk events",
        "description": "Use this endpoint to send multiple events from your server or use javascript events that call the API.",
        "tags": [
          "Event"
        ],
        "security": [
          {
            "event_api_auth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "additionalProperties": true,
                      "required": [
                        "event"
                      ],
                      "properties": {
                        "customer_id": {
                          "type": "string",
                          "description": "Specify the customer ID. You must atleast specify this value, or one or more of the following: event/device_id/email.",
                          "example": "48759893"
                        },
                        "event": {
                          "type": "string",
                          "description": "Specify the name of the event. For example, view (product view), add_to_cart, remove_from_cart, checkout, purchase, search, your_custom_event_name (custom event) etc. You must atleast specify this value, or one or more of the following: customer_id/device_id/email.",
                          "example": "add_to_cart"
                        },
                        "device_type": {
                          "type": "string",
                          "description": "Specify the type of the device. For example, ios or android.",
                          "example": "android"
                        },
                        "device_tokens": {
                          "type": "string",
                          "description": "Specify the token of the device.",
                          "example": "12d34a5ccf37db694d48d89740bbc1f94da08e25930fc773d2af2aefdd98989c9"
                        },
                        "device_id": {
                          "type": "string",
                          "description": "Specify the UUID of the device. You must atleast specify this value, or one or more of the following: event/customer_id/email.",
                          "example": "8abe3faa-d48d-4e4a-00ca-beae01f1c987"
                        },
                        "device_idfa": {
                          "type": "string",
                          "description": "Sepcify the advertising identifier (idfa) on the device.",
                          "example": "39c20522-2ce9-4466-9876-7677b89e4d3b"
                        },
                        "device_idfv": {
                          "type": "string",
                          "description": "Specify the identfier for vendor (idfv) on the device.",
                          "example": "6d031ec8-e40c-47d4-9c99-b3e308d8ed78"
                        },
                        "device_manufacturer": {
                          "type": "string",
                          "description": "Specify the manufacturer of the device.",
                          "example": "apple"
                        },
                        "os_name": {
                          "type": "string",
                          "description": "Specify the OS name.",
                          "example": "ios"
                        },
                        "network_carrier": {
                          "type": "string",
                          "description": "Specify the carrier on the mobile device.",
                          "example": "verizon"
                        },
                        "ip": {
                          "type": "string",
                          "description": "Specify the IP address of the device.",
                          "example": "192.0.2.1"
                        },
                        "email": {
                          "type": "string",
                          "description": "Specify the user's email address. You must atleast specify this value, or one or more of the following: event/device_id/customer_id.",
                          "example": "janedoe@acme.com"
                        },
                        "latitude": {
                          "type": "string",
                          "description": "Specify the latitude of the user's location.",
                          "example": "212.99333"
                        },
                        "longitude": {
                          "type": "string",
                          "description": "Specify the longitude of the user's location.",
                          "example": "-12.39334"
                        },
                        "subscription_groups": {
                          "type": "array",
                          "description": "Specify the user's subscription preferences.",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "description": "The ID of the subscription group."
                              },
                              "subscribed": {
                                "type": "boolean",
                                "description": "Enter `true` if the user is subscribed, or `false` if unsubscribed."
                              }
                            }
                          },
                          "example": [
                            {
                              "id": "newsletter",
                              "subscribed": true
                            },
                            {
                              "id": "weekly_promo",
                              "subscribed": false
                            }
                          ]
                        }
                      },
                      "example": [
                        {
                          "customer_id": "abc812122",
                          "event": "identify",
                          "device_type": "ios",
                          "device_tokens": "49244924492449244924492449244924492449244924",
                          "device_id": "8abe3faa-d48d-4e4a-00ca-beae01f1c987",
                          "device_idfa": "4d031ed8-c40e-57d4-9c99-a3e308d8cd78",
                          "device_idfv": "6d031ec8-e40c-47d4-9c99-b3e308d8ed78",
                          "device_manufacturer": "apple",
                          "os_name": "ios",
                          "network_carrier": "verizon",
                          "ip": "201.44.11.21",
                          "email": "jane.doe@acme.com",
                          "latitude": "212.99333",
                          "longitude": "-12.39334",
                          "subscription_groups": [
                            {
                              "id": "newsletter",
                              "subscribed": true
                            },
                            {
                              "id": "weekly_promo",
                              "subscribed": false
                            }
                          ]
                        },
                        {
                          "customer_id": "812123",
                          "event": "purchase",
                          "ip": "201.44.11.22",
                          "email": "jane.doe@acme.com",
                          "revenue": "31.24"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "description": "Specify device_id. The device_id is the mobile specific (iOS or Android) device identifier to uniquely identify the mobile device."
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "description": "ok or bad request",
                      "example": "ok"
                    },
                    "count": {
                      "type": "integer",
                      "description": "The count of events sent",
                      "example": 0
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or cannot be otherwise served. An accompanying error message will explain further.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "errors": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "customer_id": {
                            "type": "string",
                            "example": "can't be blank"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - API authentication failed due to an invalid or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Not authorized"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - The API key does not have sufficient permissions to perform this action.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Forbidden"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource was not found.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Not Found"
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "You can upload maximum 100 products in one api call\t- The server is refusing to process a request because the request payload is larger than the server is willing or able to process."
          },
          "422": {
            "description": "Unprocessable Entity - Some/all of the products have invalid data, please check the response for more information on."
          },
          "429": {
            "description": "Rate limit exceeded - Too many requests"
          },
          "500": {
            "description": "Internal Server Error\t- Please contact blueshift for more information"
          },
          "502": {
            "description": "Service unavailable, please retry - Bad Gateway, re-try with exponential backoff"
          },
          "503": {
            "description": "Service unavailable, please retry - Service Unavailable, re-try with exponential backoff"
          },
          "504": {
            "description": "Service unavailable, please retry - Gateway Timeout, please re-try with exponential backoff"
          }
        }
      }
    }
  },
  "servers": [
    {
      "url": "https://api.getblueshift.com"
    },
    {
      "url": "https://api.eu.getblueshift.com"
    }
  ],
  "components": {
    "securitySchemes": {
      "event_api_auth": {
        "type": "http",
        "scheme": "basic"
      }
    }
  },
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true,
    "samples-enabled": true
  }
}
```