{
  "info": {
    "_postman_id": "reset-password-flow",
    "name": "Password Reset Flow",
    "description": "Complete password reset workflow with OTP verification and validation",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "item": [
    {
      "name": "1. Request Password Reset",
      "description": "Request OTP code to reset password. Send email and receive OTP via email.",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/x-www-form-urlencoded",
            "type": "text"
          }
        ],
        "body": {
          "mode": "urlencoded",
          "urlencoded": [
            {
              "key": "email",
              "value": "user@example.com",
              "description": "User email address",
              "type": "text"
            }
          ]
        },
        "url": {
          "raw": "{{base_url}}/user/request-password-reset",
          "protocol": "http",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "user",
            "request-password-reset"
          ]
        },
        "description": "Step 1: Send email to request password reset OTP"
      },
      "response": [
        {
          "name": "Success Response",
          "originalRequest": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/x-www-form-urlencoded",
                "type": "text"
              }
            ],
            "body": {
              "mode": "urlencoded",
              "urlencoded": [
                {
                  "key": "email",
                  "value": "user@example.com",
                  "type": "text"
                }
              ]
            },
            "url": {
              "raw": "{{base_url}}/user/request-password-reset",
              "protocol": "http",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "user",
                "request-password-reset"
              ]
            }
          },
          "status": "OK",
          "code": 200,
          "_postman_previewlanguage": "json",
          "header": [
            {
              "key": "Content-Type",
              "value": "application/json"
            }
          ],
          "cookie": [],
          "body": "{\n  \"status\": true,\n  \"data\": {\n    \"MESSAGE\": \"Mail has been sent to your email.\"\n  },\n  \"code\": 200\n}"
        },
        {
          "name": "Error - User Not Found",
          "originalRequest": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/x-www-form-urlencoded",
                "type": "text"
              }
            ],
            "body": {
              "mode": "urlencoded",
              "urlencoded": [
                {
                  "key": "email",
                  "value": "notfound@example.com",
                  "type": "text"
                }
              ]
            },
            "url": {
              "raw": "{{base_url}}/user/request-password-reset",
              "protocol": "http",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "user",
                "request-password-reset"
              ]
            }
          },
          "status": "Not Found",
          "code": 404,
          "_postman_previewlanguage": "json",
          "header": [
            {
              "key": "Content-Type",
              "value": "application/json"
            }
          ],
          "cookie": [],
          "body": "{\n  \"status\": false,\n  \"data\": {\n    \"MESSAGE\": \"User not found with this email\"\n  },\n  \"code\": 404\n}"
        }
      ]
    },
    {
      "name": "2. Verify Reset Code",
      "description": "Verify the OTP code received in email. Check if code is valid and not expired (15 minutes).",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/x-www-form-urlencoded",
            "type": "text"
          }
        ],
        "body": {
          "mode": "urlencoded",
          "urlencoded": [
            {
              "key": "email",
              "value": "user@example.com",
              "description": "User email address",
              "type": "text"
            },
            {
              "key": "code",
              "value": "123456",
              "description": "OTP code from email (6 digits)",
              "type": "text"
            }
          ]
        },
        "url": {
          "raw": "{{base_url}}/user/verify-reset-code",
          "protocol": "http",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "user",
            "verify-reset-code"
          ]
        },
        "description": "Step 2: Verify OTP code from email"
      },
      "response": [
        {
          "name": "Success Response",
          "originalRequest": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/x-www-form-urlencoded",
                "type": "text"
              }
            ],
            "body": {
              "mode": "urlencoded",
              "urlencoded": [
                {
                  "key": "email",
                  "value": "user@example.com",
                  "type": "text"
                },
                {
                  "key": "code",
                  "value": "123456",
                  "type": "text"
                }
              ]
            },
            "url": {
              "raw": "{{base_url}}/user/verify-reset-code",
              "protocol": "http",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "user",
                "verify-reset-code"
              ]
            }
          },
          "status": "OK",
          "code": 200,
          "_postman_previewlanguage": "json",
          "header": [
            {
              "key": "Content-Type",
              "value": "application/json"
            }
          ],
          "cookie": [],
          "body": "{\n  \"status\": true,\n  \"data\": {\n    \"MESSAGE\": \"Code is valid\"\n  },\n  \"code\": 200\n}"
        },
        {
          "name": "Error - Invalid or Expired Code",
          "originalRequest": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/x-www-form-urlencoded",
                "type": "text"
              }
            ],
            "body": {
              "mode": "urlencoded",
              "urlencoded": [
                {
                  "key": "email",
                  "value": "user@example.com",
                  "type": "text"
                },
                {
                  "key": "code",
                  "value": "000000",
                  "type": "text"
                }
              ]
            },
            "url": {
              "raw": "{{base_url}}/user/verify-reset-code",
              "protocol": "http",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "user",
                "verify-reset-code"
              ]
            }
          },
          "status": "Bad Request",
          "code": 400,
          "_postman_previewlanguage": "json",
          "header": [
            {
              "key": "Content-Type",
              "value": "application/json"
            }
          ],
          "cookie": [],
          "body": "{\n  \"status\": false,\n  \"data\": {\n    \"MESSAGE\": \"Invalid or expired code\"\n  },\n  \"code\": 400\n}"
        }
      ]
    },
    {
      "name": "3. Reset Password",
      "description": "Set new password with verified OTP code. Password must be 8+ characters with numbers and special characters.",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/x-www-form-urlencoded",
            "type": "text"
          }
        ],
        "body": {
          "mode": "urlencoded",
          "urlencoded": [
            {
              "key": "email",
              "value": "user@example.com",
              "description": "User email address",
              "type": "text"
            },
            {
              "key": "code",
              "value": "123456",
              "description": "OTP code from email",
              "type": "text"
            },
            {
              "key": "new_password",
              "value": "NewPass@123",
              "description": "New password (min 8 chars, 1 number, 1 special char)",
              "type": "text"
            },
            {
              "key": "confirm_password",
              "value": "NewPass@123",
              "description": "Confirm password (must match new_password)",
              "type": "text"
            }
          ]
        },
        "url": {
          "raw": "{{base_url}}/user/reset-password",
          "protocol": "http",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "user",
            "reset-password"
          ]
        },
        "description": "Step 3: Set new password with verified OTP code"
      },
      "response": [
        {
          "name": "Success Response",
          "originalRequest": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/x-www-form-urlencoded",
                "type": "text"
              }
            ],
            "body": {
              "mode": "urlencoded",
              "urlencoded": [
                {
                  "key": "email",
                  "value": "user@example.com",
                  "type": "text"
                },
                {
                  "key": "code",
                  "value": "123456",
                  "type": "text"
                },
                {
                  "key": "new_password",
                  "value": "NewPass@123",
                  "type": "text"
                },
                {
                  "key": "confirm_password",
                  "value": "NewPass@123",
                  "type": "text"
                }
              ]
            },
            "url": {
              "raw": "{{base_url}}/user/reset-password",
              "protocol": "http",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "user",
                "reset-password"
              ]
            }
          },
          "status": "OK",
          "code": 200,
          "_postman_previewlanguage": "json",
          "header": [
            {
              "key": "Content-Type",
              "value": "application/json"
            }
          ],
          "cookie": [],
          "body": "{\n  \"status\": true,\n  \"data\": {\n    \"MESSAGE\": \"Password reset successfully\",\n    \"user\": {\n      \"id\": 123,\n      \"email\": \"user@example.com\",\n      \"full_name\": \"User Name\",\n      \"mobile\": \"0501234567\"\n    }\n  },\n  \"code\": 200\n}"
        },
        {
          "name": "Error - Passwords Don't Match",
          "originalRequest": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/x-www-form-urlencoded",
                "type": "text"
              }
            ],
            "body": {
              "mode": "urlencoded",
              "urlencoded": [
                {
                  "key": "email",
                  "value": "user@example.com",
                  "type": "text"
                },
                {
                  "key": "code",
                  "value": "123456",
                  "type": "text"
                },
                {
                  "key": "new_password",
                  "value": "NewPass@123",
                  "type": "text"
                },
                {
                  "key": "confirm_password",
                  "value": "DifferentPass@456",
                  "type": "text"
                }
              ]
            },
            "url": {
              "raw": "{{base_url}}/user/reset-password",
              "protocol": "http",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "user",
                "reset-password"
              ]
            }
          },
          "status": "Bad Request",
          "code": 400,
          "_postman_previewlanguage": "json",
          "header": [
            {
              "key": "Content-Type",
              "value": "application/json"
            }
          ],
          "cookie": [],
          "body": "{\n  \"status\": false,\n  \"data\": {\n    \"MESSAGE\": \"Passwords do not match\"\n  },\n  \"code\": 400\n}"
        },
        {
          "name": "Error - Weak Password",
          "originalRequest": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/x-www-form-urlencoded",
                "type": "text"
              }
            ],
            "body": {
              "mode": "urlencoded",
              "urlencoded": [
                {
                  "key": "email",
                  "value": "user@example.com",
                  "type": "text"
                },
                {
                  "key": "code",
                  "value": "123456",
                  "type": "text"
                },
                {
                  "key": "new_password",
                  "value": "weak",
                  "type": "text"
                },
                {
                  "key": "confirm_password",
                  "value": "weak",
                  "type": "text"
                }
              ]
            },
            "url": {
              "raw": "{{base_url}}/user/reset-password",
              "protocol": "http",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "user",
                "reset-password"
              ]
            }
          },
          "status": "Bad Request",
          "code": 400,
          "_postman_previewlanguage": "json",
          "header": [
            {
              "key": "Content-Type",
              "value": "application/json"
            }
          ],
          "cookie": [],
          "body": "{\n  \"status\": false,\n  \"data\": {\n    \"MESSAGE\": \"Password must be at least 8 characters long, contain at least one number, and at least one special character\"\n  },\n  \"code\": 400\n}"
        }
      ]
    }
  ],
  "variable": [
    {
      "key": "base_url",
      "value": "http://stageapi.navagoo.com",
      "type": "string",
      "description": "Base API URL - update this for your environment"
    }
  ]
}
