ورود | ثبت نام
  • FA
  • EN

API Docs

PUT /api/v1/auth/me

Allows the currently authenticated user to update their own profile information.


Permissions

This endpoint requires authentication but does not require any special permissions. Users can only update their own profile.


Request Body Parameters

NameTypeRequiredDescription
first_namestringNoFirst name (max 255 characters)
last_namestringNoLast name (max 255 characters)
emailstringNoEmail address (must be valid email format, unique)
usernamestringNoUsername (max 255 characters, unique)
heightintegerNoUser's height in centimeters
birth_datedateNoUser's birth date (format: YYYY-MM-DD)

Notes:

  • All parameters are optional. If omitted, they will not be updated.
  • Email and username must be unique across all users.
  • Users can reuse their own current email and username when updating other fields.

Request Example

PUT /api/v1/auth/me
Authorization: Bearer {token}
Content-Type: application/json

{
  "first_name": "John",
  "last_name": "Doe",
  "email": "john.doe@example.com",
  "username": "johndoe",
  "height": 180,
  "birth_date": "1990-05-15"
}

Response

200 OK

Returns the updated user resource.

Example

{
  "data": {
    "id": 1,
    "first_name": "John",
    "last_name": "Doe",
    "email": "john.doe@example.com",
    "username": "johndoe",
    "height": 180,
    "birth_date": "1990-05-15",
    "created_at": "2023-01-01T00:00:00.000000Z",
    "updated_at": "2023-01-15T10:30:00.000000Z",
    ...
  }
}

For a full schema, see User Resource.


Error Responses

StatusDescriptionReference
401Unauthorized (not authenticated)Authentication error
409Conflict (email or username already in use)See below
422Validation error (invalid input)Validation error

409 Conflict - Email Already in Use

{
  "error": "This email is already in use."
}

409 Conflict - Username Already in Use

{
  "error": "This username is already in use."
}

422 Validation Error Examples

{
  "message": "The email field must be a valid email address.",
  "errors": {
    "email": ["The email field must be a valid email address."]
  }
}
{
  "message": "The height field must be an integer.",
  "errors": {
    "height": ["The height field must be an integer."]
  }
}
{
  "message": "The birth date field must be a valid date.",
  "errors": {
    "birth_date": ["The birth date field must be a valid date."]
  }
}

Related Resources

footer wave
logo

دمبل، دنیای هوشمند ورزش و تغذیه

LinkedinInstagramXYoutubeTelegram