# Additional Schemas

Schemas that are not grouped by a specific tag. These include core data objects and shared schemas used across multiple operations.


## Associated push {#associatedpush}

The specific `push_id` and accompanying identifiers associated with an event. An associated push helps you trace an event to the original notification or operation.

An associated push object may specify a `time`, if the push was a singular operation sent at a defined time. Otherwise, the object will include a `group_id` if the push was sent at a relative time (`best_time` or `local_time`) an automation pipeline, or another operation resulting in multiple `push_id`s.

[Jump to examples ↓](#associatedpush-examples)

- **`campaigns`** `object`

  An object listing the campaigns a push specification is associated with. The campaigns object includes an array of categories that must have between 1 and 10 elements, each of which is a string with a 64-byte and -character limit.

  **OBJECT PROPERTIES**

  - **`categories`** `array[string]`
- **`group_id`** `string`

  Identifies a push specification delivered over an interval of time, e.g., multiple push_ids as part of the fulfillment of an automation pipeline or a push-to-local-time specification.


  Format: `uuid`

- **`push_id`** `string` **REQUIRED**

  A unique identifier for a push operation.

  Format: `uuid`

- **`time`** `string`

  The UTC time when the push occurred.

- **`variant_id`** `integer`

  The ID of the variant that a push is associated with, if the push was a part of an A/B test (experiment).


**Used in:**

- [Open an event stream]({{< ref "/developer/rest-api/connect/operations/event-stream/" >}}#openeventstream)

**Examples**

*Push sent to an audience at a defined date-time*

```json
{
  "push_id": "6e3339ce-529c-42e4-a2f6-7546f81c9828",
  "time": "2015-07-30T21:03:37.631Z"
}

```

---

## Compliance request {#compliancerequest}

A request for compliance events is much like a request to `/api/events`, but has a limited scope.


- **`filters`** `array` <[Compliance request filters]({{< ref "/developer/rest-api/connect/schemas/others/" >}}#compliancerequestfilters)>

  An array of filter objects defining the events you want to appear in 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`** `string`

  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.


  Possible values: `EARLIEST`, `LATEST`

- **`subset`** `object` <[Request subset]({{< ref "/developer/rest-api/connect/schemas/others/" >}}#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.


**Used in:**

- [Open a compliance event stream]({{< ref "/developer/rest-api/connect/operations/compliance-event-stream/" >}}#opencomplianceeventstream)

---

## Compliance request filters {#compliancerequestfilters}

[Jump to examples ↓](#compliancerequestfilters-examples)

- **`device_types`** `array[string]`

  Returns events pertaining to devices on the specified platforms.

  Possible values: `email`, `sms`

- **`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.

  Format: `milliseconds`


**Used in:**

- [Open a compliance event stream]({{< ref "/developer/rest-api/connect/operations/compliance-event-stream/" >}}#opencomplianceeventstream)

**Examples**

*Example compliance request filter*

```json
{
  "device_types": ["email"],
  "latency": 120000,          
}

```

---

## Events request {#eventsrequest}

The request body defines the events you want to return in the event stream. You can define position, subset and filter specifications in each request submitted to the stream. Filters are positive statements about what events the client should return. The subset specification returns a representative portion of the stream.


- **`filters`** `array` <[Request filters]({{< ref "/developer/rest-api/connect/schemas/others/" >}}#eventsrequestfilters)>

  An array of filter objects defining the events you want to see in the event stream. A filter object defines a function that either passes or fails an event. Events are included in the response if they pass any of the functions defined by the objects in the array.


- **`resume_offset`** `string`

  The offset where the stream should begin. The offset is an identifier relevant only to Real-Time Data Streaming. 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`** `string`

  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.


  Possible values: `EARLIEST`, `LATEST`

- **`subset`** `object` <[Request subset]({{< ref "/developer/rest-api/connect/schemas/others/" >}}#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.


**Used in:**

- [Open an event stream]({{< ref "/developer/rest-api/connect/operations/event-stream/" >}}#openeventstream)

---

## In-app context {#in-app-context}

The context provides the view state when a button, pager, or form interaction occurs.


[Jump to examples ↓](#in-app-context-examples)

- **`reporting_context`** `object`

  Describes the content types of the in-app automation. Can be expanded to provide any data for reporting.

  **OBJECT PROPERTIES**

  - **`content_types`** `array[string]`
    Possible values: `scene`, `survey`

- **`state`** `object`

  Can contain the current view state of pager and form.

  **OBJECT PROPERTIES**

  - **`form`** `object`
    **OBJECT PROPERTIES**

    - **`form_identifier`** `string` **REQUIRED**

      Is the form controller identifier.

      Format: `uuid`

    - **`response_type`** `string`

      The type survey response type.

      Possible values: `nps`, `user_feedback`

    - **`submitted`** `boolean` **REQUIRED**

      True if the form has been submitted.

    - **`type`** `string`

      The form type.

      Possible values: `nps`, `form`

  - **`pager`** `object`
    **OBJECT PROPERTIES**

    - **`completed`** `boolean`

      True if the user reached the end of the pager.

    - **`identifier`** `string` **REQUIRED**

      Is the pager controller identifier.

      Format: `uuid`

    - **`page_count`** `number` **REQUIRED**

      Total number of pages.

    - **`page_identifier`** `string` **REQUIRED**

      The current page identifier.

      Format: `uuid`

    - **`page_index`** `number` **REQUIRED**

      Is the current pager index.


**Used in:**

- [Open an event stream]({{< ref "/developer/rest-api/connect/operations/event-stream/" >}}#openeventstream)

**Examples**

*Example in-app context*

```json
{
  "reporting_context": {
    "content_types": [
      "survey"
    ]
  },
  "state": {
    "form": {
      "form_identifier": "870db95f-3715-4c98-8047-2871c175d003",
      "submitted": false,
      "type": "nps",
      "response_type": "nps"
    },
    "pager": {
      "identifier": "9e051354-185b-4d4d-888a-885def2e6b7a",
      "page_identifier": "992e5540-7144-474c-b666-2671814b3b19",
      "page_index": 0,
      "page_count": 2,
      "completed": false
    }
}

```

---

## Mobile-originated SMS event {#mobile-originated-sms}

An event that occurs when a user sends a message from an SMS device, i.e., the message originates from a mobile device and not from the server (Airship). This event contains context related to the message's origin, the incoming message itself, and Airship's response to the origin.


[Jump to examples ↓](#mobile-originated-sms-examples)

- **`event_type`** `string` **REQUIRED**

  The specific `MOBILE_ORIGINATED` event that occurred.

  Possible values: `mobile_originated_sms`

- **`identifiers`** `object` **REQUIRED**

  Contains the sender and MSISDN for the event.

  **OBJECT PROPERTIES**

  - **`msisdn`** `string` **REQUIRED**

    The phone number of the user involved in the compliance event.

  - **`sender`** `string` **REQUIRED**

    The phone number or short code of the sender involved in the compliance event.

- **`properties`** `object` **REQUIRED**

  Contains the mobile-originated message itself and the response to the message.


  **OBJECT PROPERTIES**

  - **`inbound_message`** `string` **REQUIRED**

    The contents of the message received from an SMS device.


  - **`keyword`** `string`

    The specific keyword used in the inbound message, if recognized; the keyword in the `inbound_message` determines the `outbound_message` sent to the device. If a keyword could not be matched in the `inbound_message`, this field is absent.


  - **`outbound_message`** `string` **REQUIRED**

    The response sent to the SMS device, based on the inbound message and keyword.



**Used in:**

- [Open an event stream]({{< ref "/developer/rest-api/connect/operations/event-stream/" >}}#openeventstream)

**Examples**

*Example mobile_originated_sms event body*

```json
{
  "event_type": "mobile_originated_sms",
  "identifiers": {
    "sender": "15558675309",
    "msisdn": "15558968663"
  },
  "properties": {
    "inbound_message": "join",
    "outbound_message": "Thanks for joining!",
    "keyword": "join"
  }
}

```

---

## Request filters {#eventsrequestfilters}

An array of filter objects defining the events you want to see in the event stream. A filter object defines a function that either passes or fails an event. Events are included in the response if they pass any of the functions defined by the objects in the array.


[Jump to examples ↓](#eventsrequestfilters-examples)

- **`device_types`** `array[string]`

  Returns events pertaining to devices on the specified platforms.

  Possible values: `android`, `ios`, `amazon`, `web`, `email`, `sms`, `open`

- **`devices`** `array`

  Limits the stream to events relating to specific device attributes.

  **Any of:**

    - **`channel`** `string`

      The unique, platform-agnostic channel identifier for a device.

    - **`named_user_id`** `string`

      The Named User for a device. The event stream will return events pertaining to the Named User.


- **`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.

  Format: `milliseconds`

- **`notifications`** `object`

  Limits the stream to events related to one or more specific pushes. This allows you to easily track the events generated by a given push or pipeline. In this object, you should only specify one of `push_id` or `group_id`. Child pushes may be included in the returned stream. If they are, they will have a Group ID relating them back to the push to local time or automation specification that spawned them.


  **One of:**

  - **Push ID** `object`
    - **`push_id`** `string`

      The push you want to return events for.

  - **Group ID** `object`
    - **`group_id`** `string`

      The group you want to return events for.


- **`predicates`** `array[object]` <[JSON Predicate]({{< ref "/developer/rest-api/connect/schemas/json-predicates/" >}}#json_predicate)>

  Limits events to a subset of the event payload.

- **`types`** `array[string]`

  Specifies the [event](/docs/developer/rest-api/connect/schemas/events/) types you want to return in the event stream.

  Possible values: `ATTRIBUTE_OPERATION`, `CLOSE`, `COMPLIANCE`, `CONTACT_CHANGE`, `CONTROL`, `CUSTOM`, `FEATURE_FLAG_INTERACTION`, `FIRST_OPEN`, `FIRST_OPT_IN`, `IN_APP_BUTTON_TAP`, `IN_APP_EXPERIENCES`, `IN_APP_FORM_DISPLAY`, `IN_APP_FORM_RESULT`, `IN_APP_MESSAGE_CONTROL`, `IN_APP_MESSAGE_DISPLAY`, `IN_APP_MESSAGE_EXCLUSION`, `IN_APP_MESSAGE_EXPIRATION`, `IN_APP_MESSAGE_RESOLUTION`, `IN_APP_PAGE_SWIPE`, `IN_APP_PAGE_VIEW`, `IN_APP_PAGER_COMPLETED`, `IN_APP_PAGER_SUMMARY`, `LABEL_EVENT`, `LOCATION`, `MOBILE_ORIGINATED`, `OPEN`, `PUSH_BODY`, `REGION`, `RICH_CONTROL`, `RICH_DELETE`, `RICH_DELIVERY`, `RICH_READ`, `SCREEN_VIEWED`, `SEND`, `SEND_ABORTED`, `SEND_REJECTED`, `SHORT_LINK_CLICK`, `SUBSCRIPTION`, `SUBSCRIPTION_LIST`, `TAG_CHANGE`, `UNINSTALL`, `WEB_CLICK`, `WEB_SESSION`

- **`users`** `array`

  Limits the stream to events relating to specific users.

  **Any of:**

  - [Contact]({{< ref "/developer/rest-api/connect/schemas/user-information/" >}}#contact)

    Contact information associated with the device at the time the event occurs.

    - **`named_user_id`** `string`

      The Named User for a user object. The event stream will return events pertaining to the Named User.



**Used in:**

- [Open an event stream]({{< ref "/developer/rest-api/connect/operations/event-stream/" >}}#openeventstream)

**Examples**

*Example filter*

```json
{
  "device_types": ["ios"],
  "latency": 120000,
  "notifications": {"push_id": "fae0658c-930e-4f66-bc78-80f46222bc8c"},
  "types": ["OPEN", "SEND"],
  "devices": [{"named_user_id": "VIP Customer"}]
}

```

```json
{
  "device_types": ["ios"],
  "latency": 120000,
  "notifications": {"push_id": "af03151e-5ad5-4e30-bbd2-bda28312b3c7"},
  "types": ["RICH_READ"],
  "users": [{"named_user_id": "best_customer"}]
}

```

```json
{
  "device_types": ["ios"],
  "latency": 300,
  "notifications": {"push_id": "6626393d-5d42-4de5-a31d-e24e819876ac"},
  "types": ["CLOSE"],
  "users": [{"contact_id": "982B35f2-0375-6384-893e-a19b5cd5R771"}]
}

```

*Example Predicate filter*

```json
{
  "predicates": [
  {
    "and": [
      {
        "key": "type",
        "value": {
          "equals": "CUSTOM"
        }
      },
      {
        "scope": "body",
        "key": "name",
        "value": {
          "equals": "initial_open"
        }
      }
    ]
  }
  ]
}

```

---

## Request 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.

[Jump to examples ↓](#subset-examples)

- **`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`

  Required when the `type` is `SAMPLE`. Specifies the percentage of events that will appear in the response, chosen randomly.

  Min: 0, Max: 1

  Format: `float`

- **`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`** `string`

  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`).

  Possible values: `SAMPLE`, `PARTITION`


**Used in:**

- [Open a compliance event stream]({{< ref "/developer/rest-api/connect/operations/compliance-event-stream/" >}}#opencomplianceeventstream)
- [Open an event stream]({{< ref "/developer/rest-api/connect/operations/event-stream/" >}}#openeventstream)

**Examples**

*Subset `SAMPLE`*

```json
{
  "type": "SAMPLE",
  "proportion": 0.1
}

```

*Subset `PARTITION`*

```json
{
  "type": "PARTITION",
  "count": 10,
  "selection": 0
}

```

---

