# Groups

## Groups

## /groups

<mark style="color:blue;">`GET`</mark> `https://explorer.protokol.sh/api/guardian/groups`  &#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                                             |
| orderBy  | string  | <p>Type by which it should order resources.<br>Example: orderBy=name:asc</p> |
| name     | string  | Value by which it should search for resources (allows wildcard %)            |
| priority | integer | Value by which should search for resources                                   |
| active   | boolean | Value by which should search for resources                                   |
| default  | boolean | Value by which should search for resources                                   |

{% 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/groups
```

{% endtab %}

{% tab title="Typescript" %}

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

>>> Promise<ApiResponseWithPagination<Group>>
```

{% endtab %}
{% endtabs %}

## Group By Name

## /groups/:name

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

Returns Group by name

#### 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": "Group not found"
}
```

{% endtab %}
{% endtabs %}

### Examples

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

```
curl https://explorer.protokol.sh/api/guardian/groups/Test%20Guardian%20Permission%20Group
```

{% endtab %}

{% tab title="Typescript" %}

```typescript
const response = await connection.guardianApi("groups").get("VALID_GROUP_NAME");

>>> Promise<ApiResponse<Group>>
```

{% endtab %}
{% endtabs %}

## Users By Group Name

## /groups/:name/users

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

Returns users of specific group by name

#### 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": "Group not found"
}
```

{% endtab %}
{% endtabs %}

### Examples

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

```
curl https://explorer.protokol.sh/api/guardian/groups/Test%20group%201/users
```

{% endtab %}

{% tab title="Typescript" %}

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

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

{% endtab %}
{% endtabs %}
