# Wallets Info

## Fetch Organization Wallets

Retrieve organization's wallets information in an inabit account, according to an organization ID variable in the query's body.

<pre class="language-graphql"><code class="lang-graphql"><strong>query Wallets($where: WalletWhereInput) {
</strong>  wallets(where: $where) {
    id
    name
    balanceUSD
    balanceEUR
    walletCryptoAccounts {
      name
      balance
      financialAsset {
        code
      }
      blockchain {
        code
      }
    }
  }
}
</code></pre>

### **Headers**

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

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

| Name                                 | Type   | Description     |
| ------------------------------------ | ------ | --------------- |
| id<mark style="color:red;">\*</mark> | string | Organization ID |

Example body:

```json
{
  "where": {
    "organization": {
      "id": "cljzumgxa0009k603wl8foc6z"
    }
  }
}
```

**How do I retrieve my organization ID?**

In order to retrieve an organization's identifier, you'll need to call your user details first, to understand which organization is related to them.

```graphql
query User($where: UserWhereUniqueInput!) {
  user(where: $where) {
    fullName
    organizations {
      name
      id
    }
  }
}
```

### Response

Return values:

| Name                           | Type    | Description                                                  |
| ------------------------------ | ------- | ------------------------------------------------------------ |
| id                             | String  | Wallet ID                                                    |
| name                           | Integer | Wallet Name                                                  |
| balanceUSD                     | String  | Balance in USD                                               |
| balanceEUR                     | String  | Balance in Euro                                              |
| balance (walletCryptoAccounts) | Integer | Balance (of a wallet's asset - per asset) ("crypto account") |
| code (financialAsset)          | String  | Financial Asset Code                                         |
| code (blockchain)              | String  | Blockchain Code                                              |

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

```json
{
  "data": {
    "wallets": [
      {
        "id": "clllyfdl8007jbtqksgcgx1wy",
        "name": "Wallet 1",
        "balanceUSD": 0,
        "balanceEUR": 0,
        "walletCryptoAccounts": []
      },
      {
        "id": "clnleemkg0000780172yr8115",
        "name": "Wallet 2",
        "balanceUSD": 0,
        "balanceEUR": 0,
        "walletCryptoAccounts": []
      },
      {
        "id": "cln1qt5p400005b012sohm0sx",
        "name": "Wallet 3",
        "balanceUSD": 0,
        "balanceEUR": 0,
        "walletCryptoAccounts": []
      },
      {
        "id": "cln1p10nm00006b016ow1abpj",
        "name": "Wallet 4",
        "balanceUSD": 305.41,
        "balanceEUR": 301.96,
        "walletCryptoAccounts": [
          {
            "balance": 0.05591,
            "financialAsset": {
              "code": "ETH"
            },
            "blockchain": {
              "code": "ethereum"
            }
          }
        ]
      }
```

{% endtab %}

{% tab title="🔴 Failure" %}

```json
{
  "errors": [
    {
      "message": "Unauthorized",
      "extensions": {
        "code": "UNAUTHENTICATED",
        "response": {
          "statusCode": 401,
          "message": "Unauthorized"
        }
      }
    }
  ],
  "data": {
    "transaction": null
  }
}
```

{% endtab %}
{% endtabs %}

**How do I retrieve my organization ID?**

In order to retrieve an organization's identifier, you'll need to call your user details first, to understand which organization is related to them.

```graphql
query User($where: UserWhereUniqueInput!) {
  user(where: $where) {
    fullName
    organizations {
      name
      id
    }
  }
}
```

### Try it out!

{% embed url="<https://studio.apollographql.com/sandbox/explorer?endpoint=https%3A%2F%2Fapi.inabit.app%2Fgraphql&explorerURLState=N4IgJg9gxgrgtgUwHYBcQC4QEcYIE4CeABAOoCGANhQigM4AUAJAO4AW%2BC6pl1KJ7eBAEkkABxgoAlEWAAdJESLMeNBmw5cWAhNLkLFRJGUTyDRAEaUySKAgCqAZQAipg5YrXbAUTsAlV4rKVDQAwoSiKBAAglBQEDCotDIBBkYm%2BmbunggpigBmAJZGNgWUUbS0NMkZZkRxYDk1igC%2BuRYU0ADWUKxkRdW1BvWNg601Yy3yzSDNQA>" %}
