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

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",
      "minimum": -9007199254740991,
      "maximum": 9007199254740991,
      "description": "Number of results in this page"
    },
    "total_result_count": {
      "type": "integer",
      "minimum": -9007199254740991,
      "maximum": 9007199254740991,
      "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"
  ],
  "additionalProperties": false
}
400

Bad Request - The request was malformed or contained invalid data

json
{
  "type": "object",
  "properties": {
    "code": {
      "type": "string",
      "description": "Machine-readable error code"
    },
    "message": {
      "type": "string",
      "description": "Human-readable error message"
    },
    "errors": {
      "description": "Field-specific validation errors",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string",
            "description": "Field path that failed validation"
          },
          "code": {
            "description": "Machine-readable validation error code",
            "type": "string"
          },
          "message": {
            "type": "string",
            "description": "Human-readable validation error message"
          }
        },
        "required": [
          "path",
          "message"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "code",
    "message"
  ],
  "additionalProperties": {}
}
401

Unauthorized - Authentication is required or the token is invalid

json
{
  "type": "object",
  "properties": {
    "code": {
      "type": "string",
      "description": "Machine-readable error code"
    },
    "message": {
      "type": "string",
      "description": "Human-readable error message"
    },
    "errors": {
      "description": "Field-specific validation errors",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string",
            "description": "Field path that failed validation"
          },
          "code": {
            "description": "Machine-readable validation error code",
            "type": "string"
          },
          "message": {
            "type": "string",
            "description": "Human-readable validation error message"
          }
        },
        "required": [
          "path",
          "message"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "code",
    "message"
  ],
  "additionalProperties": {}
}
403

Forbidden - You do not have permission to perform this action

json
{
  "type": "object",
  "properties": {
    "code": {
      "type": "string",
      "description": "Machine-readable error code"
    },
    "message": {
      "type": "string",
      "description": "Human-readable error message"
    },
    "errors": {
      "description": "Field-specific validation errors",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string",
            "description": "Field path that failed validation"
          },
          "code": {
            "description": "Machine-readable validation error code",
            "type": "string"
          },
          "message": {
            "type": "string",
            "description": "Human-readable validation error message"
          }
        },
        "required": [
          "path",
          "message"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "code",
    "message"
  ],
  "additionalProperties": {}
}
429

Too Many Requests - You are being rate limited

json
{
  "type": "object",
  "properties": {
    "code": {
      "type": "string",
      "description": "Machine-readable error code"
    },
    "message": {
      "type": "string",
      "description": "Human-readable error message"
    },
    "errors": {
      "description": "Field-specific validation errors",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string",
            "description": "Field path that failed validation"
          },
          "code": {
            "description": "Machine-readable validation error code",
            "type": "string"
          },
          "message": {
            "type": "string",
            "description": "Human-readable validation error message"
          }
        },
        "required": [
          "path",
          "message"
        ],
        "additionalProperties": false
      }
    },
    "retry_after": {
      "type": "number",
      "description": "Seconds to wait before retrying"
    },
    "global": {
      "type": "boolean",
      "description": "Whether this is a global rate limit"
    }
  },
  "required": [
    "code",
    "message"
  ],
  "additionalProperties": {}
}
500

Internal Server Error - An unexpected error occurred

json
{
  "type": "object",
  "properties": {
    "code": {
      "type": "string",
      "description": "Machine-readable error code"
    },
    "message": {
      "type": "string",
      "description": "Human-readable error message"
    },
    "errors": {
      "description": "Field-specific validation errors",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string",
            "description": "Field path that failed validation"
          },
          "code": {
            "description": "Machine-readable validation error code",
            "type": "string"
          },
          "message": {
            "type": "string",
            "description": "Human-readable validation error message"
          }
        },
        "required": [
          "path",
          "message"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "code",
    "message"
  ],
  "additionalProperties": {}
}