Skip to main content

users.profile.set method

Welcome to the new home of Slack developer docs!

We're still building and not all features are available quite yet. Enjoy this peek into the future!

Not ready for the future? Return to the past at api.slack.com.

Usage info

Is this the API Method for you? Here are some things to keep in mind while using the users.profile.set API Method.

  • Your workspace must be on a paid plan to use the users.profile.set API method in order to change the profile for other users.
  • You must select API as the Data source within the Configure Profiles admin tool in order to call this method.
  • The users.profile.set API method requires you to use a user access token (starts with xoxp-).
  • The role level for the token is determined by the user who installed the app.
  • Org users cannot change their own profile details.
  • You cannot change the profile details for another user unless you use a token that was generated by an Owner or Admin (For Enterprise Grid, this must be an Org Owner or Org Admin). You also cannot change the profile details for a user unless your role level is higher than theirs. Role levels from highest to lowest are: Primary Owner > Owner > Admin > Member > Guest. More information about roles can be found here. Therefore:
    • To change the profile of Admins, you must be using a token that was minimally generated by an Owner.
    • To change the profile of Owners, you must be using a token that was generated by a Primary Owner.

Profile fields

There are two ways to update non-custom profile fields with this method:

  • Update one field at a time by passing the pair of arguments name and value.
  • Update multiple fields by passing the argument profile.

You can update any of the following non-custom fields from the profile object within a Slack user object:

FieldDescription
display_nameThe display name the user has chosen to identify themselves by in their workspace profile. Maximum of 80 characters.
emailA valid email address. It cannot have spaces, or be in use by another member of the same team. It must have an @ and a domain. Changing a user's email address will send an email to both the old and new addresses, and also post a slackbot message to the user informing them of the change. You cannot update your own email using this method. This field can only be changed by admins for users on paid teams.
first_nameThe user's first name. The name slackbot cannot be used. Updating first_name will update the first name within real_name.
last_nameThe user's last name. The name slackbot cannot be used. Updating last_name will update the second name within real_name.
phoneThe user's phone number, in any format.
pronounsThe user's pronouns.
real_nameThe user's first and last name. Updating this field will update first_name and last_name. If only one name is provided, the value of last_name will be cleared. Maximum of 50 characters.
start_dateThe date the person joined the organization (Business+ or Enterprise customers only).
titleThe user's title.
The skype field will always be an empty string and cannot be set otherwise.

For more details, please read this changelog entry.

While profile image fields are present in the profile object, they cannot be set using the users.profile.set method. Use users.setPhoto and users.deletePhoto to update a user's profile image.

The following example payload updates the values of first_name, last_name, pronoun, and email for a user:

{
"profile": {
"first_name": "John",
"last_name": "Smith",
"pronouns": "they/them",
"email": "john@smith.com"
}
}

Custom profile fields

Custom fields are created within the organization admin tools. Once a field is created, you can update it for users with this API method.

Each custom profile field has a unique per-team ID. You can update a custom profile field by providing a key:value pair where the key is the relevant ID. Use team.profile.get to retrieve the profile fields and their IDs used by a team.

You can update a profile field by using the ID in the name field. To update custom profile fields, use the fields object instead. The fields object is an array of custom profile fields' key:value pairs.

If you update fields within the fields array, you can also choose to set the alt field. While the value of a field is what is usually displayed, the alt key will be displayed instead if it is set. The alt field can be up to 256 characters for all field types.

A field within the fields array needs a type. This determines the type of information value contains.

TypeDescription
datethe value must be a valid date.
linkthe value can be any valid link that's not more than 256 characters. The link text will be the alt value if set, or the data element name if alt is not set.
long_textthe value can be up to 5,000 characters of basic formatted mrkdown. See the long_text section below.
options_listthe value must be one of the possible_values in the field definition.
tagsthe value contains distinct elements known as multi-value tags. Individual tags can hold up to 50 characters. Any number of tags can be created by admins, but end-users can only add 75 tags to their profiles. See the tags section below.
textthe value can be up to 256 characters of plain text.
userthe value can be up to 25 user IDs, seperated by commas.

The following example sets the value of three fields; one with plain text, one with a date, and another with a link.

{
"profile": {
"fields": {
"Xf0111111": {
"value": "Barista",
"alt": ""
},
"Xf0222222": {
"value": "2022-04-11",
"alt": ""
},
"Xf0333333": {
"value": "https://example.com",
"alt": ""
}
}
}
}

Long_text (Flexible Text)

The value of a long_text field can be up to 5,000 characters of basic formatted mrkdown.

While you should use team.profile.get to get the ID for any field, including long-text fields, you should not copy the received schema. Below is a properly formatted payload for updating the long_text field with user.profile.set.

{
"profile": {
"fields": {
"Xf0222222": {
"value": "​​I make absolutely the best coffee you will *_ever_* taste. Learn more about where I studied <http://www.example.com|how to pull an espresso shot>. :coffee:",
"alt": ""
}
}
}
}

Tags (Smart Tags)

The value of a tags field contains distinct elements known as multi-value tags. Individual tags can hold up to 50 characters. Any number of tags can be created by admins, but end-users can only add 75 tags to each smart tag element on their profiles.

While you should use team.profile.get to get the ID for any field, including smart tag fields, you should not copy the received schema. Below is a properly formatted payload for updating the tags field with user.profile.set.

{
"fields": {
"Xf0333333": {
"value": [
"Mocha", "Latte", "Americano"
],
"alt": ""
}
}
}

Name Pronunciation

The Name Pronunciation field lets a user provide a text description of how their name is pronounced. This text is displayed under their job title.

Use team.profile.get to obtain the field ID. Below is an example payload for updating the field once you have that ID:

{
"profile": {
"fields": {
"Xf0444444": {
"value": "Zoë is pronounced zo-ee",
"alt": ""
}
}
}
}
Name Recordings

A user can also record an audio file of how their name is pronounced. This name recording will appear on their profile as a speaker icon. A Name Recording cannot be updated via API.

Status updates

This method is also used to set a user's current status.

Place the following status fields within the profile object when calling users.profile.set:

FieldTypeDescription
status_emojistringThe displayed emoji that is enabled for the Slack team, such as :train:.
status_expirationintegerthe Unix timestamp of when the status will expire. Providing 0 or omitting this field results in a custom status that will not expire.
status_textstringThe displayed text of up to 100 characters. We strongly encourage brevity.

For example, the following payload sets a custom status of 🚆 riding a train and has it expire on July 26th, 2018 at 17:51:46 UTC:

{
"profile": {
"status_text": "riding a train",
"status_emoji": ":train:",
"status_expiration": 1532627506
}
}

To manually unset a user's custom status, provide empty strings to both the status_text and status_emoji attributes: "".

Start dates

A user's start date can be found in the start_date non-custom profile field. You can update this field like any other non-custom profile field.

{
"profile": {
"start_date": "2022-10-22"
},
"user": "U123ABC456"
}

When you update a user's start date, both the start_date field and a custom profile field with its own unique field ID is updated.

While it's perfectly fine to just update start_date, you could also choose to update this custom field instead, after obtaining the custom field ID with team.profile.get. Updating one of these fields will update the other field accordingly.

{
"profile": {
"fields": {
"Xf0123ABC456": {
"value": "2022-10-22",
}
},
"user": "U123ABC456",
}

Building your HTTP request

We strongly recommend using application/json POSTs when using this method. If you choose to use application/x-www-form-urlencoded, you must URL-encode the JSON provided to the profile field.

In general, you need to set your content type and authorization credentials to make an HTTP request. If you're using a workspace token, you need to provide an x-slack-user header indicating the user you're acting on behalf of.

You can send a JSON payload to users.profile.set with such an HTTP request:

POST /users/profile.set
Host: slack.com
Authorization: Bearer xoxp-secret-token
Content-type: application/json; charset=utf-8
{
"profile": {
"first_name": "John",
"last_name": "Smith",
"pronouns": "they/them",
"email": "john@smith.com",
"fields": {
"Xf0111111": {
"value": "Barista",
"alt": ""
},
"Xf0222222": {
"value": "2022-04-11",
"alt": ""
},
"Xf0333333": {
"value": "https://example.com",
"alt": ""
}
}
}
}

This method will generate a user_change event on success, containing the complete user.

Profile update rate limits

Update a user's profile, including custom status, sparingly. Special rate limit rules apply when updating profile data with users.profile.set. A token may update a single user's profile no more than 10 times per minute. And a single token may only set 30 user profiles per minute. Some burst behavior is allowed.

Response