Upload your profile picture
POST https://icfp2020workshops-unofficial.zulipchat.com/api/v1/users/me/avatar
Upload a new profile picture
for the current user.
The maximum allowed file size is available in the max_avatar_file_size_mib
field in the POST /register response.
In organizations that
restrict profile picture changes,
only administrators can use this endpoint.
Usage examples
The -u line implements HTTP Basic authentication.
See the Authorization header documentation for how
to get those credentials for Zulip users and bots.
curl -sSX POST https://icfp2020workshops-unofficial.zulipchat.com/api/v1/users/me/avatar \
-u EMAIL_ADDRESS:API_KEY \
-F file=@zerver/tests/images/img.png
Parameters
The profile picture image file must be provided in the request's body
as multipart form data.
Response
Return values
Example response(s)
Changes: As of Zulip 7.0 (feature level 167), if any
parameters sent in the request are not supported by this
endpoint, a successful JSON response will include an
ignored_parameters_unsupported array.
A typical successful JSON response may look like:
{
"avatar_url": "/user_avatars/2/c4ce28dde2d44a08b2a72cb371fe78d99cffd7c4.png",
"msg": "",
"result": "success"
}
An example JSON response for when the request did not include
exactly one file:
{
"code": "BAD_REQUEST",
"msg": "You must upload exactly one avatar.",
"result": "error"
}
An example JSON response for when the uploaded file exceeds the
maximum allowed size:
{
"code": "BAD_REQUEST",
"msg": "Uploaded file is larger than the allowed limit of 5 MiB",
"result": "error"
}
An example JSON response for when the uploaded file
is not a supported image format:
{
"code": "BAD_IMAGE",
"msg": "Invalid image format",
"result": "error"
}
An example JSON response for when a non-administrator attempts
to change their profile picture in an organization that has
disabled profile picture changes:
{
"code": "BAD_REQUEST",
"msg": "Avatar changes are disabled in this organization.",
"result": "error"
}