> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chainstack.com/llms.txt
> Use this file to discover all available pages before exploring further.

# detectAddress | TON v2

> The detectAddress method is used to detect the type and format of a TON address. Available on TON v2 via Chainstack JSON-RPC nodes.

The `detectAddress` method is used to detect the type and format of a TON address. This method provides detailed information about the given address, including its raw form, bounceable and non-bounceable representations, and whether it's a testnet address.

<Note>
  **TON billing: full (1 RU)**

  This method is always billed as full. See [Request units — TON method scope](/docs/request-units#ton-method-scope).
</Note>

## Parameters

* `address` (string, required) — The address to detect. Example: `EQDtFpEwcFAEcRe5mLVh2N6C0x-_hJEM7W61_JLnSF74p4q2`.

## JSON-RPC example

```shell Shell theme={"system"}
curl -X POST \
  'https://ton-mainnet.core.chainstack.com/f2a2411bce1e54a2658f2710cd7969c3/api/v2/jsonRPC' \
  -H 'Content-Type: application/json' \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "detectAddress",
    "params": {
      "address": "EQDtFpEwcFAEcRe5mLVh2N6C0x-_hJEM7W61_JLnSF74p4q2"
    }
  }'
```

## Response

* `raw_form` (string) — The raw form of the address.
* `bounceable` (object) — The bounceable representations of the address:
  * `b64` (string) — The bounceable address in base64 format.
  * `b64url` (string) — The bounceable address in base64url format.
* `non_bounceable` (object) — The non-bounceable representations of the address:
  * `b64` (string) — The non-bounceable address in base64 format.
  * `b64url` (string) — The non-bounceable address in base64url format.
* `given_type` (string) — The type of the given address (e.g., "friendly", "raw").
* `test_only` (boolean) — Indicates whether the address is for testnet use only.

## Use case

A possible use case for the `detectAddress` method in TON is for applications that need to handle various types of TON addresses. This method can be used to:

1. Validate and normalize user-input addresses.
2. Determine the appropriate format to use when interacting with smart contracts.
3. Display different address representations to users based on context.
4. Detect if an address is meant for testnet, preventing accidental use on mainnet.


## OpenAPI

````yaml openapi/ton_node_api/v2/detectAddress.json GET /detectAddress
openapi: 3.0.0
info:
  title: detectAddress example
  version: 1.0.0
  description: >-
    This is an API example for detectAddress, a method to detect the type and
    format of a TON address.
servers:
  - url: >-
      https://ton-mainnet.core.chainstack.com/f2a2411bce1e54a2658f2710cd7969c3/api/v2
security: []
paths:
  /detectAddress:
    get:
      tags:
        - TON Operations
      summary: detectAddress
      operationId: detectAddress
      parameters:
        - name: address
          in: query
          required: true
          description: The address to detect
          schema:
            type: string
            default: EQDtFpEwcFAEcRe5mLVh2N6C0x-_hJEM7W61_JLnSF74p4q2
          example: EQDtFpEwcFAEcRe5mLVh2N6C0x-_hJEM7W61_JLnSF74p4q2
      responses:
        '200':
          description: Information about the detected address
          content:
            application/json:
              schema:
                type: object
                properties:
                  raw_form:
                    type: string
                    description: The raw form of the address
                  bounceable:
                    type: object
                    properties:
                      b64:
                        type: string
                        description: The bounceable address in base64 format
                      b64url:
                        type: string
                        description: The bounceable address in base64url format
                  non_bounceable:
                    type: object
                    properties:
                      b64:
                        type: string
                        description: The non-bounceable address in base64 format
                      b64url:
                        type: string
                        description: The non-bounceable address in base64url format
                  given_type:
                    type: string
                    description: The type of the given address
                  test_only:
                    type: boolean
                    description: Whether the address is for testnet only

````