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

<AgentInstructions>

## Submitting Feedback

If you encounter incorrect, outdated, or confusing documentation on this page, submit feedback:

POST https://docs.ton.org/feedback

```json
{
  "path": "/ecosystem/api/toncenter/v2/utils/detect-address",
  "feedback": "Description of the issue"
}
```

Only submit feedback when you have something specific and actionable to report.

</AgentInstructions>

# Detect address

> Validates an address and returns it in all standard formats. Use this to convert between address formats or to validate user input. Returns raw format (0:abc), base64 bounceable (EQ), base64 non-bounceable (UQ), and URL-safe variants.



## OpenAPI

````yaml get /api/v2/detectAddress
openapi: 3.1.1
info:
  title: TON HTTP API C++
  description: >
    This API enables HTTP access to TON blockchain - getting accounts and
    wallets information, looking up blocks and transactions, sending messages to
    the blockchain, calling get methods of smart contracts, and more.


    In addition to REST API, all methods are available through a JSON-RPC
    endpoint  with `method` equal to method name and `params` passed as a
    dictionary.


    The response contains a JSON object, which always has a boolean field `ok`
    and either `error` or `result`. If `ok` equals true, the request was
    successful and the result of the query can be found in the `result` field.
    In case of an unsuccessful request, `ok` equals false and the error is
    explained in the `error`.


    API Key should be sent either as `api_key` query parameter or `X-API-Key`
    header
  version: 2.1.1
servers:
  - url: https://toncenter.com
    description: TON Mainnet
  - url: https://testnet.toncenter.com
    description: TON Testnet
security: []
tags:
  - name: Accounts
    description: Information about accounts
  - name: Transactions
    description: Fetching and locating transactions
  - name: Blocks
    description: Information about blocks
  - name: Run method
    description: Run get-method of smart contracts
  - name: Send
    description: Send data to blockchain
  - name: Utils
    description: Some useful methods
  - name: Configuration
    description: Information about blockchain config
  - name: RPC
    description: JSON-RPC and POST endpoints
paths:
  /api/v2/detectAddress:
    get:
      tags:
        - Utils
      summary: Detect address
      description: >-
        Validates an address and returns it in all standard formats. Use this to
        convert between address formats or to validate user input. Returns raw
        format (0:abc), base64 bounceable (EQ), base64 non-bounceable (UQ), and
        URL-safe variants.
      operationId: detectAddress_get
      parameters:
        - $ref: '#/components/parameters/address'
      responses:
        '200':
          description: >-
            Returns the address in all supported formats (raw, bounceable,
            non-bounceable) with base64 and URL-safe variants.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DetectAddressResponse'
        '401':
          $ref: '#/components/responses/401'
        '403':
          $ref: '#/components/responses/403'
        '422':
          $ref: '#/components/responses/422_address'
        '429':
          $ref: '#/components/responses/429'
      security:
        - APIKeyHeader: []
        - APIKeyQuery: []
components:
  parameters:
    address:
      name: address
      in: query
      required: true
      schema:
        $ref: '#/components/schemas/TonAddr'
      description: The account address to query.
  schemas:
    DetectAddressResponse:
      type: object
      additionalProperties: false
      required:
        - ok
        - result
      properties:
        ok:
          type: boolean
          default: true
          description: >-
            Returns `true` if the request succeeded; otherwise `false`. See the
            `error` field for details.
        result:
          $ref: '#/components/schemas/DetectAddress'
          description: Response data. Present only when `ok` is `true`.
        '@extra':
          type: string
          description: >-
            Optional request ID that can be passed in the request and received
            back in the response. Useful for matching async responses.
    TonAddr:
      type: string
      x-usrv-cpp-type: ton_http::types::ton_addr
      description: >-
        Account address in [raw](/foundations/addresses/formats#raw-format)
        format (e.g., `0:ca6e321c...`) or
        [user-friendly](/foundations/addresses/formats#user-friendly-format)
        format (e.g., `EQDKbjIcfM...`). All formats are automatically detected.
    DetectAddress:
      type: object
      additionalProperties: false
      description: >-
        Detected address in all supported formats. Contains the raw on-chain
        form, bounceable and non-bounceable user-friendly representations (each
        in base64 and URL-safe base64), the format type of the original input,
        and the testnet-only flag from the user-friendly encoding.
      properties:
        '@type':
          type: string
          enum:
            - ext.utils.detectedAddress
          default: ext.utils.detectedAddress
          description: >-
            TonLib type identifier for address detection results. Refer to the
            [TonLib type reference](/ecosystem/api/toncenter/v2-tonlib-types)
            for a full list.
        raw_form:
          type: string
          description: >-
            Raw address in `workchain_id:account_id` hex format (e.g.,
            `0:abc...def`). This is the canonical on-chain representation
            without flags or checksum.
        bounceable:
          $ref: '#/components/schemas/DetectAddressBase64Variant'
          description: >-
            Bounceable form of the address in standard base64 and URL-safe
            base64. Bounceable addresses (prefix `E...`) instruct wallet
            software to set the bounce flag on outgoing messages, so funds are
            returned if the destination contract cannot process them.
        non_bounceable:
          $ref: '#/components/schemas/DetectAddressBase64Variant'
          description: >-
            Non-bounceable form of the address in standard base64 and URL-safe
            base64. Non-bounceable addresses (prefix `U...`) instruct wallet
            software to clear the bounce flag, ensuring funds are credited even
            if the recipient has no deployed contract.
        given_type:
          type: string
          enum:
            - raw_form
            - friendly_bounceable
            - friendly_non_bounceable
          description: >-
            The encoding format of the address as provided in the request (e.g.,
            `raw_form`, `dns`, `friendly_bounceable`,
            `friendly_non_bounceable`).
        test_only:
          type: boolean
          description: >-
            Returns `true` if the user-friendly address has the testnet-only
            flag set (`0x80`); otherwise `false`. This is a flag in the address
            encoding that tells wallet software to reject this address on
            mainnet. The underlying account itself can exist on both networks.
      required:
        - '@type'
        - raw_form
        - bounceable
        - non_bounceable
        - given_type
        - test_only
    DetectAddressBase64Variant:
      type: object
      additionalProperties: false
      description: >-
        User-friendly address in both standard base64 and URL-safe base64
        encodings.
      properties:
        '@type':
          type: string
          enum:
            - ext.utils.detectedAddressVariant
          default: ext.utils.detectedAddressVariant
          description: >-
            TonLib type identifier for base64 address encoding variants. Refer
            to the [TonLib type
            reference](/ecosystem/api/toncenter/v2-tonlib-types) for a full
            list.
        b64:
          type: string
          description: >-
            Address in standard base64 encoding (48 characters, uses `+` and
            `/`).
        b64url:
          type: string
          description: >-
            Address in URL-safe base64 encoding (48 characters, uses `-` and `_`
            instead of `+` and `/`).
      required:
        - '@type'
        - b64
        - b64url
  responses:
    '401':
      description: API key does not exist. Check for typos or generate a new key.
      content:
        application/json:
          schema:
            type: object
            additionalProperties: false
            required:
              - ok
              - code
              - error
            properties:
              ok:
                type: boolean
                const: false
                description: Always `false` for error responses.
              code:
                type: integer
                const: 401
                description: HTTP status code `401`.
              error:
                type: string
                enum:
                  - API key does not exist
              '@extra':
                type: string
                description: Extra data passed through from the request.
          example:
            ok: false
            code: 401
            error: API key does not exist
    '403':
      description: >-
        API key is not allowed for this network (e.g. testnet key used on
        mainnet).
      content:
        application/json:
          schema:
            type: object
            additionalProperties: false
            required:
              - ok
              - code
              - error
            properties:
              ok:
                type: boolean
                const: false
                description: Always `false` for error responses.
              code:
                type: integer
                const: 403
                description: HTTP status code `403`.
              error:
                type: string
                enum:
                  - Network not allowed
              '@extra':
                type: string
                description: Extra data passed through from the request.
          example:
            ok: false
            code: 403
            error: Network not allowed
    '429':
      description: >-
        Rate limit exceeded. Back off and retry, or use an API key for higher
        limits.
      content:
        application/json:
          schema:
            type: object
            additionalProperties: false
            required:
              - ok
              - code
              - error
            properties:
              ok:
                type: boolean
                const: false
                description: Always `false` for error responses.
              code:
                type: integer
                const: 429
                description: HTTP status code `429`.
              error:
                type: string
                enum:
                  - Ratelimit exceeded
              '@extra':
                type: string
                description: Extra data passed through from the request.
          example:
            ok: false
            code: 429
            error: Ratelimit exceeded
    422_address:
      description: Invalid address or `seqno` parameter.
      content:
        application/json:
          schema:
            type: object
            additionalProperties: false
            required:
              - ok
              - code
              - error
            properties:
              ok:
                type: boolean
                const: false
                description: Always `false` for error responses.
              code:
                type: integer
                const: 422
                description: HTTP status code `422`.
              error:
                type: string
                enum:
                  - empty address
                  - failed to parse address
                  - failed to parse seqno
                  - seqno should be positive
              '@extra':
                type: string
                description: Extra data passed through from the request.
          example:
            ok: false
            code: 422
            error: empty address
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key
      description: >-
        API key header of the form `X-API-Key: <token>`, where `<token>` is the
        API key. Requests without a key are limited to 1 RPS. Refer to the
        [authentication guide](/ecosystem/api/toncenter/v2-authentication) for
        details.
    APIKeyQuery:
      type: apiKey
      in: query
      name: api_key
      description: >-
        API key query parameter of the form `?api_key=<token>`, where `<token>`
        is the API key. Equivalent to the header method. Refer to the
        [authentication guide](/ecosystem/api/toncenter/v2-authentication) for
        details.

````