---
openapi: 3.0.3
info:
  title: Braze REST API – Create scheduled messages
  description: |
    ## Prerequisites

    To use this endpoint, you'll need an [API key]({{site.baseurl}}/api/basics#rest-api-key-permissions) with the `messages.schedule.create` permission.

    ## Rate limit

    We apply the default Braze rate limit of 250,000 requests per hour to this endpoint, as documented in [API rate limits]({{site.baseurl}}/api/api_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 [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/schedule/create":
    post:
      summary: Create scheduled messages
      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_schedule_create_post_schedule_messages
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ScheduleMessagesRequest'
            examples:
              users:
                summary: Schedule for external user IDs and user aliases
                value:
                  broadcast: false
                  external_user_ids:
                    - external_user_identifiers
                  user_aliases:
                    - alias_name: example_name
                      alias_label: example_label
                  campaign_id: campaign_identifier
                  send_id: send_identifier
                  override_messaging_limits: false
                  recipient_subscription_state: subscribed
                  schedule:
                    time: '2030-01-01T09:00:00'
                    in_local_time: true
                    at_optimal_time: false
                  messages:
                    apple_push:
                      alert: Your order has shipped!
                      message_variation_id: message_variation_identifier
              segment:
                summary: Schedule for a segment
                value:
                  broadcast: true
                  segment_id: segment_identifiers
                  schedule:
                    time: '2030-01-01T09:00:00Z'
                  messages:
                    android_push:
                      title: Order update
                      alert: Your order has shipped!
              connected_audience:
                summary: Schedule for a connected audience at the optimal time
                value:
                  broadcast: true
                  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'
                  recipient_subscription_state: subscribed
                  schedule:
                    time: '2030-01-01T09:00:00'
                    in_local_time: false
                    at_optimal_time: true
                  messages:
                    apple_push:
                      alert: Your order has shipped!
      responses:
        "201":
          description: |
            The request was accepted. The response includes a `schedule_id`. No action needed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScheduleMessagesResponse'
              examples:
                success:
                  summary: Message scheduled
                  value:
                    dispatch_id: dispatch_identifier
                    schedule_id: schedule_identifier
                    message: success
        "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`.
            - **`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.
            - **More than 50 `external_user_ids` were provided:** Send 50 or fewer `external_user_ids` per request.
            - **The `schedule.time` is missing, malformed, or in the past:** Pass `schedule.time` as a future ISO 8601 UTC datetime.
            - **For local or optimal delivery, the `time` is in the past:** Pass a future `schedule.time` for local or optimal delivery.
            - **Both `in_local_time` and `at_optimal_time` are `true`:** Set only one of `in_local_time` or `at_optimal_time`.
            - **A message object is missing or invalid:** Correct the flagged message object, then retry. The error message is the specific message validation error (for example, `Apple max push length exceeded`).
          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
                broadcast_with_users:
                  summary: Broadcast with explicit users
                  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
                too_many_external_user_ids:
                  summary: More than 50 external_user_ids
                  value:
                    message: Max input length exceeded.
                invalid_time:
                  summary: The time is missing, malformed, or in the past
                  value:
                    message: "'time' must be an ISO 8601 time in UTC that has not passed"
                local_time_in_past:
                  summary: The local or optimal time is in the past
                  value:
                    message: "'time' must be an ISO 8601 time in UTC that is not in the past"
                local_and_optimal:
                  summary: Both in_local_time and at_optimal_time are true
                  value:
                    message: "only one of 'in_local_time' and 'at_optimal_time' can be true"
                invalid_message_object:
                  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.schedule.create` 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'
              examples:
                over_rate_limit:
                  summary: Over rate limit
                  value:
                    message: You have exceeded your limit of 250000 requests per hour. Please contact your account executive to increase your limit. If you do not have their info, you may contact Braze directly at https://www.braze.com/contact/.
        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.schedule.create` permission.
        Pass the key as `Authorization: Bearer YOUR_REST_API_KEY`.
  schemas:
    UserAlias:
      title: User alias
      type: object
      required: [alias_name, alias_label]
      properties:
        alias_name:
          type: string
          example: example_name
        alias_label:
          type: string
          example: example_label
    Schedule:
      title: Schedule object
      type: object
      required: [time]
      description: See [schedule object]({{site.baseurl}}/api/objects_filters/schedule_object/)
      properties:
        time:
          type: string
          description: Time to send the message in UTC, as an ISO 8601 datetime string.
          example: '2030-01-01T09:00:00Z'
        in_local_time:
          type: boolean
          example: false
        at_optimal_time:
          type: boolean
          example: false
    Messages:
      title: Messaging objects
      type: object
      description: |
        See [available messaging objects]({{site.baseurl}}/api/objects_filters/#messaging-objects). Include any of the following:

        - `apple_push` (optional, [apple push object]({{site.baseurl}}/api/objects_filters/messaging/apple_object/))
        - `android_push` (optional, [android push object]({{site.baseurl}}/api/objects_filters/messaging/android_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/))
        - `email` (optional, [email object]({{site.baseurl}}/api/objects_filters/messaging/email_object/))
        - `webhook` (optional, [webhook object]({{site.baseurl}}/api/objects_filters/messaging/webhook_object/))
        - `content_card` (optional, [content card object]({{site.baseurl}}/api/objects_filters/messaging/content_cards_object/))
        - `sms` (optional, [SMS object]({{site.baseurl}}/api/objects_filters/messaging/sms_object/))
      properties:
        apple_push:
          type: object
          additionalProperties: true
        android_push:
          type: object
          additionalProperties: true
        kindle_push:
          type: object
          additionalProperties: true
        web_push:
          type: object
          additionalProperties: true
        email:
          type: object
          additionalProperties: true
        webhook:
          type: object
          additionalProperties: true
        content_card:
          type: object
          additionalProperties: true
        sms:
          type: object
          additionalProperties: true
    ScheduleMessagesRequest:
      title: Create scheduled messages request
      type: object
      required: [schedule]
      description: |
        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 a Segment and users 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`.

            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.

            Defaults to false on 8/31/17, must be set to true if users are not specified.
          example: false
        external_user_ids:
          type: array
          maxItems: 50
          items:
            type: string
          description: See [external user identifier]({{site.baseurl}}/api/objects_filters/user_attributes_object/#braze-user-profile-fields).
          example:
            - external_user_identifiers
        user_aliases:
          type: array
          items:
            $ref: '#/components/schemas/UserAlias'
          description: See [user alias object]({{site.baseurl}}/api/objects_filters/user_alias_object/).
        audience:
          title: Connected audience object
          type: object
          additionalProperties: true
          description: See [connected audience]({{site.baseurl}}/api/objects_filters/connected_audience/).
        segment_id:
          type: string
          description: See [segment identifier]({{site.baseurl}}/api/identifier_types/).
          example: segment_identifiers
        campaign_id:
          type: string
          description: See [campaign identifier]({{site.baseurl}}/api/identifier_types/).
          example: campaign_identifier
        send_id:
          type: string
          description: See [send identifier]({{site.baseurl}}/api/identifier_types/).
          example: send_identifier
        override_messaging_limits:
          type: boolean
          default: false
          description: Ignore frequency capping for campaigns, defaults to false
          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: subscribed
        schedule:
          $ref: '#/components/schemas/Schedule'
        messages:
          $ref: '#/components/schemas/Messages'
    ScheduleMessagesResponse:
      title: Create scheduled messages response
      type: object
      properties:
        dispatch_id:
          type: string
          description: The dispatch identifier.
          example: dispatch_identifier
        schedule_id:
          type: string
          description: The schedule identifier. Save this identifier to update or delete the scheduled message later.
          example: schedule_identifier
        send_id:
          type: string
          description: The send identifier. Included when the request specifies a `campaign_id` and a `send_id`.
        message:
          type: string
          example: success
    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.
