---
openapi: 3.0.3
info:
  title: Braze REST API – Send messages immediately using the API only
  description: |
    ## Prerequisites

    To use this endpoint, you'll need to generate an API key with the `messages.send` permission.

    ## Rate limit

    When you use connected audience filters in your request, this endpoint has a rate limit of 250 requests per minute. Otherwise, if you specify an `external_id`, this endpoint has a default rate limit of 250,000 requests per hour, shared between the endpoints documented in [API rate limits]({{site.baseurl}}/api/api_limits#requests-with-shared-rate-limits).

    This endpoint supports [batching API requests]({{site.baseurl}}/api/api_limits#batching-api-requests). One request can include any of the following:

    - Up to 50 `external_user_ids`
    - A segment of any size created in the Braze dashboard, specified by its `segment_id`
    - A [connected audience]({{site.baseurl}}/api/objects_filters/connected_audience) of any size
  version: 1.0.0
  contact:
    name: Braze Support
    url: https://www.braze.com/docs/braze_support/
  license:
    name: Braze Documentation
    url: https://www.braze.com/docs/api/home/
servers:
  - url: https://rest.iad-01.braze.com
    description: US-01
  - url: https://rest.iad-02.braze.com
    description: US-02
  - url: https://rest.iad-03.braze.com
    description: US-03
  - url: https://rest.iad-04.braze.com
    description: US-04
  - url: https://rest.iad-05.braze.com
    description: US-05
  - url: https://rest.iad-06.braze.com
    description: US-06
  - url: https://rest.iad-07.braze.com
    description: US-07
  - url: https://rest.iad-08.braze.com
    description: US-08
  - url: https://rest.us-10.braze.com
    description: US-10
  - url: https://rest.fra-01.braze.eu
    description: EU-01
  - url: https://rest.fra-02.braze.eu
    description: EU-02
  - url: https://rest.au-01.braze.com
    description: AU-01
  - url: https://rest.id-01.braze.com
    description: ID-01
  - url: https://rest.jp-01.braze.com
    description: JP-01
  - url: https://rest.kr-01.braze.com
    description: KR-01
security:
- BearerAuth: []
paths:
  "/messages/send":
    post:
      summary: Send messages immediately using the API only
      description: |
        ## Recipient targeting behavior

        - Include at least one of `external_user_ids`, `user_aliases`, `segment_id`, or `audience`. A request with none of them returns `Missing recipients`.
        - Including `external_user_ids` or `user_aliases` sends only to those users. You can't combine them with `broadcast: true`.
        - To send to a segment (`segment_id`) or connected audience (`audience`) without listing users, set `broadcast` to `true`. If `broadcast` is omitted or `false` and the request has no `external_user_ids` or `user_aliases`, it returns `Must provide external_user_ids unless the broadcast parameter is true`.
        - Some older workspaces have `broadcast` configured as optional. In those workspaces, omitting `broadcast` (rather than setting it to `false`) without users sends to the entire segment or connected audience.
      operationId: post_messages_send_post_send_messages
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SendMessagesRequest'
            examples:
              example_request:
                summary: Send to users, a segment, and a connected audience
                value:
                  broadcast: false
                  external_user_ids:
                    - external_user_identifier
                  user_aliases:
                    - alias_name: example_name
                      alias_label: example_label
                  segment_id: segment_identifier
                  audience:
                    AND:
                      - custom_attribute:
                          custom_attribute_name: eye_color
                          comparison: equals
                          value: blue
                      - custom_attribute:
                          custom_attribute_name: favorite_foods
                          comparison: includes_value
                          value: pizza
                      - OR:
                          - custom_attribute:
                              custom_attribute_name: last_purchase_time
                              comparison: less_than_x_days_ago
                              value: 2
                          - push_subscription_status:
                              comparison: is
                              value: opted_in
                      - email_subscription_status:
                          comparison: is_not
                          value: subscribed
                      - last_used_app:
                          comparison: after
                          value: '2019-07-22T13:17:55+0000'
                  campaign_id: campaign_identifier
                  send_id: send_identifier
                  override_frequency_capping: false
                  recipient_subscription_state: all
                  messages:
                    android_push:
                      title: Example title
                      alert: Example message
                    apple_push:
                      alert: Example message
                    content_card:
                      type: CLASSIC
                      title: Example title
                      description: Example description
                    email:
                      app_id: app_identifier
                      from: Example Sender <sender@example.com>
                      subject: Example subject
                      body: <p>Example message</p>
                    kindle_push:
                      title: Example title
                      alert: Example message
                    web_push:
                      title: Example title
                      alert: Example message
      responses:
        "201":
          description: |
            Created. The request was accepted and the message was sent. The response includes a `dispatch_id`. No action needed.

            Message sending endpoint responses include the message's `dispatch_id` for reference back to the dispatch of the message. The `dispatch_id` is the ID of the message dispatch, meaning the unique ID for each "transmission" sent from Braze. For more information, refer to [Dispatch ID behavior]({{site.baseurl}}/user_guide/messaging/messaging_fundamentals/dispatch_id/).

            A `schedule` object doesn't fail the request, because this endpoint sends immediately. When a `schedule` object was sent to the send endpoint, the response also lists `'schedule' is not supported on this endpoint` in `errors`. Remove `schedule`, or use a schedule endpoint instead.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SendMessagesResponse'
              examples:
                success:
                  summary: Message sent
                  value:
                    dispatch_id: example_dispatch_id
                    message: success
                schedule_not_supported:
                  summary: Message sent, schedule ignored
                  value:
                    dispatch_id: example_dispatch_id
                    message: success
                    errors:
                      - type: "'schedule' is not supported on this endpoint"
        "400":
          description: |
            Bad request. To resolve it:

            - **No audience was provided:** Include `external_user_ids`, `user_aliases`, `segment_id`, or `audience`.
            - **A `user_aliases` entry is malformed:** Pass each `user_aliases` entry as an object with string `alias_name` and `alias_label` values.
            - **The `broadcast` value isn't a boolean:** Pass `broadcast` as `true` or `false`.
            - **The `ignore_workspace_quiet_hours` value isn't a boolean:** Pass `ignore_workspace_quiet_hours` as `true` or `false`.
            - **`broadcast` is `true` but `external_user_ids` or `user_aliases` were also provided:** Set `broadcast` to `true` only when sending to a segment or connected audience, without explicit recipients.
            - **No users were provided and `broadcast` isn't `true`:** Include `external_user_ids` or `user_aliases`, or set `broadcast` to `true` and target a segment or connected audience.
            - **The target segment is archived:** Use an active segment.
            - **More than 50 `external_user_ids` were provided:** Send 50 or fewer `external_user_ids` per request.
            - **The `messages` object is missing or isn't an object:** Include a `messages` object that contains at least one messaging object.
            - **A message object is invalid:** The response returns the specific message validation error (for example, `Apple max push length exceeded`). Correct the flagged message object, then retry.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                missing_recipients:
                  summary: No audience was provided
                  value:
                    message: Missing recipients
                malformed_recipients:
                  summary: A user_aliases entry is malformed
                  value:
                    message: Malformed recipients
                broadcast_not_boolean:
                  summary: The broadcast value isn't a boolean
                  value:
                    message: Broadcast must be a boolean
                ignore_workspace_quiet_hours_not_boolean:
                  summary: The ignore_workspace_quiet_hours value isn't a boolean
                  value:
                    message: "'ignore_workspace_quiet_hours' must be a boolean"
                broadcast_with_users:
                  summary: Broadcast with external_user_ids or user_aliases
                  value:
                    message: Cannot send messages to external_user_ids with the broadcast parameter set to true. Broadcast is only available when sending to a Segment or Connected Audience
                missing_users:
                  summary: No users and broadcast isn't true
                  value:
                    message: Must provide external_user_ids unless the broadcast parameter is true. The broadcast parameter should only be used to send to segments of users rather than individuals
                segment_archived:
                  summary: The target segment is archived
                  value:
                    message: this segment has been archived, not sending
                too_many_external_user_ids:
                  summary: More than 50 external_user_ids
                  value:
                    message: Max input length exceeded.
                missing_messages:
                  summary: The messages object is missing or isn't an object
                  value:
                    message: Messages must be a hash where all values are message objects
                invalid_message:
                  summary: A message object is invalid
                  value:
                    message: Apple max push length exceeded
        "401":
          description: |
            Unauthorized. The REST API key is missing, malformed, or sent to the wrong REST endpoint. Send the key as `Authorization: Bearer YOUR_REST_API_KEY` to the correct [REST endpoint]({{site.baseurl}}/api/basics/#endpoints). For more causes, see [Errors and responses]({{site.baseurl}}/api/errors/#fatal-errors).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                invalid_api_key:
                  summary: Invalid API key
                  value:
                    message: 'Invalid API key: YOUR_REST_API_KEY'
        "403":
          description: Access denied. The REST API key doesn't have the required permission. Use a REST API key that has the `messages.send` permission.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                access_denied:
                  summary: Missing permission
                  value:
                    message: Access Denied
        "429":
          description: |
            Rate limited. You exceeded the rate limit for this endpoint. Slow your request rate and retry with exponential backoff. See [API rate limits]({{site.baseurl}}/api/api_limits/).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        5XX:
          description: |
            Internal server error. An unexpected error occurred on the Braze server. Retry with exponential backoff. If the error persists, contact [Support]({{site.baseurl}}/braze_support/).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: REST API key
      description: |
        REST API keys are created in the Braze dashboard at **Settings → APIs and
        Identifiers → API Keys**. The key must include the `messages.send` permission.
        Pass the key as `Authorization: Bearer YOUR_REST_API_KEY`.
  schemas:
    UserAlias:
      title: User alias
      type: object
      required: [alias_name, alias_label]
      description: See [user alias object]({{site.baseurl}}/api/objects_filters/user_alias_object/).
      properties:
        alias_name:
          type: string
          example: example_name
        alias_label:
          type: string
          example: example_label
    Messages:
      title: Messaging objects
      type: object
      description: |
        See [available messaging objects]({{site.baseurl}}/api/objects_filters/#messaging-objects). Include any of the following:

        - `android_push`: (optional, [Android push object]({{site.baseurl}}/api/objects_filters/messaging/android_object/))
        - `apple_push`: (optional, [Apple push object]({{site.baseurl}}/api/objects_filters/messaging/apple_object/))
        - `content_card`: (optional, [Content Card object]({{site.baseurl}}/api/objects_filters/messaging/content_cards_object/))
        - `email`: (optional, [email object]({{site.baseurl}}/api/objects_filters/messaging/email_object/))
        - `kindle_push`: (optional, [Kindle/FireOS push object]({{site.baseurl}}/api/objects_filters/messaging/kindle_and_fireos_object/))
        - `web_push`: (optional, [web push object]({{site.baseurl}}/api/objects_filters/messaging/web_objects/))
        - `webhook`: (optional, [webhook object]({{site.baseurl}}/api/objects_filters/messaging/webhook_object/))
        - `whats_app`: (optional, [WhatsApp object]({{site.baseurl}}/api/objects_filters/messaging/whats_app_object/))
        - `sms`: (optional, [SMS object]({{site.baseurl}}/api/objects_filters/messaging/sms_object/))
      properties:
        android_push:
          title: Android push object
          type: object
          additionalProperties: true
          description: See [Android push object]({{site.baseurl}}/api/objects_filters/messaging/android_object/).
        apple_push:
          title: Apple push object
          type: object
          additionalProperties: true
          description: See [Apple push object]({{site.baseurl}}/api/objects_filters/messaging/apple_object/).
        content_card:
          title: Content Card object
          type: object
          additionalProperties: true
          description: See [Content Card object]({{site.baseurl}}/api/objects_filters/messaging/content_cards_object/).
        email:
          title: Email object
          type: object
          additionalProperties: true
          description: See [email object]({{site.baseurl}}/api/objects_filters/messaging/email_object/).
        kindle_push:
          title: Kindle/FireOS push object
          type: object
          additionalProperties: true
          description: See [Kindle/FireOS push object]({{site.baseurl}}/api/objects_filters/messaging/kindle_and_fireos_object/).
        web_push:
          title: Web push object
          type: object
          additionalProperties: true
          description: See [web push object]({{site.baseurl}}/api/objects_filters/messaging/web_objects/).
        webhook:
          title: Webhook object
          type: object
          additionalProperties: true
          description: See [webhook object]({{site.baseurl}}/api/objects_filters/messaging/webhook_object/).
        whats_app:
          title: WhatsApp object
          type: object
          additionalProperties: true
          description: See [WhatsApp object]({{site.baseurl}}/api/objects_filters/messaging/whats_app_object/).
        sms:
          title: SMS object
          type: object
          additionalProperties: true
          description: See [SMS object]({{site.baseurl}}/api/objects_filters/messaging/sms_object/).
    SendMessagesRequest:
      title: Send messages request
      type: object
      required: [messages]
      description: |
        **Tip:** Be sure to include [messaging objects]({{site.baseurl}}/api/objects_filters/#messaging-objects) in your body to complete your requests.

        You will need to include at least one of `segment_id`, `external_user_ids`, and `audience`:

        - Including `segment_id` will send to members of that segment.
        - Including `external_user_ids` and/or `user_aliases` will send to those users.
        - Including both will send to the provided users if they are in the segment.
      properties:
        broadcast:
          type: boolean
          default: false
          description: |
            You must set `broadcast` to true when sending a message to an entire segment that a campaign or Canvas targets. This parameter defaults to false (as of August 31, 2017).

            If `broadcast` is set to true, a `recipients` list cannot be included. However, use caution when setting `broadcast: true`, as unintentionally setting this flag may cause you to send your message to a larger than expected audience.

            Must be set to true if no `external_user_ids` or aliases are provided.
          example: false
        external_user_ids:
          type: array
          maxItems: 50
          items:
            type: string
          description: See [external user ID]({{site.baseurl}}/api/objects_filters/user_attributes_object/#braze-user-profile-fields).
          example:
            - external_user_identifier
        user_aliases:
          type: array
          items:
            $ref: '#/components/schemas/UserAlias'
          description: See [user alias object]({{site.baseurl}}/api/objects_filters/user_alias_object/).
        segment_id:
          type: string
          description: See [segment identifier]({{site.baseurl}}/api/identifier_types/#segment-identifier).
          example: segment_identifier
        audience:
          title: Connected audience object
          type: object
          additionalProperties: true
          description: See [connected audience]({{site.baseurl}}/api/objects_filters/connected_audience/).
        campaign_id:
          type: string
          description: |
            See [campaign identifier]({{site.baseurl}}/api/identifier_types/#campaign-identifier) for more information.

            *Required to track campaign metrics (such as _Sends_, _Clicks_, or _Bounces_) on the Braze dashboard, or to see events associated with this message in the user profile [Message History tab]({{site.baseurl}}/user_guide/audience/manage_audience/user_profiles/). Without a `campaign_id`, Braze doesn't increment dashboard deliverability stats. Sends still appear in the [Message Activity Log]({{site.baseurl}}/user_guide/administer/global/workspace_settings/logs_and_alerts/message_activity_log/), but not in email performance metrics in the dashboard.
          example: campaign_identifier
        send_id:
          type: string
          description: See [send identifier]({{site.baseurl}}/api/identifier_types/#send-identifier).
          example: send_identifier
        override_frequency_capping:
          type: boolean
          default: false
          description: Ignore `frequency_capping` for campaigns, defaults to `false`.
          example: false
        ignore_workspace_quiet_hours:
          type: boolean
          default: false
          description: Send the message even when the send time falls inside [workspace quiet hours]({{site.baseurl}}/user_guide/messaging/messaging_fundamentals/quiet_hours/workspace_quiet_hours/) for its channel. Defaults to `false`. A value that isn't a boolean returns a `400` error. Scheduled API campaigns don't support this parameter on the [`/messages/schedule/create` endpoint]({{site.baseurl}}/api/endpoints/messaging/schedule_messages/post_schedule_messages/).
          example: false
        recipient_subscription_state:
          type: string
          enum: [opted_in, subscribed, all]
          default: subscribed
          description: |
            Use this to send messages to only users who have opted in (`opted_in`), only users who have subscribed or are opted in (`subscribed`) or to all users, including unsubscribed users (`all`).

            Using `all` users is useful for transactional email messaging. Defaults to `subscribed`.
          example: all
        messages:
          $ref: '#/components/schemas/Messages'
    SendMessagesResponse:
      title: Send messages response
      type: object
      properties:
        dispatch_id:
          type: string
          description: The dispatch identifier for this send, used to correlate the request with message engagement events.
          example: example_dispatch_id
        message:
          type: string
          description: Returns `success` when the request completes without errors.
          example: success
        errors:
          type: array
          description: Non-fatal errors encountered while processing the request. Data unaffected by these errors is still processed.
          items:
            type: object
            properties:
              type:
                type: string
                description: The error type.
    ErrorResponse:
      title: Error
      type: object
      properties:
        message:
          type: string
          description: The error message describing why the request failed.
        errors:
          type: array
          description: Non-fatal errors encountered while processing the request. Data unaffected by these errors is still processed.
          items:
            type: object
            properties:
              type:
                type: string
                description: The error type.
