# Get Xpub

> For the complete documentation index, see [llms.txt](/docs/llms.txt).

GET https://dogecoin-mainnet.g.alchemy.com/v2/{apiKey}/api/v2/xpub/{xpub}

Returns balances and transactions for an xpub or output descriptor on Dogecoin. Supports BIP44 derivation. The BIP version is determined by the xpub prefix or by an explicit output descriptor.


Reference: https://www.alchemy.com/docs/chains/dogecoin/utxo-api-endpoints/utxo-api-endpoints/get-xpub

## Path Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| apiKey | string | Yes | For higher throughput, [create your own API key](https://dashboard.alchemy.com/signup) |
| xpub | string | Yes | Extended public key or output descriptor. |

## Query Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| page | integer | No |  |
| pageSize | integer | No |  |
| from | integer | No |  |
| to | integer | No |  |
| details | enum | No |  |
| tokens | enum | No | Which derived addresses to return. |
| secondary | string | No | Secondary (fiat) currency code for balance conversion. |

## Code Examples

### cURL

```bash
curl --request GET \
  --url https://dogecoin-mainnet.g.alchemy.com/v2/docs-demo/api/v2/xpub/xpub6CUGRUonZSQ4TWtTMmzXdrXDtypWKiKrhko4egpiMZbpiaQL2jkwSB1icqYh2cfDfVxdx4df189oLKnC5fSwqPfgyP3hooxujYzAu3fDVmz
```

### JavaScript

```javascript
const options = {method: 'GET'};

fetch('https://dogecoin-mainnet.g.alchemy.com/v2/docs-demo/api/v2/xpub/xpub6CUGRUonZSQ4TWtTMmzXdrXDtypWKiKrhko4egpiMZbpiaQL2jkwSB1icqYh2cfDfVxdx4df189oLKnC5fSwqPfgyP3hooxujYzAu3fDVmz', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://dogecoin-mainnet.g.alchemy.com/v2/docs-demo/api/v2/xpub/xpub6CUGRUonZSQ4TWtTMmzXdrXDtypWKiKrhko4egpiMZbpiaQL2jkwSB1icqYh2cfDfVxdx4df189oLKnC5fSwqPfgyP3hooxujYzAu3fDVmz"

response = requests.get(url)

print(response.text)
```

### Go

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://dogecoin-mainnet.g.alchemy.com/v2/docs-demo/api/v2/xpub/xpub6CUGRUonZSQ4TWtTMmzXdrXDtypWKiKrhko4egpiMZbpiaQL2jkwSB1icqYh2cfDfVxdx4df189oLKnC5fSwqPfgyP3hooxujYzAu3fDVmz"

	req, _ := http.NewRequest("GET", url, nil)

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
```

### Java

```java
HttpResponse<String> response = Unirest.get("https://dogecoin-mainnet.g.alchemy.com/v2/docs-demo/api/v2/xpub/xpub6CUGRUonZSQ4TWtTMmzXdrXDtypWKiKrhko4egpiMZbpiaQL2jkwSB1icqYh2cfDfVxdx4df189oLKnC5fSwqPfgyP3hooxujYzAu3fDVmz")
  .asString();
```

### C#

```csharp
using RestSharp;


var options = new RestClientOptions("https://dogecoin-mainnet.g.alchemy.com/v2/docs-demo/api/v2/xpub/xpub6CUGRUonZSQ4TWtTMmzXdrXDtypWKiKrhko4egpiMZbpiaQL2jkwSB1icqYh2cfDfVxdx4df189oLKnC5fSwqPfgyP3hooxujYzAu3fDVmz");
var client = new RestClient(options);
var request = new RestRequest("");
var response = await client.GetAsync(request);

Console.WriteLine("{0}", response.Content);

```


## Operation Specification

```yaml
path: /{apiKey}/api/v2/xpub/{xpub}
method: GET
operation:
  operationId: getXpub
  summary: Get Xpub
  description: |
    Returns balances and transactions for an xpub or output descriptor on Dogecoin. Supports BIP44 derivation. The BIP version is determined by the xpub prefix or by an explicit output descriptor.
  tags:
    - UTXO API Endpoints
  parameters:
    - name: apiKey
      in: path
      required: true
      schema:
        type: string
        default: docs-demo
      description: For higher throughput, [create your own API key](https://dashboard.alchemy.com/signup)
    - in: path
      name: xpub
      required: true
      description: Extended public key or output descriptor.
      schema:
        type: string
      example: xpub6CUGRUonZSQ4TWtTMmzXdrXDtypWKiKrhko4egpiMZbpiaQL2jkwSB1icqYh2cfDfVxdx4df189oLKnC5fSwqPfgyP3hooxujYzAu3fDVmz
    - in: query
      name: page
      required: false
      schema:
        type: integer
        minimum: 1
        default: 1
    - in: query
      name: pageSize
      required: false
      schema:
        type: integer
        minimum: 1
        maximum: 1000
        default: 1000
    - in: query
      name: from
      required: false
      schema:
        type: integer
        minimum: 0
    - in: query
      name: to
      required: false
      schema:
        type: integer
        minimum: 0
    - in: query
      name: details
      required: false
      schema:
        type: string
        enum:
          - basic
          - tokens
          - tokenBalances
          - txids
          - txs
        default: txids
    - in: query
      name: tokens
      required: false
      description: Which derived addresses to return.
      schema:
        type: string
        enum:
          - nonzero
          - used
          - derived
        default: nonzero
    - in: query
      name: secondary
      required: false
      description: Secondary (fiat) currency code for balance conversion.
      schema:
        type: string
  responses:
    '200':
      description: Xpub details, balances, derived addresses, and transactions.
      content:
        application/json:
          schema:
            type: object
            properties:
              page:
                type: integer
              totalPages:
                type: integer
              itemsOnPage:
                type: integer
              address:
                type: string
              balance:
                type: string
              totalReceived:
                type: string
              totalSent:
                type: string
              unconfirmedBalance:
                type: string
              unconfirmedTxs:
                type: integer
              txs:
                type: integer
              txids:
                type: array
                items:
                  type: string
              usedTokens:
                type: integer
              tokens:
                type: array
                items:
                  type: object
                  description: Derived token entry for an xpub or address.
                  properties:
                    type:
                      type: string
                      example: XPUBAddress
                    name:
                      type: string
                    path:
                      type: string
                    transfers:
                      type: integer
                    decimals:
                      type: integer
                    balance:
                      type: string
                    totalReceived:
                      type: string
                    totalSent:
                      type: string
              secondaryValue:
                type: number
    '400':
      description: Malformed request.
      content:
        application/json:
          schema:
            type: object
            required:
              - error
            properties:
              error:
                type: string
                description: Human-readable error message.
          example:
            error: invalid request
    '404':
      description: Resource not found on the requested network.
      content:
        application/json:
          schema:
            type: object
            required:
              - error
            properties:
              error:
                type: string
                description: Human-readable error message.
          example:
            error: not found
```
