post/guilds/{guild_id}/members-search

Search guild members

Search and filter guild members with pagination support.

search_guild_members

Parameters

NameInTypeDescription
guild_id*pathSnowflakeTypeThe ID of the guild

Request body

application/json

json
{
  "type": "object",
  "properties": {
    "query": {
      "type": "string",
      "maxLength": 100,
      "description": "Text to search for in usernames, global names, and nicknames"
    },
    "limit": {
      "type": "integer",
      "minimum": 1,
      "maximum": 100,
      "format": "int32",
      "description": "Maximum number of results to return"
    },
    "offset": {
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991,
      "format": "int53",
      "description": "Number of results to skip for pagination"
    },
    "role_ids": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "maxItems": 10,
      "description": "Filter by role IDs (member must have all specified roles)"
    },
    "joined_at_gte": {
      "type": "integer",
      "format": "int53",
      "description": "Filter members who joined at or after this unix timestamp"
    },
    "joined_at_lte": {
      "type": "integer",
      "format": "int53",
      "description": "Filter members who joined at or before this unix timestamp"
    },
    "join_source_type": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/JoinSourceType"
      },
      "maxItems": 10,
      "description": "Filter by join source types"
    },
    "source_invite_code": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "maxItems": 10,
      "description": "Filter by invite codes used to join"
    },
    "is_bot": {
      "type": "boolean",
      "description": "Filter by bot status"
    },
    "user_created_at_gte": {
      "type": "integer",
      "format": "int53",
      "description": "Filter members whose account was created at or after this unix timestamp"
    },
    "user_created_at_lte": {
      "type": "integer",
      "format": "int53",
      "description": "Filter members whose account was created at or before this unix timestamp"
    },
    "sort_by": {
      "enum": [
        "joinedAt",
        "relevance"
      ],
      "type": "string",
      "x-enumNames": [
        "joinedAt",
        "relevance"
      ],
      "description": "Sort results by field"
    },
    "sort_order": {
      "enum": [
        "asc",
        "desc"
      ],
      "type": "string",
      "x-enumNames": [
        "asc",
        "desc"
      ],
      "description": "Sort order"
    }
  }
}

Responses

200

Success

json
{
  "type": "object",
  "properties": {
    "guild_id": {
      "type": "string",
      "description": "Guild ID"
    },
    "members": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/GuildMemberSearchResult"
      },
      "description": "Matching members"
    },
    "page_result_count": {
      "type": "integer",
      "format": "int53",
      "description": "Number of results in this page"
    },
    "total_result_count": {
      "type": "integer",
      "format": "int53",
      "description": "Total number of matching results"
    },
    "indexing": {
      "type": "boolean",
      "description": "Whether the guild members are currently being indexed"
    }
  },
  "required": [
    "guild_id",
    "members",
    "page_result_count",
    "total_result_count",
    "indexing"
  ]
}
400

Bad Request - The request was malformed or contained invalid data

json
{
  "type": "object",
  "properties": {
    "code": {
      "$ref": "#/components/schemas/APIErrorCode"
    },
    "message": {
      "type": "string",
      "description": "Human-readable error message"
    },
    "errors": {
      "type": "array",
      "description": "Field-specific validation errors",
      "items": {
        "$ref": "#/components/schemas/ValidationErrorItem"
      }
    }
  },
  "required": [
    "code",
    "message"
  ]
}
401

Unauthorized - Authentication is required or the token is invalid

json
{
  "type": "object",
  "properties": {
    "code": {
      "$ref": "#/components/schemas/APIErrorCode"
    },
    "message": {
      "type": "string",
      "description": "Human-readable error message"
    },
    "errors": {
      "type": "array",
      "description": "Field-specific validation errors",
      "items": {
        "$ref": "#/components/schemas/ValidationErrorItem"
      }
    }
  },
  "required": [
    "code",
    "message"
  ]
}
403

Forbidden - You do not have permission to perform this action

json
{
  "type": "object",
  "properties": {
    "code": {
      "$ref": "#/components/schemas/APIErrorCode"
    },
    "message": {
      "type": "string",
      "description": "Human-readable error message"
    },
    "errors": {
      "type": "array",
      "description": "Field-specific validation errors",
      "items": {
        "$ref": "#/components/schemas/ValidationErrorItem"
      }
    }
  },
  "required": [
    "code",
    "message"
  ]
}
429

Too Many Requests - You are being rate limited

json
{
  "type": "object",
  "properties": {
    "code": {
      "type": "string",
      "enum": [
        "RATE_LIMITED"
      ]
    },
    "message": {
      "type": "string"
    },
    "retry_after": {
      "type": "number",
      "description": "Seconds to wait before retrying"
    },
    "global": {
      "type": "boolean",
      "description": "Whether this is a global rate limit"
    }
  },
  "required": [
    "code",
    "message",
    "retry_after"
  ]
}
500

Internal Server Error - An unexpected error occurred

json
{
  "type": "object",
  "properties": {
    "code": {
      "$ref": "#/components/schemas/APIErrorCode"
    },
    "message": {
      "type": "string",
      "description": "Human-readable error message"
    },
    "errors": {
      "type": "array",
      "description": "Field-specific validation errors",
      "items": {
        "$ref": "#/components/schemas/ValidationErrorItem"
      }
    }
  },
  "required": [
    "code",
    "message"
  ]
}