Skip to main content

Update Profile Details

Updates the authenticated customer's profile information.

HTTP Request

Update Profile:

PATCH/api/shop/customers/me

Authorization

Authorization

  • Required: Yes
  • Permission: Authenticated Customer
  • Authentication: Token-based (`Authorization: Token <your_api_key>`)

Request Body

FieldTypeRequiredDescription
usernameStringNoCustomer's username
avatarStringNoURL to customer's avatar image
first_nameStringNoCustomer's first name
last_nameStringNoCustomer's last name
genderStringNoCustomer's gender (male, female)

Example Requests

1import requests
2
3# Update customer profile
4response = requests.patch('http://www.example.com/api/shop/customers/me', 
5  json={
6      'first_name': 'John',
7      'last_name': 'Doe',
8      'gender': 'male'
9  },
10  headers={'Authorization': 'Token <your_api_key>'}
11)
12print(response.json())

Status Codes

CodeDescription
200Profile retrieved/updated successfully
401Unauthorized — authentication required
400Bad request — validation errors
500Internal server error

Response Fields

FieldTypeDescription
idIntegerUnique ID of the customer
usernameStringCustomer's username
mobile_numberStringCustomer's phone number (read-only)
emailStringCustomer's email address (read-only)
avatarStringURL to customer's avatar image
first_nameStringCustomer's first name
last_nameStringCustomer's last name
full_nameStringCustomer's full name (computed field)
genderStringCustomer's gender
is_profile_completedBooleanWhether the profile is completed

Example Response

{
"id": 1,
"username": "behrooz3500",
"mobile_number": "09308744204",
"email": "behrooz21@hotmail.com",
"avatar": "http://127.0.0.1:8000/media/users/avatars/photo22132188258.jpg",
"first_name": "behrooz",
"last_name": "ghorbanie",
"full_name": "behrooz ghorbanie",
"gender": "male",
"is_profile_completed": true
}