curl --request PUT \
--url https://api.example.com/api/profile/{id}/update/Update the authenticated user profile information including avatar upload
curl --request PUT \
--url https://api.example.com/api/profile/{id}/update/Documentation Index
Fetch the complete documentation index at: https://mintlify.com/edimez14/password_generator/llms.txt
Use this file to discover all available pages before exploring further.
Authorization: Bearer <access_token>
PUT /api/profile/{id}/update/
| Parameter | Type | Description | Required |
|---|---|---|---|
| id | integer | The user ID (must match authenticated user) | Yes |
| Header | Value | Required |
|---|---|---|
| Authorization | Bearer | Yes |
| Content-Type | application/json or multipart/form-data | Yes |
{
"first_name": "John",
"last_name": "Doe",
"email": "[email protected]",
"number_phone": "1234567890",
"username": "john_doe_updated"
}
multipart/form-data encoding and include the avatar file field:
curl -X PUT https://api.example.com/api/profile/1/update/ \
-H "Authorization: Bearer <token>" \
-F "avatar=@/path/to/image.jpg" \
-F "first_name=John" \
-F "last_name=Doe"
| Field | Type | Description | Constraints |
|---|---|---|---|
| username | string | User’s username | Optional, unique |
| string | User’s email address | Optional, unique, max 200 chars | |
| first_name | string | User’s first name | Optional, max 200 chars |
| last_name | string | User’s last name | Optional, max 200 chars |
| number_phone | string | User’s phone number | Optional, max 10 chars |
| avatar | file | Profile image file | Optional, image file (jpg, png, etc.) |
{
"id": 1,
"username": "john_doe_updated",
"email": "[email protected]",
"first_name": "John",
"last_name": "Doe",
"number_phone": "1234567890",
"avatar": "/media/avatars/image.jpg",
"date_joined": "2024-01-15T10:30:00Z",
"last_login": "2024-03-10T14:20:00Z",
"is_active": true,
"is_staff": false,
"is_superuser": false
}
| Field | Type | Description |
|---|---|---|
| id | integer | Unique user identifier |
| username | string | User’s username |
| string | User’s email address | |
| first_name | string | User’s first name |
| last_name | string | User’s last name |
| number_phone | string | User’s phone number |
| avatar | string | URL path to user’s avatar image |
| date_joined | datetime | When the user account was created |
| last_login | datetime | Last login timestamp |
| is_active | boolean | Whether the user account is active |
| is_staff | boolean | Whether user has staff privileges |
| is_superuser | boolean | Whether user has superuser privileges |
{
"email": [
"This field must be a valid email address."
],
"username": [
"A user with that username already exists."
]
}
{
"detail": "Authentication credentials were not provided."
}
{
"error": "Not authorized"
}
{
"detail": "Not found."
}
{
"error": "Error message details"
}
curl -X PUT https://api.example.com/api/profile/42/update/ \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
-H "Content-Type: application/json" \
-d '{
"first_name": "Alice",
"last_name": "Wonderland",
"number_phone": "5559876543"
}'
curl -X PUT https://api.example.com/api/profile/42/update/ \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
-F "avatar=@profile_pic.jpg" \
-F "first_name=Alice" \
-F "last_name=Wonderland"
curl -X PUT https://api.example.com/api/profile/42/update/ \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]"
}'
{
"id": 42,
"username": "alice_wonder",
"email": "[email protected]",
"first_name": "Alice",
"last_name": "Wonderland",
"number_phone": "5559876543",
"avatar": "/media/avatars/alice_updated.jpg",
"date_joined": "2024-02-01T08:15:30Z",
"last_login": "2024-03-10T11:45:22Z",
"is_active": true,
"is_staff": false,
"is_superuser": false
}
/apps/users/views.py:97 as the update_profile function view:
@permission_classes([IsAuthenticated]) to require authenticationrequest.user matches the user being updated (authorization check)MultiPartParser and FormParser for file uploadsUsersSerializer with partial=True to allow partial updatesmedia/avatars/ directory