POST /users/search – Searches for users based on provided criteria.


Headers:

  • Authorization: Bearer <access_token> (required)
  • Content-Type: application/json or application/x-www-form-urlencoded (required)

Body:

Path Parameters:

  • None

Query Parameters:

  • None

The search results are paginated with configurable size limits.


Status Code Meaning When it Happens
400 Bad Request Missing or invalid fields in request body
401 Unauthorized Missing or invalid authentication token
500 Internal Server Error Unexpected error during users search
{
"error": "Detailed error message here"
}

POST /users/search
{
"provider": "auth0-user",
"query": {
"query": {
"bool": {
"must": [
{ "email": "user@district123.com" },
{ "givenName": "John" }
],
"filter": [
{ "role": "admin" },
{ "appMetadata.createdBy": "SCRIPT" }
],
"must_not": [
{ "blocked": true }
],
"should": [
{ "emailVerified": true }
],
"minimum_should_match": "1",
"boost": 1.0
}
}
}
}
POST /users/search
{
"provider": "cognito-user",
"userPoolId": "us-east-1_1234test",
"query": {
"filter": {
"email": "test@test.com",
"username": "username",
"firstName": "first name",
"lastName": "last name",
"principalId": "users principalId",
"legacyOnlineOrderingId": "users auth0 online ordering id",
"districtId": "guid",
"role": "parent",
"admin": "super",
"createdAt": "date",
"updatedAt": "date",
},
"from": 0,
"limit": 10,
"sortBy": "filter field to sort by",
"sort": "asc or desc",
"next": "next token"
}
}
{
"collection": [
{
"id": "generated_user_id",
"email": "user@district123.com",
"username": "same as id",
"emailVerified": "true",
"provider": "provider",
"connection": "userpool user is associated to",
"name": "users full name",
"firstName": "John",
"lastName": "Doe",
"phoneNumber": "+1234567890",
"phoneVerified": "true",
"status": "ACTIVE",
"createdAt": "2023-12-20T00:00:00Z",
"updatedAt": "2023-12-20T00:00:00Z",
"disabled": false,
"blocked": false,
"principalId": "id associated to user",
"legacyOnlineOrderingId": "id associated to user",
"districtId": "district id associated to user",
"admin": "admin role",
"role": "role associated to user",
"appMetadata": {},
"userMetadata": {}
}
],
"count": 1,
"total": 100,
"limit": 10,
"next": "next token for pagination"
}

  • Parameters

    • event: APIGatewayProxyEvent

      The API Gateway event containing the request.

    • context: Context
    • callback: Callback<APIGatewayProxyResult>

    Returns void | Promise<APIGatewayProxyResult>

    A Promise resolving to an API Gateway-compatible response.