# Fetch Deposit Address

## Get an Existing Wallet Deposit Address

The `GetOrCreateDepositAddress` query allows API users to fetch an existing blockchain address for an asset & blockchain in their wallet. If there isn't one, the query will return an error and you will need to use [Generate Deposit Address](/api-reference/develop-with-inabit-api/wallets/generate-deposit-address.md) query beforehand to add a coin first.

> Do note that currently, this query is called `GetOrCreateDepositAddress` while in fact this query cannot create/generate a new blockchain deposit address for a wallet. This confusion will be fixed and deprecated in future versions of the API.

```graphql
query GetOrCreateDepositAddress($where: WalletDepositAddressWhereInput!) {
  getOrCreateDepositAddress(where: $where) {
    address
  }
}
```

### **Headers**

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

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

| Name                                               | Type   | Description                                               |
| -------------------------------------------------- | ------ | --------------------------------------------------------- |
| walletId<mark style="color:red;">\*</mark>         | string | ID of the wallet                                          |
| financialAssetId<mark style="color:red;">\*</mark> | string | ID of the financial asset in inabit (can be token/native) |
| blockchainId<mark style="color:red;">\*</mark>     | string | ID of the blockchain in inabit                            |

Example body:

```graphql
{
  "where": {
    "walletId": "clmq35x0400009k01v5ptn7d5",
    "assetId": "clefn78h5012plc6rxbmofnop",
    "blockchainId": "clefn78cl00i3lc6rih442mx9"
  }
}
```

### Response

Return values:

| Name    | Type   | Description        |
| ------- | ------ | ------------------ |
| address | String | API Wallet Address |

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

```graphql
{
  "data": {
    "getOrCreateDepositAddress": {
      "address": "0x429de487cF185eFBBEb3158D2FbC1C003462018c",
    }
  }
}
```

{% endtab %}

{% tab title="🔴 Failure" %}

```graphql
{
  "error": "Invalid request"
}
```

{% endtab %}
{% endtabs %}

In the query's response, you will receive the created API wallet address for the wallet, asset & blockchain IDs given in the body.

### Try it out!

{% embed url="<https://studio.apollographql.com/sandbox/explorer?endpoint=https://api.inabit.com/graphql&explorerURLState=N4IgJg9gxgrgtgUwHYBcQC4QEcYIE4CeABAOIIoDyeAwnggIYoIAiCADhAM4CWKAgmDB1OnABQASAO4ALfAnREA6vQA2K8qw49+g4Z0Wy6ASSRsYKAIQBKIsAA6SIkQDm5KrQZNNXXgKEIRURk5BSlDBBt7Ryciel0AzgcnAF8HZJAAGhAAN3o8bnoAI3VODBAopzsQYLoqhQqYqslVdRQjMDqiKqgVbLgARgBmenoAdgAGScG2aQIAJiQAVgArUYQoBABOKoykxpB6EXJ2zu71ADMkUYAOaUXx-rm2FSgANjwAD0K4CEuINh2e0qIGK0AA1lBpPRuEgThguiAeghLjcepNuIMXu9uNIACy4uZwD7bEB7VJIdJZLQoc4qbjOaSUNj4RjcCBIADKUHybDQmBAySAA>" %}


---

# Agent Instructions: 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:

```
GET https://docs.inabit.com/api-reference/develop-with-inabit-api/wallets/fetch-deposit-address.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
