# Fetch Blockchains

## Get Blockchain Details

In order to call mutations such as money transfers and swaps, you will need to fetch the specific blockchain ID you wish to operate in. In order to get a specific blockchain/multiple blockchain IDs, use the following query:

In the query variables (body), you insert the blockchain name (or code depending on your preference) of the blockchain you wish to fetch. See the example body below for reference.

```graphql
query Blockchains($where: BlockchainWhereInput) {
  blockchains(where: $where) {
    id
    name
    code
  }
}
```

### **Headers**

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

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

One of/both:

| Name | Type   | Description     |
| ---- | ------ | --------------- |
| name | String | Blockchain Name |
| code | String | Blockchain Code |

Example body:

```json
{
  "where": {
    "name": {
      "equals": "Bitcoin"
    }
  }
}
```

### Response

Return values:

| Name                                 | Type   | Description     |
| ------------------------------------ | ------ | --------------- |
| id<mark style="color:red;">\*</mark> | String | Blockchain ID   |
| name                                 | String | Blockchain Name |
| code                                 | String | Blockchain Code |

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

```javascript
{
  "data": {
    "blockchains": [
      {
        "id": "clefn78cb00h9lc6rdemx563g",
        "name": "Bitcoin",
        "code": "bitcoin"
      }
    ]
  }
}
```

{% endtab %}

{% tab title="🔴 Failure" %}

{% endtab %}
{% endtabs %}

### Try it out!

{% embed url="<https://studio.apollographql.com/sandbox/explorer?endpoint=https://api.inabit.com/graphql&explorerURLState=N4IgJg9gxgrgtgUwHYBcQC4QEcYIE4CeABAEIA20A1lABYCGAlkgM4AUAJAO434LqkUo1ekwDqPPAgCSSAA4wUASiLAAOkiJEARoOGMWrbr35cJCZWo2aiDMOutEkdRPetQIYBK4C+67yAAaEAA3OjwGOh0EZgwQS01VECNJRP5460SnFwwVVwdEhBw6MmZUokSSBhR3JkS8ol8rRv8g2QhmFAAzMgYAcxoUAHlZfDoUBggkAGUocNk0TBBvIA>" %}
