> For the complete documentation index, see [llms.txt](https://docs.inabit.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.inabit.com/api-reference/develop-with-inabit-api/utilities/fetch-blockchains.md).

# 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>" %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.inabit.com/api-reference/develop-with-inabit-api/utilities/fetch-blockchains.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
