Users

What is a user

A user is an entity which can be an individual that holds an account at nCore which is represented by the user object. The user object stores the user's demographic data like (name, date of birth, email, address, nationality, gender etc.). Your application calls the nCore API to create and manage the users and their identification.

nCore supports linking multiple users in a parent-child relationship. You can use the /users endpoint to create these relationships between two users (where one user is the parent and the other is the child). The parent-child relationship can be extended to n-level of parent-child hierarchy. This relationship is very useful in maintaining real world relationships between multiple users.

To create a parent-child relationship, the parent must be an existing user. When creating a child user, set the parent_user_id field to the unique identifier of the parent. The parent_user_id can also be set or reset later on by using the update user API.

Below you can find user management decision flow:

Create a user

Before creating user, what you will need:

  • A nCore API Key

  • Details about the individual you would like to onboard

Create an individual user

The following is sample code used to create a normal user.

POST /users

{

"first_name": "John", "last_name": "Smith"

}

Create a child user

If you want to create a child user please include the parent user id in your POST request as given below.

POST /users

{

"first_name": "John", "last_name": "Smith", “parent_user_id”: “cf2de83b-ac68-44ab-bc54-21de60014d57”

}

Retrieve users

nCore supports following retrieval methods.

  • To retrieve a list of all users, you can send a GET request to /users endpoint

GET /users

  • To retrieve a specific user, you can include the user ‘ID’ path parameter in your GET request

GET /users/{id}

  • To retrieve a specific user by name, email id or phone number as given below.

POST /users:search

{

"name": "John", "mobile": "5503523", "email": "johndoe@", "limit": "10", "after": "MTA="

}

  • You can retrieve child users for a specific parent user as given below.

GET /users?parent_user_id=8009ace0-c16e-4d03-8a89-36010cf30b87

Update a user

You can update a specific user by sending a PUT request to /users/{id} endpoint as given below.

PUT /users/{id}

Last updated