Get all custom profile fields

GET https://zulip.wikimedia.de/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://zulip.wikimedia.de/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.

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

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