# Users

## Users

## /users

<mark style="color:blue;">`GET`</mark> `https://explorer.protokol.sh/api/guardian/users`  &#x20;

Returns all Groups

#### Query Parameters

| Name      | Type    | Description                                                  |
| --------- | ------- | ------------------------------------------------------------ |
| page      | integer | The number of a page that will be returned                   |
| limit     | integer | The number of resources per page                             |
| publickey | string  | Value by which it searches for resources (allows wildcard %) |

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

```javascript
{
  "meta": {
    "totalCountIsEstimate": false,
    "count": 2,
    "pageCount": 1,
    "totalCount": 2,
    "next": null,
    "previous": null,
    "self": "/guardian/groups?page=1&limit=100",
    "first": "/guardian/groups?page=1&limit=100",
    "last": "/guardian/groups?page=1&limit=100"
  },
  "data": [
    {
      "name": "Test Guardian Permission Group",
      "priority": 1,
      "active": true,
      "default": false,
      "allow": [
        {
          "transactionType": 1,
          "transactionTypeGroup": 1
        }
      ],
      "deny": [
        {
          "transactionType": 2,
          "transactionTypeGroup": 1
        }
      ]
    },
    {
      "name": "Test Guardian Permission Group2",
      "priority": 1,
      "active": true,
      "default": false,
      "allow": [
        {
          "transactionType": 1,
          "transactionTypeGroup": 1
        }
      ],
      "deny": [
        {
          "transactionType": 2,
          "transactionTypeGroup": 1
        }
      ]
    }
  ]
}
```

{% endtab %}
{% endtabs %}

### Examples

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

```
curl https://explorer.protokol.sh/api/guardian/users
```

{% endtab %}

{% tab title="Typescript" %}

```typescript
const response = await connection.guardianApi("users").index();

>>> Promise<ApiResponseWithPagination<User>>
```

{% endtab %}
{% endtabs %}

## User By Publickey

## /users/:id

<mark style="color:blue;">`GET`</mark> `https://explorer.protokol.sh/api/guardian/users/:id` &#x20;

Returns User by publickey

#### Path Parameters

| Name | Type   | Description           |
| ---- | ------ | --------------------- |
| name | string | The name of the group |

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

```javascript
{
  "data": {
    "publicKey": "03c11f2a1fc02c88cd9b8db5272cba390bdb9ce3e1d58355de1b7a24c673e06ebc",
    "groups": [
      "Test Guardian Permission Group"
    ],
    "allow": [
      {
        "transactionType": 2,
        "transactionTypeGroup": 1
      }
    ],
    "deny": []
  }
}
```

{% endtab %}

{% tab title="404 " %}

```javascript
{
  "statusCode": 404,
  "error": "Not Found",
  "message": "User not found"
}
```

{% endtab %}

{% tab title="422 " %}

```javascript
{
  "statusCode": 422,
  "error": "Unprocessable Entity",
  "message": "\"id\" length must be 66 characters long"
}
```

{% endtab %}
{% endtabs %}

### Examples

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

```
curl https://explorer.protokol.sh/api/guardian/users/03c11f2a1fc02c88cd9b8db5272cba390bdb9ce3e1d58355de1b7a24c673e06ebc
```

{% endtab %}

{% tab title="Typescript" %}

```typescript
const response = await connection.guardianApi("users").get("PUBLIC_KEY");

>>> Promise<ApiResponse<User>>
```

{% endtab %}
{% endtabs %}

## User Groups

## /users/:id/groups

<mark style="color:blue;">`GET`</mark> `https://explorer.protokol.sh/api/guardian/users/:id/groups`  &#x20;

Returns groups of specific user by publickey

#### Path Parameters

| Name | Type   | Description           |
| ---- | ------ | --------------------- |
| name | string | The name of the group |

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

```javascript
{
  "data": [
    {
      "name": "Test Guardian Permission Group",
      "priority": 1,
      "active": true,
      "default": false,
      "allow": [
        {
          "transactionType": 1,
          "transactionTypeGroup": 1
        }
      ],
      "deny": [
        {
          "transactionType": 2,
          "transactionTypeGroup": 1
        }
      ]
    }
  ]
}
```

{% endtab %}

{% tab title="404 " %}

```javascript
{
  "statusCode": 404,
  "error": "Not Found",
  "message": "User not found"
}
```

{% endtab %}

{% tab title="422 " %}

```javascript
{
  "statusCode": 422,
  "error": "Unprocessable Entity",
  "message": "\"id\" length must be 66 characters long"
}
```

{% endtab %}
{% endtabs %}

### Examples

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

```
curl https://explorer.protokol.sh/api/guardian/users/03c11f2a1fc02c88cd9b8db5272cba390bdb9ce3e1d58355de1b7a24c673e06ebc/groups
```

{% endtab %}

{% tab title="Typescript" %}

```typescript
const response = await connection.guardianApi("users").userGroups("PUBLIC_KEY");

>>> Promise<ApiResponse<UserGroups>>
```

{% 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://docs.protokol.com/developers/sdk/guardian/api-endpoints/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.
