Open Context Protocol is live! 🚀 Read the launch post

usersList

Lists all users in a Slack team.

Details

  • Method: GET
  • Path: /users.list
  • Operation ID: users_list

Parameters

{
  "token": {
    "description": "Authentication token. Requires scope: `users:read`",
    "required": false,
    "location": "query",
    "type": "string"
  },
  "limit": {
    "description": "The maximum number of items to return. Fewer than the requested number of items may be returned, even if the end of the users list hasn't been reached. Providing no `limit` value will result in Slack attempting to deliver you the entire result set. If the collection is too large you may experience `limit_required` or HTTP 500 errors.",
    "required": false,
    "location": "query",
    "type": "string"
  },
  "cursor": {
    "description": "Paginate through collections of data by setting the `cursor` parameter to a `next_cursor` attribute returned by a previous request's `response_metadata`. Default value fetches the first \"page\" of the collection. See [pagination](/docs/pagination) for more detail.",
    "required": false,
    "location": "query",
    "type": "string"
  },
  "include_locale": {
    "description": "Set this to `true` to receive the locale for users. Defaults to `false`",
    "required": false,
    "location": "query",
    "type": "string"
  }
}

Response Schema

{
  "additionalProperties": false,
  "description": "Schema for successful response from users.list method",
  "properties": {
    "cache_ts": {
      "type": "integer"
    },
    "members": {
      "items": {
        "items": [
          {
            "additionalProperties": false,
            "description": "user object for non enterprise type",
            "properties": {
              "color": {
                "pattern": "^[a-fA-F0-9]{6}$",
                "type": "string"
              },
              "deleted": {
                "type": "boolean"
              },
              "enterprise_user": {
                "additionalProperties": false,
                "properties": {
                  "enterprise_id": {
                    "pattern": "^[E][A-Z0-9]{8,}$",
                    "title": "Enterprise ID",
                    "type": "string"
                  },
                  "enterprise_name": {
                    "title": "Name of the enterprise org",
                    "type": "string"
                  },
                  "id": {
                    "pattern": "^[WU][A-Z0-9]{8,}$",
                    "title": "Enterprise User ID",
                    "type": "string"
                  },
                  "is_admin": {
                    "type": "boolean"
                  },
                  "is_owner": {
                    "type": "boolean"
                  },
                  "teams": {
                    "items": {
                      "pattern": "^[T][A-Z0-9]{2,}$",
                      "title": "Team ID",
                      "type": "string"
                    },
                    "type": "array",
                    "uniqueItems": true
                  }
                },
                "required": [
                  "id",
                  "enterprise_id",
                  "enterprise_name",
                  "is_admin",
                  "is_owner",
                  "teams"
                ],
                "type": "object"
              },
              "has_2fa": {
                "type": "boolean"
              },
              "id": {
                "pattern": "^[UW][A-Z0-9]{2,}$",
                "title": "User ID",
                "type": "string"
              },
              "is_admin": {
                "type": "boolean"
              },
              "is_app_user": {
                "type": "boolean"
              },
              "is_bot": {
                "type": "boolean"
              },
              "is_external": {
                "type": "boolean"
              },
              "is_forgotten": {
                "type": "boolean"
              },
              "is_invited_user": {
                "type": "boolean"
              },
              "is_owner": {
                "type": "boolean"
              },
              "is_primary_owner": {
                "type": "boolean"
              },
              "is_restricted": {
                "type": "boolean"
              },
              "is_stranger": {
                "type": "boolean"
              },
              "is_ultra_restricted": {
                "type": "boolean"
              },
              "locale": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "presence": {
                "type": "string"
              },
              "profile": {
                "additionalProperties": false,
                "properties": {
                  "always_active": {
                    "type": "boolean"
                  },
                  "api_app_id": {
                    "pattern": "^(A[A-Z0-9]{1,})?$",
                    "title": "App ID or empty string",
                    "type": "string"
                  },
                  "avatar_hash": {
                    "type": "string"
                  },
                  "bot_id": {
                    "pattern": "^B[A-Z0-9]{8,}$",
                    "title": "Bot User ID",
                    "type": "string"
                  },
                  "display_name": {
                    "type": "string"
                  },
                  "display_name_normalized": {
                    "type": "string"
                  },
                  "email": {
                    "format": "email",
                    "type": [
                      "null",
                      "string"
                    ]
                  },
                  "fields": {
                    "items": {
                      "type": "object"
                    },
                    "type": [
                      "object",
                      "null",
                      "array"
                    ]
                  },
                  "first_name": {
                    "type": [
                      "null",
                      "string"
                    ]
                  },
                  "guest_expiration_ts": {
                    "type": [
                      "null",
                      "integer"
                    ]
                  },
                  "guest_invited_by": {
                    "type": [
                      "null",
                      "string"
                    ]
                  },
                  "image_1024": {
                    "format": "uri",
                    "type": [
                      "null",
                      "string"
                    ]
                  },
                  "image_192": {
                    "format": "uri",
                    "type": [
                      "null",
                      "string"
                    ]
                  },
                  "image_24": {
                    "format": "uri",
                    "type": [
                      "null",
                      "string"
                    ]
                  },
                  "image_32": {
                    "format": "uri",
                    "type": [
                      "null",
                      "string"
                    ]
                  },
                  "image_48": {
                    "format": "uri",
                    "type": [
                      "null",
                      "string"
                    ]
                  },
                  "image_512": {
                    "format": "uri",
                    "type": [
                      "null",
                      "string"
                    ]
                  },
                  "image_72": {
                    "format": "uri",
                    "type": [
                      "null",
                      "string"
                    ]
                  },
                  "image_original": {
                    "format": "uri",
                    "type": [
                      "null",
                      "string"
                    ]
                  },
                  "is_app_user": {
                    "type": "boolean"
                  },
                  "is_custom_image": {
                    "type": "boolean"
                  },
                  "is_restricted": {
                    "type": [
                      "null",
                      "boolean"
                    ]
                  },
                  "is_ultra_restricted": {
                    "type": [
                      "null",
                      "boolean"
                    ]
                  },
                  "last_avatar_image_hash": {
                    "type": "string"
                  },
                  "last_name": {
                    "type": [
                      "null",
                      "string"
                    ]
                  },
                  "memberships_count": {
                    "type": "integer"
                  },
                  "name": {
                    "type": [
                      "null",
                      "string"
                    ]
                  },
                  "phone": {
                    "type": "string"
                  },
                  "pronouns": {
                    "type": "string"
                  },
                  "real_name": {
                    "type": "string"
                  },
                  "real_name_normalized": {
                    "type": "string"
                  },
                  "skype": {
                    "type": "string"
                  },
                  "status_default_emoji": {
                    "type": "string"
                  },
                  "status_default_text": {
                    "type": "string"
                  },
                  "status_default_text_canonical": {
                    "type": [
                      "null",
                      "string"
                    ]
                  },
                  "status_emoji": {
                    "type": "string"
                  },
                  "status_expiration": {
                    "type": "integer"
                  },
                  "status_text": {
                    "type": "string"
                  },
                  "status_text_canonical": {
                    "type": [
                      "null",
                      "string"
                    ]
                  },
                  "team": {
                    "pattern": "^[TE][A-Z0-9]{8,}$",
                    "title": "Team or Enterprise ID",
                    "type": "string"
                  },
                  "title": {
                    "type": "string"
                  },
                  "updated": {
                    "type": "integer"
                  },
                  "user_id": {
                    "type": "string"
                  },
                  "username": {
                    "type": [
                      "null",
                      "string"
                    ]
                  }
                },
                "required": [
                  "real_name",
                  "display_name",
                  "avatar_hash",
                  "real_name_normalized",
                  "display_name_normalized",
                  "title",
                  "phone",
                  "skype",
                  "status_text",
                  "status_emoji",
                  "fields"
                ],
                "title": "User profile object",
                "type": "object"
              },
              "real_name": {
                "type": "string"
              },
              "team": {
                "pattern": "^[TE][A-Z0-9]{8,}$",
                "title": "Team or Enterprise ID",
                "type": "string"
              },
              "team_id": {
                "pattern": "^[TE][A-Z0-9]{8,}$",
                "title": "Team or Enterprise ID",
                "type": "string"
              },
              "team_profile": {
                "additionalProperties": false,
                "properties": {
                  "fields": {
                    "items": {
                      "additionalProperties": false,
                      "properties": {
                        "field_name": {
                          "type": [
                            "null",
                            "string"
                          ]
                        },
                        "hint": {
                          "type": "string"
                        },
                        "id": {
                          "pattern": "^X[a-zA-Z0-9]{9,}$",
                          "type": "string"
                        },
                        "is_hidden": {
                          "type": "boolean"
                        },
                        "label": {
                          "type": "string"
                        },
                        "options": {
                          "items": [
                            {
                              "type": "null"
                            },
                            {
                              "additionalProperties": false,
                              "properties": {
                                "is_custom": {
                                  "type": [
                                    "null",
                                    "boolean"
                                  ]
                                },
                                "is_multiple_entry": {
                                  "type": [
                                    "null",
                                    "boolean"
                                  ]
                                },
                                "is_protected": {
                                  "type": [
                                    "null",
                                    "boolean"
                                  ]
                                },
                                "is_scim": {
                                  "type": [
                                    "null",
                                    "boolean"
                                  ]
                                }
                              },
                              "type": "object"
                            }
                          ]
                        },
                        "ordering": {
                          "type": "number"
                        },
                        "possible_values": {
                          "items": {
                            "type": "string"
                          },
                          "type": [
                            "null",
                            "array"
                          ]
                        },
                        "type": {
                          "enum": [
                            "text",
                            "date",
                            "link",
                            "mailto",
                            "options_list",
                            "user"
                          ],
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "ordering",
                        "label",
                        "hint",
                        "type"
                      ],
                      "type": "object"
                    },
                    "minItems": 1,
                    "type": "array",
                    "uniqueItems": true
                  }
                },
                "required": [
                  "fields"
                ],
                "type": "object"
              },
              "two_factor_type": {
                "type": "string"
              },
              "tz": {
                "items": [
                  {
                    "type": "null"
                  },
                  {
                    "type": "string"
                  }
                ]
              },
              "tz_label": {
                "type": "string"
              },
              "tz_offset": {
                "type": "number"
              },
              "updated": {
                "type": "number"
              }
            },
            "required": [
              "id",
              "name",
              "profile",
              "is_bot",
              "updated",
              "is_app_user"
            ],
            "type": "object"
          },
          {
            "additionalProperties": false,
            "description": "enterprise user",
            "properties": {
              "color": {
                "description": "refercing to bug: https://jira.tinyspeck.com/browse/EVALUE-1559",
                "pattern": "^([a-fA-F0-9]{6})?$",
                "type": "string"
              },
              "deleted": {
                "type": "boolean"
              },
              "enterprise_user": {
                "additionalProperties": false,
                "properties": {
                  "enterprise_id": {
                    "pattern": "^[E][A-Z0-9]{8,}$",
                    "title": "Enterprise ID",
                    "type": "string"
                  },
                  "enterprise_name": {
                    "title": "Name of the enterprise org",
                    "type": "string"
                  },
                  "id": {
                    "pattern": "^[WU][A-Z0-9]{8,}$",
                    "title": "Enterprise User ID",
                    "type": "string"
                  },
                  "is_admin": {
                    "type": "boolean"
                  },
                  "is_owner": {
                    "type": "boolean"
                  },
                  "teams": {
                    "items": {
                      "pattern": "^[T][A-Z0-9]{2,}$",
                      "title": "Team ID",
                      "type": "string"
                    },
                    "type": "array",
                    "uniqueItems": true
                  }
                },
                "required": [
                  "id",
                  "enterprise_id",
                  "enterprise_name",
                  "is_admin",
                  "is_owner",
                  "teams"
                ],
                "type": "object"
              },
              "has_2fa": {
                "type": "boolean"
              },
              "id": {
                "pattern": "^[UW][A-Z0-9]{2,}$",
                "title": "User ID",
                "type": "string"
              },
              "is_admin": {
                "type": "boolean"
              },
              "is_app_user": {
                "type": "boolean"
              },
              "is_bot": {
                "type": "boolean"
              },
              "is_external": {
                "type": "boolean"
              },
              "is_forgotten": {
                "type": "boolean"
              },
              "is_owner": {
                "type": "boolean"
              },
              "is_primary_owner": {
                "type": "boolean"
              },
              "is_restricted": {
                "type": "boolean"
              },
              "is_stranger": {
                "type": "boolean"
              },
              "is_ultra_restricted": {
                "type": "boolean"
              },
              "locale": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "presence": {
                "type": "string"
              },
              "profile": {
                "additionalProperties": false,
                "properties": {
                  "always_active": {
                    "type": "boolean"
                  },
                  "api_app_id": {
                    "pattern": "^(A[A-Z0-9]{1,})?$",
                    "title": "App ID or empty string",
                    "type": "string"
                  },
                  "avatar_hash": {
                    "type": "string"
                  },
                  "bot_id": {
                    "pattern": "^B[A-Z0-9]{8,}$",
                    "title": "Bot User ID",
                    "type": "string"
                  },
                  "display_name": {
                    "type": "string"
                  },
                  "display_name_normalized": {
                    "type": "string"
                  },
                  "email": {
                    "format": "email",
                    "type": [
                      "null",
                      "string"
                    ]
                  },
                  "fields": {
                    "items": {
                      "type": "object"
                    },
                    "type": [
                      "object",
                      "null",
                      "array"
                    ]
                  },
                  "first_name": {
                    "type": [
                      "null",
                      "string"
                    ]
                  },
                  "guest_expiration_ts": {
                    "type": [
                      "null",
                      "integer"
                    ]
                  },
                  "guest_invited_by": {
                    "type": [
                      "null",
                      "string"
                    ]
                  },
                  "image_1024": {
                    "format": "uri",
                    "type": [
                      "null",
                      "string"
                    ]
                  },
                  "image_192": {
                    "format": "uri",
                    "type": [
                      "null",
                      "string"
                    ]
                  },
                  "image_24": {
                    "format": "uri",
                    "type": [
                      "null",
                      "string"
                    ]
                  },
                  "image_32": {
                    "format": "uri",
                    "type": [
                      "null",
                      "string"
                    ]
                  },
                  "image_48": {
                    "format": "uri",
                    "type": [
                      "null",
                      "string"
                    ]
                  },
                  "image_512": {
                    "format": "uri",
                    "type": [
                      "null",
                      "string"
                    ]
                  },
                  "image_72": {
                    "format": "uri",
                    "type": [
                      "null",
                      "string"
                    ]
                  },
                  "image_original": {
                    "format": "uri",
                    "type": [
                      "null",
                      "string"
                    ]
                  },
                  "is_app_user": {
                    "type": "boolean"
                  },
                  "is_custom_image": {
                    "type": "boolean"
                  },
                  "is_restricted": {
                    "type": [
                      "null",
                      "boolean"
                    ]
                  },
                  "is_ultra_restricted": {
                    "type": [
                      "null",
                      "boolean"
                    ]
                  },
                  "last_avatar_image_hash": {
                    "type": "string"
                  },
                  "last_name": {
                    "type": [
                      "null",
                      "string"
                    ]
                  },
                  "memberships_count": {
                    "type": "integer"
                  },
                  "name": {
                    "type": [
                      "null",
                      "string"
                    ]
                  },
                  "phone": {
                    "type": "string"
                  },
                  "pronouns": {
                    "type": "string"
                  },
                  "real_name": {
                    "type": "string"
                  },
                  "real_name_normalized": {
                    "type": "string"
                  },
                  "skype": {
                    "type": "string"
                  },
                  "status_default_emoji": {
                    "type": "string"
                  },
                  "status_default_text": {
                    "type": "string"
                  },
                  "status_default_text_canonical": {
                    "type": [
                      "null",
                      "string"
                    ]
                  },
                  "status_emoji": {
                    "type": "string"
                  },
                  "status_expiration": {
                    "type": "integer"
                  },
                  "status_text": {
                    "type": "string"
                  },
                  "status_text_canonical": {
                    "type": [
                      "null",
                      "string"
                    ]
                  },
                  "team": {
                    "pattern": "^[TE][A-Z0-9]{8,}$",
                    "title": "Team or Enterprise ID",
                    "type": "string"
                  },
                  "title": {
                    "type": "string"
                  },
                  "updated": {
                    "type": "integer"
                  },
                  "user_id": {
                    "type": "string"
                  },
                  "username": {
                    "type": [
                      "null",
                      "string"
                    ]
                  }
                },
                "required": [
                  "real_name",
                  "display_name",
                  "avatar_hash",
                  "real_name_normalized",
                  "display_name_normalized",
                  "title",
                  "phone",
                  "skype",
                  "status_text",
                  "status_emoji",
                  "fields"
                ],
                "title": "User profile object",
                "type": "object"
              },
              "real_name": {
                "type": "string"
              },
              "team_id": {
                "pattern": "^[TE][A-Z0-9]{8,}$",
                "title": "Team or Enterprise ID",
                "type": "string"
              },
              "team_profile": {
                "additionalProperties": false,
                "properties": {
                  "fields": {
                    "items": {
                      "additionalProperties": false,
                      "properties": {
                        "field_name": {
                          "type": [
                            "null",
                            "string"
                          ]
                        },
                        "hint": {
                          "type": "string"
                        },
                        "id": {
                          "pattern": "^X[a-zA-Z0-9]{9,}$",
                          "type": "string"
                        },
                        "is_hidden": {
                          "type": "boolean"
                        },
                        "label": {
                          "type": "string"
                        },
                        "options": {
                          "items": [
                            {
                              "type": "null"
                            },
                            {
                              "additionalProperties": false,
                              "properties": {
                                "is_custom": {
                                  "type": [
                                    "null",
                                    "boolean"
                                  ]
                                },
                                "is_multiple_entry": {
                                  "type": [
                                    "null",
                                    "boolean"
                                  ]
                                },
                                "is_protected": {
                                  "type": [
                                    "null",
                                    "boolean"
                                  ]
                                },
                                "is_scim": {
                                  "type": [
                                    "null",
                                    "boolean"
                                  ]
                                }
                              },
                              "type": "object"
                            }
                          ]
                        },
                        "ordering": {
                          "type": "number"
                        },
                        "possible_values": {
                          "items": {
                            "type": "string"
                          },
                          "type": [
                            "null",
                            "array"
                          ]
                        },
                        "type": {
                          "enum": [
                            "text",
                            "date",
                            "link",
                            "mailto",
                            "options_list",
                            "user"
                          ],
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "ordering",
                        "label",
                        "hint",
                        "type"
                      ],
                      "type": "object"
                    },
                    "minItems": 1,
                    "type": "array",
                    "uniqueItems": true
                  }
                },
                "required": [
                  "fields"
                ],
                "type": "object"
              },
              "teams": {
                "items": {
                  "pattern": "^[TE][A-Z0-9]{8,}$",
                  "title": "Team or Enterprise ID",
                  "type": "string"
                },
                "minItems": 1,
                "type": "array",
                "uniqueItems": true
              },
              "two_factor_type": {
                "type": "string"
              },
              "tz": {
                "items": [
                  {
                    "type": "null"
                  },
                  {
                    "type": "string"
                  }
                ]
              },
              "tz_label": {
                "type": "string"
              },
              "tz_offset": {
                "type": "number"
              },
              "updated": {
                "type": "number"
              }
            },
            "required": [
              "id",
              "name",
              "profile",
              "is_bot",
              "updated",
              "is_app_user"
            ],
            "type": "object"
          }
        ]
      },
      "minItems": 1,
      "type": "array",
      "uniqueItems": true
    },
    "ok": {
      "enum": [
        true
      ],
      "title": "default success response",
      "type": "boolean"
    },
    "response_metadata": {
      "items": [
        {
          "additionalProperties": false,
          "properties": {
            "next_cursor": {
              "type": "string"
            }
          },
          "required": [
            "next_cursor"
          ],
          "title": "new paging style",
          "type": "object"
        },
        {
          "additionalProperties": false,
          "properties": {
            "messages": {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            "warnings": {
              "items": {
                "enum": [
                  "method_deprecated"
                ],
                "type": "string"
              },
              "type": "array"
            }
          },
          "required": [
            "messages",
            "warnings"
          ],
          "title": "deprecation_warning",
          "type": "object"
        },
        {
          "additionalProperties": false,
          "properties": {
            "messages": {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            "next_cursor": {
              "type": "string"
            },
            "warnings": {
              "items": {
                "enum": [
                  "method_deprecated"
                ],
                "type": "string"
              },
              "type": "array"
            }
          },
          "required": [
            "messages",
            "warnings",
            "next_cursor"
          ],
          "title": "deprecation_warning and paging style together",
          "type": "object"
        }
      ]
    }
  },
  "required": [
    "ok",
    "members",
    "cache_ts"
  ],
  "title": "users.list schema",
  "type": "object"
}

Usage

from ocp_agent import OCPAgent

agent = OCPAgent()
await agent.register_api('slack')

# Call this tool
result = await agent.call_tool('usersList', {
    # Add required parameters here
})