# Organization Users

## Fetch Organization Users

Retrieving all organization users, per organization. This is done through querying the organization agents information.

For example: Let's get the organization users names and roles.

```graphql
query Organization($where: OrganizationWhereUniqueInput!) {
	organization(where: $where) {
		agents {
			firstName
			lastName
			roles
		}
	}
}
```

### **Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

### **Body (**<mark style="color:orange;">OrganizationWhereUniqueInput</mark> object)

| Name                                 | Type   | Description                                                                                |
| ------------------------------------ | ------ | ------------------------------------------------------------------------------------------ |
| id<mark style="color:red;">\*</mark> | string | <p>Organization ID. <br>See <a data-mention href="organization-id">organization-id</a></p> |

[Example body:](#user-content-fn-1)[^1]

```graphql
{
  "where": {
    "id": "organizationId123"
  }
}
```

### **Response**

Returned values:

| Name      | Type   | Description     |
| --------- | ------ | --------------- |
| firstName | string | User first name |
| lastName  | string | User last name  |
| roles     | JSON   | Array of roles  |

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

```json
{
	"data": {
		"organization": {
			"agents": [
				{
					"firstName": "Ahmad",
					"lastName": "Carter",
					"roles": [
						"viewer"
					]
				},
				{
					"firstName": "Oda",
					"lastName": "Pfeffer",
					"roles": [
						"signer"
					]
				},
				{
					"firstName": "Fredy",
					"lastName": "Lesch",
					"roles": [
						"admin"
					]
				},
				{
					"firstName": "Earnest",
					"lastName": "Blick",
					"roles": [
						"owner"
					]
				},
			]
		}
	}
}
```

{% endtab %}

{% tab title="🔴 400" %}

```json
```

{% endtab %}
{% endtabs %}

### Try it out!

{% embed url="<https://studio.apollographql.com/sandbox/explorer?endpoint=https://api.inabit.app/graphql&explorerURLState=N4IgJg9gxgrgtgUwHYBcQC4QEcYIE4CeABAPJ4DmAhkgJYBelKNESAFACQDuAFvguqQrV6jZkgDqvPAgCqtHAgCSSAA4wUAQgCURYAB0kelBCG0GTFqx58BXKQh37DKI5XLIUAZ10GjflABmNHieKABylIi+LjEANpShEVHO-ngQsQie0UYAvtF5SDkgOUA>" %}

[^1]:
