> ## Documentation Index
> Fetch the complete documentation index at: https://documentation.onesignal.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update in-app message

> Replace a custom HTML in-app message's html, schedule, audience, and triggers. An update replaces the whole in-app message, so send every required field on each request.

## Overview

Update an existing custom HTML [in-app message](https://documentation.onesignal.com/docs/en/in-app-messages-setup.md). This API updates custom HTML in-app messages only. Use this endpoint to change an in-app message's HTML, schedule, audience, triggers, or redisplay settings, and to publish a draft.

> [!WARNING]
>
> An update replaces the whole in-app message. It is not a patch. `html`, `start_time`, `end_time`, and `triggers` are required on every request. Read the in-app message with [View in-app message](https://documentation.onesignal.com/reference/view-in-app-message.md) first and send the stored values back for anything you are not changing.

Two kinds of in-app message cannot be updated through the API. Both requests are rejected with a `400` and nothing changes:

* An in-app message built with the [Block Editor](https://documentation.onesignal.com/docs/en/design-your-in-app-message.md).
* An in-app message with language variants authored in the dashboard. The API manages an in-app message's default language only.

***

## How to use this API

Authenticate with your [App API Key](https://documentation.onesignal.com/docs/en/keys-and-ids.md). The body has two top-level keys: `is_draft` and `in_app_message`.

```json theme={null}
{
  "is_draft": false,
  "in_app_message": {
    "name": "Welcome offer (updated)",
    "display_duration": 0,
    "html": "<!doctype html><html><body><h1>Welcome!</h1><p>25% off your first order.</p></body></html>",
    "start_time": "2026-11-01T00:00:00Z",
    "end_time": null,
    "triggers": [
      { "conditions": [{ "kind": "session_time", "operator": "greater", "value": 30 }] }
    ]
  }
}
```

### Draft or publish

`is_draft` is required and sets whether the in-app message is live after the update.

* `is_draft: true` leaves the in-app message paused, and pauses it if it was live.
* `is_draft: false` publishes the in-app message, including an in-app message that was paused before this update.

Send `is_draft` at the top level of the body, beside `in_app_message`. A missing key, `null`, or an `is_draft` nested inside `in_app_message` is rejected with a `400` and nothing changes.

### Required and optional fields

| Field | Required | How to keep the stored value |
| - | - | - |
| `name` | Yes | Send the stored value. |
| `display_duration` | Yes | Send the stored value. |
| `html` | Yes | Send the stored value. Every update stores a new version of the HTML. |
| `start_time` | Yes | Send the stored value. |
| `end_time` | Yes | Send the stored value, or `null` for no end. The key must be present. |
| `triggers` | Yes | Send the stored trigger sets, or `[]` to show the in-app message on app open. The key must be present and must be an array. |
| `redisplay_delay`, `redisplay_limit` | No | Omit both to keep the stored pair. Send both as integers to change them, or both as `null` to show the in-app message once. |
| `included_segment_ids`, `excluded_segment_ids` | No | Omit the key to keep the stored list. Send `[]` to clear it. |

Trigger sets are recreated on every update, so the `id` values of trigger sets and conditions change. You can send the `id` values back or omit them.

Triggers, redisplay settings, and limits follow the same rules as [Create in-app message](https://documentation.onesignal.com/reference/create-in-app-message.md#triggers). An update keeps the in-app message's dashboard labels.

### Removed clickable elements

OneSignal keeps the stats of clickable elements that an update removes from the HTML. An in-app message can hold up to 100 removed `data-onesignal-unique-label` values. An update that would exceed 100 is rejected with a `400`. Create a new in-app message to continue.

### Permissions

An API key can update and publish in-app messages in its app. A request made with an OAuth access token, such as through the [OneSignal MCP server](https://documentation.onesignal.com/docs/en/model-context-protocol.md), acts with the [role](https://documentation.onesignal.com/docs/en/manage-team-members.md) of the signed-in user. A role that can edit in-app messages but cannot activate them, such as Composer, can save with `is_draft: true`. With `is_draft: false`, that role receives a `403` when the in-app message is paused or is currently live.

## Response

A successful request returns `200 OK` with the `id` of the in-app message:

```json theme={null}
{
  "success": true,
  "payload": { "id": "2c5c6b7e-0f6d-4a5e-9a2b-1a2b3c4d5e6f" }
}
```

> [!NOTE]
>
> A `429` rate limit response uses a different shape from the other errors on this endpoint. It has no `success` key and adds a `limit` key that names the rate limit: `{ "errors": ["API rate limit exceeded"], "limit": "API Per App" }`. See [Rate limits](https://documentation.onesignal.com/reference/rate-limits.md).


## OpenAPI

````yaml PUT /apps/{app_id}/in_app_messages/{id}
openapi: 3.1.0
info:
  title: api.onesignal.com
  version: '11.6'
servers:
  - url: https://api.onesignal.com
security:
  - {}
paths:
  /apps/{app_id}/in_app_messages/{id}:
    put:
      summary: Update in-app message
      description: >-
        Replace a custom HTML in-app message's definition. An update replaces
        the whole in-app message and is not a patch: `html`, `start_time`,
        `end_time`, and `triggers` are required on every request. Read the
        in-app message with [View in-app
        message](/reference/view-in-app-message) first and send the stored
        values back for anything you are not changing.
      operationId: update-in-app-message
      parameters:
        - name: app_id
          in: path
          description: >-
            Your OneSignal App ID in UUID v4 format. See [Keys &
            IDs](/docs/en/keys-and-ids).
          schema:
            type: string
            default: YOUR_APP_ID
          required: true
        - name: id
          in: path
          description: UUID of the in-app message to update.
          required: true
          schema:
            type: string
            default: YOUR_IN_APP_MESSAGE_ID
        - name: Authorization
          in: header
          description: >-
            Your App API key with prefix `Key `. See [Keys &
            IDs](/docs/en/keys-and-ids).
          required: true
          schema:
            type: string
            default: Key YOUR_APP_API_KEY
        - name: Content-Type
          in: header
          required: true
          schema:
            type: string
            default: application/json; charset=utf-8
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - is_draft
                - in_app_message
              properties:
                is_draft:
                  type: boolean
                  description: >-
                    `true` saves the in-app message paused, and pauses it if it
                    was live. `false` publishes it, including an in-app message
                    that was paused before this update. Send it at the top level
                    of the body, beside `in_app_message`.
                in_app_message:
                  type: object
                  required:
                    - name
                    - display_duration
                    - html
                    - start_time
                    - end_time
                    - triggers
                  properties:
                    name:
                      type: string
                      description: Name shown in the dashboard.
                      default: YOUR_IN_APP_MESSAGE_NAME
                    display_duration:
                      type: integer
                      minimum: 0
                      default: 0
                      description: >-
                        Seconds the in-app message stays on screen. `0` keeps it
                        until dismissed.
                    html:
                      type: string
                      description: >-
                        The full HTML document to display. Stored as a new
                        version on every update, so it is required even when
                        unchanged. Limited to 20 distinct
                        `data-onesignal-unique-label` values.
                    start_time:
                      type: string
                      format: date-time
                      description: >-
                        When the in-app message becomes eligible to display, in
                        ISO 8601 format. Send the stored value back to keep it.
                    end_time:
                      type:
                        - string
                        - 'null'
                      format: date-time
                      description: >-
                        When the in-app message stops displaying, in ISO 8601
                        format. Must not be before `start_time`. The key is
                        required. Send the stored value to keep it, or `null`
                        for no end.
                    triggers:
                      type: array
                      maxItems: 30
                      items:
                        $ref: '#/components/schemas/InAppMessageTriggerSet'
                      description: >-
                        Trigger sets that decide when the in-app message shows.
                        Maximum 30. The key is required. Send the stored sets to
                        keep them, or `[]` to show on app open.
                    redisplay_delay:
                      type:
                        - integer
                        - 'null'
                      description: >-
                        Seconds between showings to the same user. Send together
                        with `redisplay_limit`. Omit both to keep the stored
                        pair. Send both as `null` to show the in-app message
                        once.
                    redisplay_limit:
                      type:
                        - integer
                        - 'null'
                      description: >-
                        Maximum re-showings per user. Send together with
                        `redisplay_delay`. `2147483647` means unlimited.
                    included_segment_ids:
                      type: array
                      items:
                        type: string
                      description: >-
                        UUIDs of the Segments the in-app message is shown to.
                        Every ID must be a Segment of this app. Omit to keep the
                        stored list. Send `[]` to clear it.
                    excluded_segment_ids:
                      type: array
                      items:
                        type: string
                      description: >-
                        UUIDs of the Segments the in-app message is never shown
                        to. Omit to keep the stored list. Send `[]` to clear it.
                  description: The in-app message definition.
            examples:
              Request:
                value:
                  is_draft: false
                  in_app_message:
                    name: Welcome offer (updated)
                    display_duration: 0
                    html: >-
                      <!doctype html><html><body><h1>Welcome!</h1><p>25% off
                      your first order.</p></body></html>
                    start_time: '2026-11-01T00:00:00Z'
                    end_time: null
                    triggers:
                      - conditions:
                          - kind: session_time
                            operator: greater
                            value: 30
      responses:
        '200':
          description: '200'
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    description: '`true` when the request succeeded.'
                  payload:
                    type: object
                    properties:
                      id:
                        type: string
                        description: UUID of the in-app message.
              example:
                success: true
                payload:
                  id: 2c5c6b7e-0f6d-4a5e-9a2b-1a2b3c4d5e6f
        '400':
          description: The request is invalid. `errors` lists every problem found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InAppMessageErrorResponse'
              example:
                success: false
                errors:
                  - start_time is required.
                  - >-
                    end_time is required. Send null for a message with no end
                    time.
                  - >-
                    triggers is required. Send [] for a message shown on app
                    open.
        '401':
          description: >-
            The API key is missing or invalid, or belongs to another app or
            organization. This body has no `success` key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BasicErrorResponse'
              example:
                errors:
                  - >-
                    Access denied.  Please include an 'Authorization: ...'
                    header with a valid API key
                    (https://documentation.onesignal.com/docs/en/keys-and-ids#api-keys).
        '403':
          description: >-
            The role behind the request cannot activate in-app messages. This
            body has no `success` key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BasicErrorResponse'
              example:
                errors:
                  - Current user permissions do not allow this action.
        '404':
          description: No in-app message with that `id` exists for this app.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InAppMessageErrorResponse'
              example:
                success: false
                errors:
                  - In-App Message not found
        '409':
          description: >-
            The in-app message changed since it was read. Read it again and
            retry.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InAppMessageErrorResponse'
              example:
                success: false
                errors:
                  - >-
                    Commit rejected: a concurrent edit has already been
                    committed. Please refresh and retry.
        '422':
          description: The update's content could not be saved. `errors` explains why.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InAppMessageErrorResponse'
              example:
                success: false
                errors:
                  - >-
                    Commit failed: your editing session has expired. Please
                    refresh.
        '429':
          description: >-
            Rate limit exceeded. Requests to this path are blocked for 60
            seconds. This body has no `success` key.
          content:
            application/json:
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      type: string
                  limit:
                    type: string
                    description: Name of the rate limit that was exceeded.
              example:
                errors:
                  - API rate limit exceeded
                limit: API Per App
components:
  schemas:
    InAppMessageTriggerSet:
      type: object
      required:
        - conditions
      properties:
        id:
          type: string
          description: >-
            UUID of the trigger set. Returned in responses. Optional in
            requests.
        conditions:
          type: array
          maxItems: 30
          items:
            $ref: '#/components/schemas/InAppMessageTriggerCondition'
          description: Conditions that must all hold for the set to fire. Maximum 30.
    InAppMessageErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          description: Always `false`.
        errors:
          type: array
          items:
            type: string
          description: >-
            Every problem found with the request. Field-level errors start with
            the quoted field name, for example `'name' Message name required`.
    BasicErrorResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            type: string
          description: One or more human-readable error messages.
        success:
          type: boolean
          description: >-
            Present (and `false`) on some endpoints (notifications, templates,
            segments). Not emitted by every endpoint.
        reference:
          type: array
          items:
            type: string
          description: >-
            Documentation URL fragments related to the error. Only emitted by
            the API-key auth error helpers.
    InAppMessageTriggerCondition:
      type: object
      required:
        - kind
        - operator
      properties:
        id:
          type: string
          description: UUID of the condition. Returned in responses. Optional in requests.
        kind:
          type: string
          enum:
            - custom
            - session_time
            - min_time_since
          description: >-
            `custom` compares a trigger your app sets through the SDK.
            `session_time` is seconds since the current session started.
            `min_time_since` is seconds since the last in-app message was shown.
        property:
          type: string
          description: >-
            The trigger key your app sets through the SDK. Required for
            `custom`. Omit for the time kinds.
        operator:
          type: string
          enum:
            - greater
            - less
            - greater_or_equal
            - less_or_equal
            - equal
            - not_equal
            - exists
            - not_exists
          description: How the trigger value is compared with `value`.
        value:
          oneOf:
            - type: string
            - type: integer
          description: >-
            A string for `custom`. An integer from `1` to `2147483647` for
            `session_time` and `min_time_since`. Not required for `custom` with
            `exists` or `not_exists`.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.