Get all custom profile fields

GET https://prusti.zulipchat.com/api/v1/realm/profile_fields

Get all the custom profile fields configured for the user's organization.

Usage examples

#!/usr/bin/env python3

import zulip

# Pass the path to your zuliprc file here.
client = zulip.Client(config_file="~/zuliprc")

# Fetch all the custom profile fields in the user's organization.
result = client.call_endpoint(
    url="/realm/profile_fields",
    method="GET",
)
print(result)

curl -sSX GET -G https://prusti.zulipchat.com/api/v1/realm/profile_fields \
    -u BOT_EMAIL_ADDRESS:BOT_API_KEY

Parameters

This endpoint does not accept any parameters.

Response

Return values

  • custom_fields: (object)[]

    An array containing all the custom profile fields defined in this Zulip organization.

    • id: integer

      The ID of the custom profile field. This will be referenced in the custom profile fields section of user objects.

    • type: integer

      An integer indicating the type of the custom profile field, which determines how it is configured and displayed to users.

      See the Custom profile fields article for details on what each type means.

      • 1: Short text
      • 2: Long text
      • 3: List of options
      • 4: Date picker
      • 5: Link
      • 6: Person picker
      • 7: External account
      • 8: Pronouns

      Changes: Field type 8 added in Zulip 6.0 (feature level 151).

    • order: integer

      Custom profile fields are displayed in both settings UI and UI showing users' profiles in increasing order.

    • name: string

      The name of the custom profile field.

    • hint: string

      The help text to be displayed for the custom profile field in user-facing settings UI for configuring custom profile fields.

    • field_data: string

      Field types 3 (List of options) and 7 (External account) support storing additional configuration for the field type in the field_data attribute.

      For field type 3 (List of options), this attribute is a JSON dictionary defining the choices and the order they will be displayed in the dropdown UI for individual users to select an option.

      The interface for field type 7 is not yet stabilized.

    • display_in_profile_summary: boolean

      Whether the custom profile field, display or not on the user card.

      Currently it's value not allowed to be true of Long text and Person picker profile field types.

      This field is only included when its value is true.

      Changes: New in Zulip 6.0 (feature level 146).

    • required: boolean

      Whether an organization administrator has configured this profile field as required.

      Because the required property is mutable, clients cannot assume that a required custom profile field has a value. The Zulip web application displays a prominent banner to any user who has not set a value for a required field.

      Changes: New in Zulip 9.0 (feature level 244).

    • editable_by_user: boolean

      Whether regular users can edit this profile field on their own account.

      Note that organization administrators can edit custom profile fields for any user regardless of this setting.

      Changes: New in Zulip 10.0 (feature level 296).

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:

{
    "custom_fields": [
        {
            "editable_by_user": false,
            "field_data": "",
            "hint": "",
            "id": 1,
            "name": "Phone number",
            "order": 1,
            "required": true,
            "type": 1
        },
        {
            "editable_by_user": true,
            "field_data": "",
            "hint": "What are you known for?",
            "id": 2,
            "name": "Biography",
            "order": 2,
            "required": true,
            "type": 2
        },
        {
            "editable_by_user": true,
            "field_data": "",
            "hint": "Or drink, if you'd prefer",
            "id": 3,
            "name": "Favorite food",
            "order": 3,
            "required": false,
            "type": 1
        },
        {
            "display_in_profile_summary": true,
            "editable_by_user": true,
            "field_data": "{\"0\":{\"text\":\"Vim\",\"order\":\"1\"},\"1\":{\"text\":\"Emacs\",\"order\":\"2\"}}",
            "hint": "",
            "id": 4,
            "name": "Favorite editor",
            "order": 4,
            "required": true,
            "type": 3
        },
        {
            "editable_by_user": false,
            "field_data": "",
            "hint": "",
            "id": 5,
            "name": "Birthday",
            "order": 5,
            "required": false,
            "type": 4
        },
        {
            "display_in_profile_summary": true,
            "editable_by_user": true,
            "field_data": "",
            "hint": "Or your personal blog's URL",
            "id": 6,
            "name": "Favorite website",
            "order": 6,
            "required": false,
            "type": 5
        },
        {
            "editable_by_user": false,
            "field_data": "",
            "hint": "",
            "id": 7,
            "name": "Mentor",
            "order": 7,
            "required": true,
            "type": 6
        },
        {
            "editable_by_user": true,
            "field_data": "{\"subtype\":\"github\"}",
            "hint": "Enter your GitHub username",
            "id": 8,
            "name": "GitHub",
            "order": 8,
            "required": true,
            "type": 7
        },
        {
            "editable_by_user": true,
            "hint": "What pronouns should people use to refer to you?",
            "id": 9,
            "name": "Pronouns",
            "order": 9,
            "required": false,
            "type": 8
        }
    ],
    "msg": "",
    "result": "success"
}