---
title: "Toggle the authenticated user's login_notification preference (OTP-gated)"
method: PATCH
path: "/v1/users/login_notification"
tags: ["Users"]
---

# Toggle the authenticated user's login_notification preference (OTP-gated)

`PATCH /v1/users/login_notification`

## Request

- Base URL: `https://identity-api.paymongo.com`
- URL: `https://identity-api.paymongo.com/v1/users/login_notification`
- Auth: HTTP bearer

Two-call flow with the same payload. Empty `code` validates the payload and issues an OTP challenge — response has `data.type = "challenge"` and carries `expiration_at`/`resend_at`/`factor`. Populated `code` re-validates, verifies the OTP, applies the toggle, and returns the persisted value — response has `data.type = "user"`. Both flows return 201 (challenge) / 200 (apply); clients discriminate on `data.type`.

## Request body

- UserUpdateLoginNotificationRequestEnvelopeDTO
  - `data` object
    - `attributes` UserUpdateLoginNotificationRequestDTO
      - `code` string
      - `factor` 'email' | 'sms' | 'totp'
      - `login_notification` boolean

## Response `200`

Applied the toggle (populated code in request)

- object: Standard response containing data and its metadata if any
  - `data` object
    - `attributes` UserUpdateLoginNotificationSuccessAttributesDTO
      - `login_notification` boolean
    - `id` string
    - `type` string
  - `has_more` boolean

## Other responses

- `201`: Issued an OTP challenge (empty code in request)
- `400`: Bad Request
- `401`: Unauthorized
- `410`: Gone
- `422`: Unprocessable Entity
- `429`: Too Many Requests
- `500`: Internal Server Error
- `502`: Bad Gateway

---

[API](https://skmtc.dev/paymongo/apis/identity.md) - [All operations](https://skmtc.dev/paymongo/apis/identity/llms.txt) - [OpenAPI document](https://skmtc.dev/paymongo/apis/identity/revisions/cc3056164874?raw)
