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

# Device Opt-out

> This API blocks or unblocks specific devices from receiving push notifications triggered from MoEngage. To prevent push notifications from reaching a specific user or all devices associated with a user, call the API to block them. This is useful for reasons such as device theft or fraudulent activity. For example, if a device is stolen, you can use this API to block it in MoEngage, ensuring that any scheduled push notifications with sensitive content do not get delivered. You can also use the API to unblock a device if it is recovered.

#### Rate Limit

The rate limit is 1000 API requests per minute.


## OpenAPI

````yaml /api/data/data.yaml post /devices/manage
openapi: 3.0.3
info:
  title: MoEngage Data APIs
  version: '1.0'
  description: >-
    This is a comprehensive OpenAPI specification for MoEngage's Data APIs,
    including User, Event, and Device management.

    It's designed to power an interactive API playground on your new
    documentation site.
servers:
  - url: https://api-{dc}.moengage.com/v1
    description: MoEngage Core API Server
    variables:
      dc:
        default: '01'
        description: >-
          The ‘dc’ in the API Endpoint URL refers to the MoEngage Data Center
          (DC). MoEngage hosts each customer in a different DC. You can find
          your DC number and replace the value of ‘dc’ in the URL by referring
          to the DC and API endpoint mapping
          [here](/api/introduction#data-centers). Your MoEngage Data Center (DC)
          can be 01, 02, 03, 04, 05, 06, or 101. 
security:
  - Authentication: []
tags:
  - name: User
    description: Operations for creating, updating, retrieving, and managing user profiles.
  - name: Event
    description: Operations for tracking user events.
  - name: Device
    description: Operations for managing user devices.
  - name: Tracking
    description: Endpoints for tracking attribution and installs.
  - name: Utilities
    description: Utility endpoints for testing connections.
  - name: File Imports
    description: Operations for managing asynchronous file imports.
  - name: Bulk
    description: Operations for importing users and events in bulk.
  - name: Webhooks
    description: Incoming webhook specifications from MoEngage.
paths:
  /devices/manage:
    post:
      tags:
        - Device
      summary: Device Opt-out
      description: >-
        This API blocks or unblocks specific devices from receiving push
        notifications triggered from MoEngage. To prevent push notifications
        from reaching a specific user or all devices associated with a user,
        call the API to block them. This is useful for reasons such as device
        theft or fraudulent activity. For example, if a device is stolen, you
        can use this API to block it in MoEngage, ensuring that any scheduled
        push notifications with sensitive content do not get delivered. You can
        also use the API to unblock a device if it is recovered.
      parameters:
        - name: app_id
          in: query
          required: true
          description: >-
            This is the Workspace ID of your MoEngage account that must be
            passed with the request. You can find it in the MoEngage dashboard
            at **Settings** > **Account** > **APIs** > **Workspace ID (earlier
            app id)**.
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeviceOptOutRequest'
      responses:
        '200':
          description: >-
            This response is returned when the request is processed
            successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenericSuccess'
              examples:
                success_response:
                  summary: Success Response
                  value:
                    status: success
                    message: Your request has been accepted and will be processed soon.
        '400':
          description: >-
            This response is returned when the required parameters are missing
            from the request, attributes are not found, and incorrect values are
            passed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    example: fail
                  error:
                    type: object
                    properties:
                      message:
                        type: string
                        description: >-
                          A descriptive error message explaining why the request
                          failed.
                      type:
                        type: string
                        description: >-
                          The type or category of the error
                          ("MissingAttributeError").
                      request_id:
                        type: string
                        description: >-
                          A unique identifier for the request, useful for
                          debugging.
                      attribute:
                        type: string
                        description: >-
                          This field denotes the attribute missing in the
                          payload.
              examples:
                missing_useridentifiervalue:
                  summary: User_identifier_value is missing in the payload
                  value:
                    status: fail
                    error:
                      attribute: user_identifier_value
                      message: user_identifier_value is not found in the payload
                      type: MissingAttributeError
                      request_id: YRJTbvRM
                missing_useridentifiertype:
                  summary: User_identifier_type is missing in the payload
                  value:
                    status: fail
                    error:
                      attribute: user_identifier_type
                      message: customer_identifier_type is not found in the payload
                      type: MissingAttributeError
                      request_id: nuJPehHC
                missing_actiontype:
                  summary: Action_type is missing in the payload
                  value:
                    status: fail
                    error:
                      attribute: action_type
                      message: Action_type is not found in the payload
                      type: MissingAttributeError
                      request_id: nuJPehHC
                missing_deviceid:
                  summary: Device_identifiers is missing in the payload
                  value:
                    status: fail
                    error:
                      attribute: device_identifiers
                      message: device_identifiers is missing in the payload
                      type: MissingAttributeError
                      request_id: jRwBuxdC
                invalid_deviceid:
                  summary: Action_type is missing in the payload
                  value:
                    status: fail
                    error:
                      attribute: device_identifiers
                      message: >-
                        device identifier can only be in ['moe_gaid', 'push_id',
                        'unique_id', 'device_unique_id'] 
                      type: ValueError
                      request_id: ZtrftlVn
        '401':
          description: >-
            This response is returned when the request does not have valid
            authentication credentials.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    example: fail
                  error:
                    type: object
                    properties:
                      message:
                        type: string
                        description: >-
                          A descriptive error message explaining why the request
                          failed.
                      type:
                        type: string
                        description: >-
                          The type or category of the error (e.g.,
                          Authentication required).
                      request_id:
                        type: string
                        description: >-
                          A unique identifier for the request, useful for
                          debugging.
              examples:
                auth_error:
                  summary: Authorization errors
                  value:
                    status: fail
                    error:
                      message: >-
                        App Secret key mismatch. Please login to the dashboard
                        to verify key
                      type: Authentication required
                      request_id: PVUDFisO
                missing_header:
                  summary: Missing authentication header
                  value:
                    status: fail
                    error:
                      message: Authentication Header Required
                      type: Authentication required
                      request_id: PisPjGQQ
        '403':
          description: >-
            This response is returned when your MoEngage account is suspended or
            blocked.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    example: fail
                  error:
                    type: object
                    properties:
                      message:
                        type: string
                        description: >-
                          A descriptive error message explaining why the request
                          failed.(e.g., Your account is suspended. Please
                          contact MoEngage team.)
                      type:
                        type: string
                        description: >-
                          The type or category of the error (e.g.,
                          BlockedClient, Account Suspended, Account Temporarily
                          Suspended).
                      request_id:
                        type: string
                        description: >-
                          A unique identifier for the request, useful for
                          debugging.
              examples:
                account_blocked:
                  summary: Account is blocked
                  value:
                    status: fail
                    error:
                      message: Your account is suspended. Please contact MoEngage team.
                      type: BlockedClient
                      request_id: ofHUEaEQ
                account_suspended:
                  summary: Account is suspended
                  value:
                    status: fail
                    error:
                      message: Your account is suspended. Please contact MoEngage team.
                      type: Account Suspended
                      request_id: gqJvCNYu
                temp_suspended:
                  summary: Account is temporarily suspended
                  value:
                    status: fail
                    error:
                      message: >-
                        Your account is temporarily suspended due to payment
                        issues.
                      type: Account Temporarily Suspended
                      request_id: ssSJjoyD
        '413':
          description: This response is returned when the payload size exceeds 128 KB.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    example: fail
                  error:
                    type: object
                    properties:
                      message:
                        type: string
                        description: >-
                          A descriptive error message explaining why the request
                          failed.
                      type:
                        type: string
                        description: >-
                          The type or category of the error (e.g., Payload too
                          large).
                      request_id:
                        type: string
                        description: >-
                          A unique identifier for the request, useful for
                          debugging.
              examples:
                payload_exceeded:
                  summary: Payloads exceeding the size limit
                  value:
                    status: fail
                    error:
                      message: Payload cannot exceed 128KB
                      type: Payload too large
                      request_id: VFzDwhwt
        '415':
          description: This response is returned when the content type is not supported.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    example: fail
                  error:
                    type: object
                    properties:
                      message:
                        type: string
                        description: >-
                          A descriptive error message explaining why the request
                          failed.
                      type:
                        type: string
                        description: >-
                          The type or category of the error (e.g., Unsupported
                          media type).
                      request_id:
                        type: string
                        description: >-
                          A unique identifier for the request, useful for
                          debugging.
              examples:
                unsupported_media_type:
                  summary: Unsupported media type
                  value:
                    status: fail
                    error:
                      message: Content type is not supported
                      type: Unsupported media type
                      request_id: SgBQfKJh
        '429':
          description: >-
            This response is returned when the number of requests has exceeded
            the rate limit.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    example: fail
                  error:
                    type: object
                    properties:
                      message:
                        type: string
                        description: >-
                          A descriptive error message explaining why the request
                          failed.
                      type:
                        type: string
                        description: >-
                          The type or category of the error (e.g., Rate Limits
                          Exceeded).
                      request_id:
                        type: string
                        description: >-
                          A unique identifier for the request, useful for
                          debugging.
              examples:
                rate_limit:
                  summary: Rate limit breach
                  value:
                    status: fail
                    error:
                      message: >-
                        Rate limits for customers exceeded. Please Try After
                        Some Time
                      type: Rate Limits Exceeded
                      request_id: onqucLYL
        '500':
          description: >-
            This response is returned when the system runs into an unexpected
            error.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    example: fail
                  error:
                    type: object
                    properties:
                      message:
                        type: string
                        description: >-
                          A descriptive error message explaining why the request
                          failed.
                      type:
                        type: string
                        description: >-
                          The type or category of the error (e.g., Server
                          Error).
                      request_id:
                        type: string
                        description: >-
                          A unique identifier for the request, useful for
                          debugging.
              examples:
                unknown_error:
                  summary: Unknown errors
                  value:
                    status: fail
                    error:
                      message: >-
                        An unexpected error was encountered while processing
                        this request. Please contact MoEngage Team
                      type: Server Error
                      request_id: KovrwJiF
components:
  schemas:
    DeviceOptOutRequest:
      type: object
      required:
        - user_identifier_type
        - user_identifier_value
        - action_type
      properties:
        user_identifier_type:
          type: string
          description: This field denotes the type of user identifier.
        user_identifier_value:
          type: string
          description: This field denotes the user identifier.
        action_type:
          type: string
          enum:
            - block
            - unblock
          description: This field denotes the type of action to be achieved using this API.
        reason:
          type: string
          description: This field denotes the reason for blocking or unblocking a device.
        client_reference_id:
          type: string
          description: This field denotes the reference ID of the user.
        device_identifiers:
          type: array
          description: >
            This field denotes the device identifiers associated with the device
            you intend to block or unblock. Supported values are:

            * `unique_id` (unique_id)

            * `device_unique_id` (device_id)

            * `push_id` (push_id)

            * `moe_gaid` (GAID)


            Note:


            * If you do not pass this value, the API blocks/unblocks all current
            devices of the user.

            * Ensure to pass any one of the device identifiers for a particular
            device.

            * When passing the device identifiers within the array, ensure to
            explicitly define each of them.
          items:
            type: object
            properties:
              GAID:
                type: string
                description: >-
                  This field denotes the unique advertising identifier for
                  Android devices to measure user behavior and campaign
                  performance.
              IDFV:
                type: string
                description: >-
                  This field denotes the unique advertising identifier for iOS
                  devices.
              unique_id:
                type: string
              device_unique_id:
                type: string
                description: >-
                  This field denotes the unique identifier used to identify the
                  device associated with a user in MoEngage.
              push_id:
                type: string
                description: This field denotes the Push token of the device.
    GenericSuccess:
      type: object
      properties:
        status:
          type: string
          description: >-
            This field contains the status of the request and specifies whether
            the request was successful.
          example: success
        message:
          type: string
          example: Your request has been accepted and will be processed soon.
  securitySchemes:
    Authentication:
      type: http
      scheme: basic
      description: >
        Authentication is done via Basic Auth. This requires a base64-encoded
        string of your credentials in the format 'username:password'.


        - **Username**: Use your MoEngage workspace ID (also known as the App
        ID). You can find it in the MoEngage dashboard at **Settings** >
        **Account** > **APIs** > **Workspace ID (earlier app id)**.

        - **Password**: Use your API Key, which you can find within the **Data**
        tile.


        **Note**: After you generate and save the Data API Key, DO NOT generate
        a new key unless there is a security breach. After you generate a
        different Data API key and save it, the authentication will start
        failing. You must update your existing data tracking. 


        For more information on authentication and getting your credentials,
        refer
        [here](https://www.moengage.com/docs/api/introduction#getting-your-credentials).

````