Logo
Salesforce Developers API Documentation

User Photo

POST {{_endpoint}}/services/data/v{{version}}/connect/user-profiles/me/photo

Get, post, and crop a user photo. To use an image from the Files page as a user photo, pass the file ID in the fileId property of the request body or in the fileId request parameter. Images uploaded on the User page don’t have a file ID and can’t be used as the fileId.

To upload a binary file as the user photo, you must send it in a multipart/form-data message. For information about how to create the multipart/form-data message, see Uploading Binary Files.

To display user profile photos in a feed, cache the user photos. Then use the photoVersionId property of the Photo response body to determine when you need to update a photo. This technique helps you avoid running over limits and may improve mobile client performance.

 

Body PARAM

Key Datatype Required Description 



HEADERS

Key Datatype Required Description 
Content-Type
string
Content-Disposition
string
Content-Type
string




RESPONSES

status Created

{ "fullEmailPhotoUrl": "https://<my_domain>/img/userprofile/default_profile_200_v2.png?fromEmail=1", "largePhotoUrl": "https://<my_domain>/profilephoto/729.../F", "mediumPhotoUrl": "https://<my_domain>/profilephoto/729.../M", "photoVersionId": "729...", "smallPhotoUrl": "https://<my_domain>/profilephoto/729.../T", "standardEmailPhotoUrl": "https://<my_domain>/img/userprofile/default_profile_45_v2.png?fromEmail=1", "url": "/services/data/v58.0/connect/user-profiles/005.../photo" }



Curl
curl -X POST '/services/data/v61.0/connect/user-profiles/me/photo' -H 'Content-Type: multipart/form-data' -H 'Content-Disposition: form-data; name="photo"' -H 'Content-Type: application/json; charset=UTF-8' -F '{"name"=>"json", "value"=>"{\"cropY\":\"0\",\"cropX\":\"0\",\"cropSize\":\"200\"}", "datatype"=>"string"}=' -F '{"name"=>"fileUpload", "value"=>nil, "datatype"=>"null"}='

ENDPOINTS