# 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:

![](/files/YeCIvx8CHKdf8ivxbfwu)

### 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.

<details>

<summary><a href="https://nymcard.com/docs/api#operation/createUser">POST /users</a></summary>

**`{`**

&#x20;   **`"first_name": "John",`**\
`    `**`"last_name": "Smith"`**

**`}`**

</details>

#### **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.

<details>

<summary><a href="https://nymcard.com/docs/api#operation/createUser">POST /users</a></summary>

**`{`**

&#x20;   **`"first_name": "John",`**\
`    `**`"last_name": "Smith",`**\
`    `**`“parent_user_id”: “cf2de83b-ac68-44ab-bc54-21de60014d57”`**

**`}`**

</details>

### Retrieve users

nCore supports following retrieval methods.&#x20;

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

> &#x20;[**GET /users** ](https://nymcard.com/docs/api#operation/listUsers)

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

> &#x20;[**GET /users/{id}**](https://nymcard.com/docs/api#operation/getUser)

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

<details>

<summary><a href="https://nymcard.com/docs/api#tag/Users/operation/search">POST /users:search</a></summary>

**`{`**

&#x20;   **`"name": "John",`**\
`    `**`"mobile": "5503523",`**\
`    `**`"email": "johndoe@",`**\
`    `**`"limit": "10",`**\
`    `**`"after": "MTA="`**

**`}`**

</details>

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

> &#x20;[**GET /users/{id}:getLinkedRelationships**](https://nymcard.com/docs/api#tag/Users/operation/getLinkedRelationships)

### Update a user

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

> [ **PUT /users/{id}**](https://nymcard.com/docs/api#tag/Users/operation/updateUser)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.nymcard.com/get-started/issuance/users.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
