# Get Address

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

GET https://bitcoincash-mainnet.g.alchemy.com/v2/{apiKey}/api/v2/address/{address}

Returns balances and transactions for the given Bitcoin Cash address. Transactions are sorted newest-first by block height. Bitcoin Cash addresses use the `bitcoincash:` CashAddr prefix.


Reference: https://www.alchemy.com/docs/chains/bitcoincash/utxo-api-endpoints/utxo-api-endpoints/get-address

## Path Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| apiKey | string | Yes | For higher throughput, [create your own API key](https://dashboard.alchemy.com/signup) |
| address | string | Yes | Bitcoin Cash CashAddr address (`bitcoincash:` prefixed). |

## Query Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| page | integer | No | Page of returned transactions, starting from 1. |
| pageSize | integer | No | Number of transactions returned per page (max 1000). |
| from | integer | No | Filter transactions starting from this block height. |
| to | integer | No | Filter transactions up to this block height. |
| details | enum | No | Level of detail to return. |
| secondary | string | No | Secondary (fiat) currency code for balance conversion, e.g. `usd` or `eur`. |

## Code Examples

### cURL

```bash
curl --request GET \
  --url https://bitcoincash-mainnet.g.alchemy.com/v2/docs-demo/api/v2/address/bitcoincash:qp3wjpa3tjlj042z2wv7hahsldgwhwy0rq9sywjpyy
```

### JavaScript

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

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

### Python

```python
import requests

url = "https://bitcoincash-mainnet.g.alchemy.com/v2/docs-demo/api/v2/address/bitcoincash:qp3wjpa3tjlj042z2wv7hahsldgwhwy0rq9sywjpyy"

response = requests.get(url)

print(response.text)
```

### Go

```go
package main

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

func main() {

	url := "https://bitcoincash-mainnet.g.alchemy.com/v2/docs-demo/api/v2/address/bitcoincash:qp3wjpa3tjlj042z2wv7hahsldgwhwy0rq9sywjpyy"

	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://bitcoincash-mainnet.g.alchemy.com/v2/docs-demo/api/v2/address/bitcoincash:qp3wjpa3tjlj042z2wv7hahsldgwhwy0rq9sywjpyy")
  .asString();
```

### C#

```csharp
using RestSharp;


var options = new RestClientOptions("https://bitcoincash-mainnet.g.alchemy.com/v2/docs-demo/api/v2/address/bitcoincash:qp3wjpa3tjlj042z2wv7hahsldgwhwy0rq9sywjpyy");
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/address/{address}
method: GET
operation:
  operationId: getAddress
  summary: Get Address
  description: |
    Returns balances and transactions for the given Bitcoin Cash address. Transactions are sorted newest-first by block height. Bitcoin Cash addresses use the `bitcoincash:` CashAddr prefix.
  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: address
      required: true
      description: Bitcoin Cash CashAddr address (`bitcoincash:` prefixed).
      schema:
        type: string
      example: bitcoincash:qp3wjpa3tjlj042z2wv7hahsldgwhwy0rq9sywjpyy
    - in: query
      name: page
      required: false
      description: Page of returned transactions, starting from 1.
      schema:
        type: integer
        minimum: 1
        default: 1
    - in: query
      name: pageSize
      required: false
      description: Number of transactions returned per page (max 1000).
      schema:
        type: integer
        minimum: 1
        maximum: 1000
        default: 1000
    - in: query
      name: from
      required: false
      description: Filter transactions starting from this block height.
      schema:
        type: integer
        minimum: 0
    - in: query
      name: to
      required: false
      description: Filter transactions up to this block height.
      schema:
        type: integer
        minimum: 0
    - in: query
      name: details
      required: false
      description: Level of detail to return.
      schema:
        type: string
        enum:
          - basic
          - tokens
          - tokenBalances
          - txids
          - txslight
          - txs
        default: txids
    - in: query
      name: secondary
      required: false
      description: Secondary (fiat) currency code for balance conversion, e.g. `usd` or `eur`.
      schema:
        type: string
  responses:
    '200':
      description: Address details, balances, 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
          example:
            page: 1
            totalPages: 2
            itemsOnPage: 1000
            address: bitcoincash:qp3wjpa3tjlj042z2wv7hahsldgwhwy0rq9sywjpyy
            balance: '7671258180'
            totalReceived: '7671258180'
            totalSent: '0'
            unconfirmedBalance: '0'
            unconfirmedTxs: 0
            txs: 1228
            txids:
              - 20063eb8ae04c6449ea397ca609db09522e316795d96eb47d3e4c50591fb3679
              - 0ddda32c1004ba0cdb6544ac4622f7affc895b8f582b27f202d9745186f72d0a
    '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
```
