# User

## Module endpoints

* [`GET /users`](#get-users)
* [`GET /users/:id`](#get-users-id)
* [`PATCH /users/:id`](#patch-users-id)
* [`POST /users`](#post-users)
* [`POST /users/:id/approve`](#post-users-id-approve)
* [`POST /users/:id/block`](#post-users-id-block)
* [`POST /users/:id/change-password`](#post-users-id-change-password)
* [`POST /users/:id/unblock`](#post-users-id-unblock)

### `GET /users`

> `GET` <https://api.slyk.i&#x6F;**/users>\*\*

Returns a paginated list of `users`.

{% tabs %}
{% tab title="Available Filters" %}

| Name                |   Type   | Example                                                                                   |
| ------------------- | :------: | ----------------------------------------------------------------------------------------- |
| **approved**        |    `=`   | `filter[approved]=true`                                                                   |
| **blocked**         |    `=`   | `filter[blocked]=false`                                                                   |
| **email**           |    `=`   | `filter[email]=foo@bar.com`                                                               |
| **id**              | `=` `in` | `filter[id]=in:fc78d28f-a8dd-49de-a22f-722fe3bd26c7,ba77d2f6-6a09-47ba-918c-63ef9539184f` |
| **name**            |  `like`  | `filter[name]=foobar`                                                                     |
| **phone**           |    `=`   | `filter[phone]=+351961234567`                                                             |
| **primaryWalletId** |    `=`   | `filter[primaryWalletId]=d78fe2c0-7268-4796-b267-187243331efe`                            |
| **referralCode**    |    `=`   | `filter[referralCode]=R12345678`                                                          |
| **referralUserId**  | `=` `in` | `filter[referralUserId]=ba77d2f6-6a09-47ba-918c-63ef9539184f`                             |
| **role**            |    `=`   | `filter[role]=user`                                                                       |
| **verified**        |    `=`   | `filter[verified]=true`                                                                   |

{% hint style="info" %}
The `name` filter performs a `SQL` query using the `like` operator.
{% endhint %}
{% endtab %}

{% tab title="Available Sorts" %}

| Name          | Example                                                            |
| ------------- | ------------------------------------------------------------------ |
| **createdAt** | <p><code>sort=createdAt</code><br><code>sort=-createdAt</code></p> |
| **updatedAt** | <p><code>sort=updatedAt</code><br><code>sort=-updatedAt</code></p> |
| {% endtab %}  |                                                                    |

{% tab title="Paginate Options" %}

| Name         | Description                                             | Example          |
| ------------ | ------------------------------------------------------- | ---------------- |
| **size**     | Defines the number of results per page. Default = 30.   | `page[size]=2`   |
| **number**   | Defines the number of the page to retrieve. Default = 1 | `page[number]=2` |
| {% endtab %} |                                                         |                  |

{% tab title="Response" %}

```javascript
{
  "data": [
    {
      "approved": true,
      "blocked": false,
      "createdAt": "2019-07-17T11:39:26.732Z",
      "customData": {},
      "email": "waldo@fred.com",
      "id": "dcdbf851-f4db-468b-9235-37ef6e6306a1",
      "locale": "pt",
      "name": "Waldo Fred",
      "phone": "+351912345678",
      "primaryWalletId": "715a25e5-94d3-4142-afa9-b4b09193f618",
      "referralCode": "R12345678",
      "referralUserId": null,
      "roles": ["user"],
      "updatedAt": "2019-07-17T11:39:26.732Z",
      "verified": true
    },
    {
      "approved": false,
      "blocked": false,
      "createdAt": "2019-07-17T11:39:26.732Z",
      "customData": {},
      "email": "corge@garply.com",
      "id": "8d31a884-7fa3-469a-a7cb-12f95895c487",
      "locale": "en",
      "name": "Corge Garply",
      "phone": "+123456789",
      "primaryWalletId": "f90b0f21-e0a8-43ff-81c2-da42a5a6ca6e",
      "referralCode": "R87654321",
      "referralUserId": "dcdbf851-f4db-468b-9235-37ef6e6306a1",
      "roles": ["user"],
      "updatedAt": "2019-07-17T11:39:26.732Z",
      "verified": false
    }
  ],
  "total": 2
}
```

{% endtab %}
{% endtabs %}

### `GET /users/:id`

> `GET` <https://api.slyk.i&#x6F;**/users/:id>\*\*

Gets the user details of the given `id`.

{% tabs %}
{% tab title="Response" %}

```javascript
{
  "data": {
    "approved": true,
    "blocked": false,
    "createdAt": "2019-07-17T11:39:26.732Z",
    "customData": {},
    "email": "waldo@fred.com",
    "id": "dcdbf851-f4db-468b-9235-37ef6e6306a1",
    "locale": "pt",
    "name": "Waldo Fred",
    "phone": "+351912345678",
    "primaryWalletId": "715a25e5-94d3-4142-afa9-b4b09193f618",
    "referralCode": "R12345678",
    "referralUserId": null,
    "roles": ["user"],
    "updatedAt": "2019-07-17T11:39:26.732Z",
    "verified": true
  }
}
```

{% endtab %}
{% endtabs %}

### `PATCH /users/:id`

> `PATCH` <https://api.slyk.i&#x6F;**/users/:id>\*\*

Patches the `user` details of the given `id`.

{% tabs %}
{% tab title="Request Parameters" %}

| Field          |   Type   | Required | Description                                          |
| -------------- | :------: | :------: | ---------------------------------------------------- |
| **customData** | `string` |  `false` | Can store any additional information about the user. |
| **locale**     | `string` |  `false` | User locale.                                         |
| **name**       | `string` |  `false` | User name.                                           |
| {% endtab %}   |          |          |                                                      |

{% tab title="Request" %}

```javascript
{
  "name": "Waldo G. Fred"
}
```

{% endtab %}

{% tab title="Response" %}

```javascript
{
  "data": {
    "approved": true,
    "blocked": false,
    "createdAt": "2019-07-17T11:39:26.732Z",
    "customData": {},
    "email": "waldo@fred.com",
    "id": "dcdbf851-f4db-468b-9235-37ef6e6306a1",
    "locale": "pt",
    "name": "Waldo G. Fred",
    "phone": "+351912345678",
    "primaryWalletId": "715a25e5-94d3-4142-afa9-b4b09193f618",
    "referralCode": "R12345678",
    "referralUserId": null,
    "roles": ["user"],
    "updatedAt": "2019-07-17T11:39:26.732Z",
    "verified": true
  }
}
```

{% endtab %}
{% endtabs %}

### `POST /users`

> `POST` <https://api.slyk.i&#x6F;**/users>\*\*

Creates an user.

{% tabs %}
{% tab title="Request Parameters" %}

| Field               |    Type   | Required | Description                                                                                        |
| ------------------- | :-------: | :------: | -------------------------------------------------------------------------------------------------- |
| **approved**        | `boolean` |  `false` | If provided, user is created already approved.                                                     |
| **blocked**         | `boolean` |  `false` | If provided, user is created as blocked.                                                           |
| **code**            |  `string` |  `false` | Either a `referralCode` or an invite `code`.                                                       |
| **customData**      |  `object` |  `false` | May store any additional information about the user.                                               |
| **email**           |  `string` |  `true`  | User email.                                                                                        |
| **locale**          |  `string` |  `false` | User locale.                                                                                       |
| **name**            |  `string` |  `false` | User name.                                                                                         |
| **password**        |  `string` |  `true`  | Login password. It must contain: 1 capital letter; 1 lower letter; 1 digit; at least 8 characters. |
| **primaryWalletId** |  `string` |  `false` | User main wallet. Format: `uuid`.                                                                  |
| **verified**        | `boolean` |  `false` | If provided, user is created already verified.                                                     |
| {% endtab %}        |           |          |                                                                                                    |

{% tab title="Request" %}

```javascript
{
  "email": "foo@bar.com",
  "code": "R87654321",
  "locale": "en",
  "name": "Sr. Foobar",
  "password": "Foobar123"
}
```

{% endtab %}

{% tab title="Response" %}

```javascript
{
  "data": {
    "approved": false,
    "blocked": false,
    "createdAt": "2019-07-17T11:39:26.732Z",
    "customData": {},
    "email": "foo@bar.com",
    "id": "689352d2-b899-4fa3-9e64-2be481545558",
    "locale": "en",
    "name": "Sr. Foobar",
    "phone": null,
    "primaryWalletId": "4b4a25b3-407b-4a08-8283-6972b0f9cf44v",
    "referralCode": "R13243546",
    "referralUserId": "8d31a884-7fa3-469a-a7cb-12f95895c487",
    "roles": ["user"],
    "updatedAt": "2019-07-17T11:39:26.732Z",
    "verified": false
  }
}
```

{% endtab %}
{% endtabs %}

### `POST /users/:id/approve`

> `POST` <https://api.slyk.i&#x6F;**/users/:id/approve>\*\*

Approves the user of the given `id`.&#x20;

{% hint style="warning" %}
A **user** that is not approved is unable to login.
{% endhint %}

{% tabs %}
{% tab title="Response" %}

> `204` No Content
> {% endtab %}
> {% endtabs %}

### `POST /users/:id/block`

> `POST` <https://api.slyk.i&#x6F;**/users/:id/block>\*\*

Blocks the user of the given `id`.

{% hint style="warning" %}
A **user** that is blocked is unable to login.
{% endhint %}

{% tabs %}
{% tab title="Response" %}

> `204` No Content
> {% endtab %}
> {% endtabs %}

### `POST /users/:id/change-password`

> `POST` <https://api.slyk.i&#x6F;**/users/:id/change-password>\*\*

Changes the password of the user of the given `id`.&#x20;

{% tabs %}
{% tab title="Request Parameters" %}

| Field        |   Type   | Required | Description                                                                                      |
| ------------ | :------: | :------: | ------------------------------------------------------------------------------------------------ |
| **password** | `string` |  `true`  | New password. It must contain: 1 capital letter; 1 lower letter; 1 digit; at least 8 characters. |
| {% endtab %} |          |          |                                                                                                  |

{% tab title="Request" %}

```javascript
{
    "password": "Foobar321"
}
```

{% endtab %}

{% tab title="Response" %}

> **204** No Content
> {% endtab %}
> {% endtabs %}

### `POST /users/:id/unblock`

> `POST` <http://api.slyk.i&#x6F;**/users/:id/unlock>\*\*

Unblocks the user of the given `id`.&#x20;

{% tabs %}
{% tab title="Response" %}

> `204` No Content
> {% endtab %}
> {% endtabs %}


---

# 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://developers.slyk.io/slyk/reference/endpoints/user.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.
