---
openapi: 3.0.3
info:
  title: Braze REST API – Query hard bounced emails
  description: |
    ## Prerequisites

    To use this endpoint, you'll need an [API key]({{site.baseurl}}/api/basics#rest-api-key-permissions) with the `email.hard_bounces` 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/).
  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:
  "/email/hard_bounces":
    get:
      summary: Query hard bounced emails
      operationId: get_email_hard_bounces_get_list_hard_bounces
      description: |
        ## Query by email or date range

        **Important:** You must provide an `email`, or a date pair `start_date` and `end_date`. If you provide all three, `start_date`, `end_date`, and an `email`, we prioritize the emails given and disregard the date range.

        If your date range has more than the `limit` number of hard bounces, you will need to make multiple API calls, each time increasing the `offset` until a call returns either fewer than `limit` or zero results. Including `offset` and `limit` parameters with `email` can return an empty response.
      parameters:
        - name: start_date
          in: query
          required: false
          description: "Required with `end_date` unless you provide `email`. This is the start date of the range to retrieve hard bounces and must be earlier than `end_date`. This is treated as midnight in UTC time by the API."
          schema:
            type: string
            format: date
          example: "2019-01-01"
        - name: end_date
          in: query
          required: false
          description: Required with `start_date` unless you provide `email`. This is the end date of the range to retrieve hard bounces. This is treated as midnight in UTC time by the API.
          schema:
            type: string
            format: date
          example: "2019-02-01"
        - name: limit
          in: query
          required: false
          description: Optional field to limit the number of results returned. Defaults to 100, maximum is 500.
          schema:
            type: integer
            minimum: 1
            maximum: 500
            default: 100
          example: 100
        - name: offset
          in: query
          required: false
          description: Optional beginning point in the list to retrieve from.
          schema:
            type: integer
            minimum: 0
          example: 1
        - name: email
          in: query
          required: false
          description: "Required unless you provide both `start_date` and `end_date`. If provided, we'll return whether or not the user has hard bounced. Check that the email strings are formatted properly."
          schema:
            type: string
          example: example@example.com
      responses:
        "200":
          description: The request succeeded and the response body lists the hard-bounced email addresses. No action needed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListHardBouncesResponse'
              examples:
                success:
                  summary: Hard bounced emails
                  value:
                    emails:
                      - email: example1@example.com
                        hard_bounced_at: "2019-01-15 12:00:00 +0000"
                      - email: example2@example.com
                        hard_bounced_at: "2019-01-20 08:30:00 +0000"
                      - email: example3@example.com
                        hard_bounced_at: "2019-01-28 17:45:00 +0000"
                    message: success
        "400":
          description: |
            Bad request. To resolve it:

            - **Neither an `email` nor a `start_date` and `end_date` pair was provided:** Include an `email`, or both `start_date` and `end_date`.
            - **The `start_date` is after the `end_date`:** Set `start_date` on or before `end_date`.
            - **A date isn't in `YYYY-MM-DD` format:** Format `start_date` and `end_date` as `YYYY-MM-DD`.
            - **More than 50 email addresses were provided:** Send 50 or fewer email addresses per request.
            - **The `limit` is less than 1:** Pass a `limit` of 1 or greater.
            - **The `limit` is greater than 500:** Pass a `limit` of 500 or fewer.
            - **The `offset` is less than 0:** Pass an `offset` of 0 or greater.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                email_or_dates_missing:
                  summary: No email or date range
                  value:
                    message: You must provide either an email or a start_date and end_date
                start_after_end:
                  summary: Start date after end date
                  value:
                    message: The start date must be before the end date
                bad_date_format:
                  summary: Date not in YYYY-MM-DD format
                  value:
                    message: Start date and end date must be in the format YYYY-MM-DD
                too_many_emails:
                  summary: More than 50 email addresses
                  value:
                    message: You can only pass in 1 to 50 emails at a time.
                limit_too_low:
                  summary: Limit less than 1
                  value:
                    message: Limit must be >= 1
                limit_too_high:
                  summary: Limit greater than 500
                  value:
                    message: You cannot set a limit to over 500
                offset_too_low:
                  summary: Offset less than 0
                  value:
                    message: Offset must be >= 0
        "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 `email.hard_bounces` 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 `email.hard_bounces` permission.
        Pass the key as `Authorization: Bearer YOUR_REST_API_KEY`.
  schemas:
    HardBouncedEmail:
      title: Hard bounced email
      type: object
      properties:
        email:
          type: string
          description: An email that has hard bounced.
          example: example1@example.com
        hard_bounced_at:
          type: string
          description: The time the email hard bounced, formatted as `YYYY-MM-DD HH:MM:SS +0000` (for example, `2019-01-15 12:00:00 +0000`).
          example: "2019-01-15 12:00:00 +0000"
    ListHardBouncesResponse:
      title: Query hard bounced emails response
      type: object
      properties:
        emails:
          type: array
          items:
            $ref: '#/components/schemas/HardBouncedEmail'
        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.
