---
openapi: 3.0.3
info:
  title: Braze REST API – Change email subscription status
  description: |
    ## Prerequisites

    To use this endpoint, you'll need an [API key]({{site.baseurl}}/api/basics#rest-api-key-permissions) with the `email.status` 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/status":
    post:
      summary: Change email subscription status
      operationId: post_email_status_post_email_subscription_status
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EmailSubscriptionStatusRequest'
            examples:
              example_request:
                summary: Subscribe one email address
                value:
                  email: example@example.com
                  subscription_state: subscribed
      responses:
        "201":
          description: The request succeeded and the email subscription state was updated. No action needed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EmailSubscriptionStatusResponse'
              examples:
                success:
                  summary: Subscription state updated
                  value:
                    message: success
        "400":
          description: |
            Bad request. To resolve it:

            - **No `email` address was provided:** Include at least one `email` address.
            - **The `subscription_state` isn't an allowed value:** Set `subscription_state` to `subscribed`, `unsubscribed`, `hard_bounced`, or `opted_in`.
            - **More than 50 email addresses were provided:** Send 50 or fewer email addresses per request.
            - **The `campaign_id` isn't valid:** Pass a valid `campaign_id`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                email_missing:
                  summary: No email address
                  value:
                    message: You must provide an email address.
                bad_subscription_state:
                  summary: Subscription state not allowed
                  value:
                    message: You must provide a subscription state that is either subscribed, unsubscribed, hard_bounced, or opted_in
                too_many_emails:
                  summary: More than 50 email addresses
                  value:
                    message: You can only pass in 1 to 50 emails at a time.
                invalid_campaign_id:
                  summary: Invalid campaign ID
                  value:
                    message: Invalid campaign ID
        "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.status` 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.status` permission.
        Pass the key as `Authorization: Bearer YOUR_REST_API_KEY`.
  schemas:
    EmailSubscriptionStatusRequest:
      title: Change email subscription status request
      type: object
      required: [email, subscription_state]
      properties:
        email:
          description: String email address to modify, or an array of up to 50 email addresses to modify.
          oneOf:
            - title: Single email address
              type: string
            - title: List of email addresses
              type: array
              minItems: 1
              maxItems: 50
              items:
                type: string
          example: example@example.com
        subscription_state:
          type: string
          description: Either "subscribed", "unsubscribed", or "opted_in".
          example: subscribed
    EmailSubscriptionStatusResponse:
      title: Change email subscription status response
      type: object
      properties:
        message:
          type: string
          description: Returns `success` when the request completes without errors.
          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.
