---
title: "Open a compliance event stream"
method: POST
path: "/api/events/general"
tags: ["Compliance Event Stream"]
---

# Open a compliance event stream

`POST /api/events/general`

## Request

- Base URL: `https://connect.urbanairship.com`
- URL: `https://connect.urbanairship.com/api/events/general`
- Auth: HTTP basic
- TypeScript: <https://skmtc.dev/airship/apis/airship-real-time-data-streaming-api/docs/api/events/general/post.ts> (a function with typed inputs; its response is checked against the schema)

Opens a stream delivering events proving data-safety regulation compliance for email and SMS channel-related events (registration, unsubscription, etc.).

Unlike a standard event stream, a compliance event stream uses basic authorization, like API calls to `https://go.urbanairship.com/api`.

## Headers

- `X-UA-Appkey` string, required: The application key.

## Request body

- ComplianceRequest: A request for compliance events is much like a request to `/api/events`, but has a limited scope.
  - `filters` ComplianceRequestFilters[]: An array of filter objects defining the events you want to appear in the event stream.
    - `device_types` string[]: Returns events pertaining to devices on the specified platforms.
    - `latency` integer: The number of milliseconds between the current time and when the events you want to return occurred. If an event occurred more than `latency` milliseconds ago, it is filtered out of the event stream.
  - `resume_offset` string: The offset where the stream should begin. The offset is an identifier relevant only to the data stream. The first event in the stream will be the next element satisfying the filter and subset conditions with an offset field greater than this value. Only specify `resume_offset` if `start` is absent.
  - `start` 'EARLIEST' | 'LATEST': Specifies that the stream should start at the beginning or the end of the application's data window. Only specify `start` if `resume_offset` is absent.
  - `subset` Subset: Use subsets to return a proportion of the event stream and not all events meeting your other criteria. The `subset` object defines the proportion of the event stream that you want to return.
    - `count` integer: Required when the `type` is `PARTITION`. The value is the number of partitions you want to divide the event stream into.
    - `proportion` number, float: Required when the `type` is `SAMPLE`. Specifies the percentage of events that will appear in the response, chosen randomly.
    - `selection` integer: Required when the `type` is `PARTITION`. The value is the partition that you want to return in the response. Must be less than `count`.
    - `type` 'SAMPLE' | 'PARTITION': The type of partition. * `SAMPLE` returns a random sample of events; the sample `proportion` determines the fraction of total events that Real-Time Data Streaming returns. * `PARTITION` segments the event stream into a number of partitions (determined by `count`) and returns a single partition in the event stream (determined by `selection`).

## Response `200`

The response to a successful request is an unending stream of [newline-delimited JSON](https://github.com/ndjson/ndjson-spec). Each non-empty line in the response represents a single compliance event. Unlike events in a normal event stream, this endpoint returns events of the `compliance` type, and is open to SMS and email customers. As long as the connection is open, Airship will continue to write to the event stream.

If a stream records no events for a period of time, the API will write a blank line (a single newline character) to the connection to prevent it from being closed for inactivity. If the `enable_offset_updates` field in the request is `true`, then the blank line is replaced with an `OFFSET_UPDATE` event. These events have no `body` or `device` field, and always have `occurred` and `processed` times indicating when they were sent. The `offset` field will contain the offset of the last event considered for inclusion in the stream whether or not it was actually sent. This may be useful to track position in the stream when using a filter which removes much of it.

You should not store these events; they will be different for every connection even if requests are identical. `OFFSET_UPDATE` events are not subject to filters, and are delivered even if not specified in the list of events you want to return. You should always check the type field before handling any delivered event.

If you do not receive data or new line characters for ninety seconds, close the connection and reconnect.

## Changes

- **2026-08-20** `6321ea5ae3f1`: 1 breaking, 1 info
  - added `#/components/schemas/rnd-scan, #/components/schemas/suppression_removed` to the `allOf[subschema #2]/` response property `oneOf` list for the response status `200`
  - added the optional property `allOf[subschema #2]/oneOf[subschema #6: SMS carrier deactivation event -> subschema #7: SMS carrier deactivation event]/body/properties` to the response with the `200` status
- **2026-06-24** `237f1be5fd99`: 2 info
  - added `subschema #1, subschema #2` to the response body `allOf` list for the response status `200`
  - removed `subschema #1, subschema #2` from the response body `allOf` list for the response status `200`
- **2026-02-20** `392d6f7ca858`: 2 info
  - added `subschema #1, subschema #2` to the response body `allOf` list for the response status `200`
  - removed `subschema #1, subschema #2` from the response body `allOf` list for the response status `200`
- **2025-08-28** `c1781d35e435`: 1 breaking, 1 info
  - added `#/components/schemas/smsUpdated` to the `allOf[subschema #2]/` response property `oneOf` list for the response status `200`
  - api operation id `openComplianceEventStream` was added

[Operation history](https://skmtc.dev/airship/apis/airship-real-time-data-streaming-api/changes/api/events/general/post.md)

---

[API](https://skmtc.dev/airship/apis/airship-real-time-data-streaming-api.md) - [All operations](https://skmtc.dev/airship/apis/airship-real-time-data-streaming-api/llms.txt) - [OpenAPI document](https://skmtc.dev/airship/apis/airship-real-time-data-streaming-api/revisions/6321ea5ae3f1?raw)
