AppMage

User Management

This endpoint group provides functionalities for managing users within a subscription, including creation, updates, deletion, and retrieval.

Endpoints

POST /api/rpc (Method: UserManagerRpc.create)

  • Description: Creates a new user within the current subscription (invite flow).

  • Request Body:

    {
      "method": "UserManagerRpc.create",
      "params": {
        "email": "string",
        "username": "string",
        "role": "string",
        "firstName": "string",
        "lastName": "string"
      }
    }
  • Parameters:

    Name Type Required Description
    email String Yes Globally unique email for the user.
    username String Yes Unique username within a subscription. Must be at least 3 characters long.
    role String Yes The role assigned to the user within their subscription.
    firstName String Yes
    lastName String Yes
  • Response:

    {
      "success": true,
      "data": {
        "_id": "string",
        "email": "string",
        "subscriptionId": "string",
        "serviceCode": "string",
        "username": "string",
        "firstName": "string",
        "lastName": "string",
        "role": "string",
        "isActive": "boolean",
        "isVerified": "boolean",
        "isPhoneVerified": "boolean",
        "onboardingCompleted": "boolean",
        "oauthProfiles": [],
        "createdAt": "Date",
        "updatedAt": "Date"
      }
    }
  • Example (cURL):

    curl -X POST https://api.example.com/api/rpc \
      -H "Content-Type: application/json" \
      -H "X-API-Key: YOUR_API_KEY" \
      -d '{
        "method": "UserManagerRpc.create",
        "params": {
          "email": "[email protected]",
          "username": "newuser",
          "role": "member",
          "firstName": "New",
          "lastName": "User"
        }
      }'

POST /api/rpc (Method: UserManagerRpc.update)

  • Description: Updates a user's details within the current subscription.

  • Request Body:

    {
      "method": "UserManagerRpc.update",
      "params": {
        "userId": "string",
        "updates": {
          "username": "string",
          "firstName": "string",
          "lastName": "string",
          "role": "string",
          "isActive": "boolean",
          "jobTitle": "string",
          "department": "string"
        }
      }
    }
  • Parameters:

    Name Type Required Description
    userId String Yes The MongoDB _id of the user to update.
    updates.username String No Unique username within a subscription. Must be at least 3 characters long.
    updates.firstName String No
    updates.lastName String No
    updates.role String No The role assigned to the user within their subscription.
    updates.isActive Boolean No Indicates if the user account is active.
    updates.jobTitle String No
    updates.department String No
  • Response:

    {
      "success": true,
      "data": {
        "_id": "string",
        "email": "string",
        "subscriptionId": "string",
        "serviceCode": "string",
        "username": "string",
        "firstName": "string",
        "lastName": "string",
        "role": "string",
        "isActive": "boolean",
        "isVerified": "boolean",
        "isPhoneVerified": "boolean",
        "onboardingCompleted": "boolean",
        "oauthProfiles": [],
        "createdAt": "Date",
        "updatedAt": "Date"
      }
    }
  • Example (cURL):

    curl -X POST https://api.example.com/api/rpc \
      -H "Content-Type: application/json" \
      -H "X-API-Key: YOUR_API_KEY" \
      -d '{
        "method": "UserManagerRpc.update",
        "params": {
          "userId": "654321098765432109876543",
          "updates": {
            "firstName": "Updated",
            "role": "admin"
          }
        }
      }'

POST /api/rpc (Method: UserManagerRpc.delete)

  • Description: Deletes a user from the current subscription.

  • Request Body:

    {
      "method": "UserManagerRpc.delete",
      "params": {
        "_id": "string"
      }
    }
  • Parameters:

    Name Type Required Description
    _id String Yes The MongoDB _id of the user to delete.
  • Response:

    {
      "success": true,
      "data": {
        "success": "boolean"
      }
    }
  • Example (cURL):

    curl -X POST https://api.example.com/api/rpc \
      -H "Content-Type: application/json" \
      -H "X-API-Key: YOUR_API_KEY" \
      -d '{
        "method": "UserManagerRpc.delete",
        "params": {
          "_id": "654321098765432109876543"
        }
      }'

POST /api/rpc (Method: UserManagerRpc.findById)

  • Description: Retrieves a specific user by their ID from the current subscription.

  • Request Body:

    {
      "method": "UserManagerRpc.findById",
      "params": {
        "_id": "string"
      }
    }
  • Parameters:

    Name Type Required Description
    _id String Yes The MongoDB _id of the user to retrieve.
  • Response:

    {
      "success": true,
      "data": {
        "_id": "string",
        "email": "string",
        "subscriptionId": "string",
        "serviceCode": "string",
        "username": "string",
        "firstName": "string",
        "lastName": "string",
        "role": "string",
        "isActive": "boolean",
        "isVerified": "boolean",
        "isPhoneVerified": "boolean",
        "onboardingCompleted": "boolean",
        "oauthProfiles": [],
        "createdAt": "Date",
        "updatedAt": "Date"
      }
    }
  • Example (cURL):

    curl -X POST https://api.example.com/api/rpc \
      -H "Content-Type: application/json" \
      -H "X-API-Key: YOUR_API_KEY" \
      -d '{
        "method": "UserManagerRpc.findById",
        "params": {
          "_id": "654321098765432109876543"
        }
      }'

POST /api/rpc (Method: UserManagerRpc.getData)

  • Description: Retrieves a list of all users within the current subscription.

  • Request Body:

    {
      "method": "UserManagerRpc.getData",
      "params": {
        "filter": {},
        "sort": {},
        "page": "number",
        "pageSize": "number"
      }
    }
  • Parameters:

    Name Type Required Description
    filter Object No
    sort Object No
    page Number No
    pageSize Number No
  • Response:

    {
      "success": true,
      "data": {
        "data": [
          {
            "_id": "string",
            "email": "string",
            "subscriptionId": "string",
            "serviceCode": "string",
            "username": "string",
            "firstName": "string",
            "lastName": "string",
            "role": "string",
            "isActive": "boolean",
            "isVerified": "boolean",
            "isPhoneVerified": "boolean",
            "onboardingCompleted": "boolean",
            "oauthProfiles": [],
            "createdAt": "Date",
            "updatedAt": "Date"
          }
        ],
        "totalCount": "number",
        "page": "number",
        "pageSize": "number"
      }
    }
  • Example (cURL):

    curl -X POST https://api.example.com/api/rpc \
      -H "Content-Type: application/json" \
      -H "X-API-Key: YOUR_API_KEY" \
      -d '{
        "method": "UserManagerRpc.getData",
        "params": {
          "page": 1,
          "pageSize": 10
        }
      }'