Update the Current User';'s Email

Updates the email the current logged in user.

{warning} A user must have his/her account verified


Method Uri Auth Permissions
PUT /v1/auth/email Bearer JWT-Token none

Headers

The API requires a header Accept and Authorization to be submitted with the request:

{
    "Accept": "application/json",
    "Authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3M..." 
}

Data constraints

{
    "email": ["required","confirmed","email","string","unique:users,email"]
}

Success Responses

Condition : All required data provided is valid and added to the request body.

Code : 204 No COntent

Content example : Response will reflect back the created message':

HTTP/1.1 204 No Content
Server: nginx/1.18.0 (Ubuntu)
Connection: close
Cache-Control: no-cache, private
Date: Thu, 21 Jan 2021 10:51:02 GMT
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 59

Error Responses

Condition : If a user has not logged in or header data is incomplete.

Code : 401 Unauthorized

Content example :

{
  "message": "You must log in to do that.",
  "errors": [
    "Unauthenticated."
  ]
}

Code : 403 Forbidden

Content example :

{
    "message": "Your email address is not verified."
}

Code : 422 Unprocessible Entity Condition : If the email is not an email address

Content example :

{
    "message": "The given data was invalid.",
    "errors": {
        "email": [
            "The email must be a valid email address."
        ]
    }
}

Condition : If the email is confirmed with email_confirmation

{
  "message": "The given data was invalid.",
  "errors": {
    "email": [
      "Please confirm your new email address"
    ]
  }
}