# Validate an address

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

POST https://tron-mainnet.g.alchemy.com/v2/docs-demo/wallet/validateaddress

Validates whether the given address is a valid TRON address.   It can optionally check whether the address is in base58check format (`visible: true`) or hex format (`visible: false`).


Reference: https://www.alchemy.com/docs/chains/tron/tron-http-api-endpoints/tron-http-api-endpoints/validate-an-address

## Code Examples

### cURL

```bash
curl --request POST \
  --url https://tron-mainnet.g.alchemy.com/v2/docs-demo/wallet/validateaddress \
  --header 'Content-Type: application/json' \
  --data '{
  "address": "TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs",
  "visible": true
}'
```

### JavaScript

```javascript
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({address: 'TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs', visible: true})
};

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

### Python

```python
import requests

url = "https://tron-mainnet.g.alchemy.com/v2/docs-demo/wallet/validateaddress"

payload = {
    "address": "TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs",
    "visible": True
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

### Go

```go
package main

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

func main() {

	url := "https://tron-mainnet.g.alchemy.com/v2/docs-demo/wallet/validateaddress"

	payload := strings.NewReader("{\n  \"address\": \"TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs\",\n  \"visible\": true\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

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

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

	fmt.Println(string(body))

}
```

### Java

```java
HttpResponse<String> response = Unirest.post("https://tron-mainnet.g.alchemy.com/v2/docs-demo/wallet/validateaddress")
  .header("Content-Type", "application/json")
  .body("{\n  \"address\": \"TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs\",\n  \"visible\": true\n}")
  .asString();
```

### C#

```csharp
using RestSharp;


var options = new RestClientOptions("https://tron-mainnet.g.alchemy.com/v2/docs-demo/wallet/validateaddress");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddJsonBody("{\n  \"address\": \"TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs\",\n  \"visible\": true\n}", false);
var response = await client.PostAsync(request);

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

```


## Operation Specification

```yaml
path: /wallet/validateaddress
method: POST
operation:
  summary: Validate an address
  description: |
    Validates whether the given address is a valid TRON address.   It can optionally check whether the address is in base58check format (`visible: true`) or hex format (`visible: false`).
  tags:
    - Tron HTTP API Endpoints
  security:
    - apiKey: []
  requestBody:
    required: true
    content:
      application/json:
        schema:
          type: object
          properties:
            address:
              type: string
              description: The TRON address to validate.
              example: TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs
            visible:
              type: boolean
              description: |
                Set to `true` if the address is in base58check format (default for user-facing), or `false` if it is in hex format (starting with 0x).
              example: true
          required:
            - address
  responses:
    '200':
      description: Validation result.
      content:
        application/json:
          schema:
            type: object
            properties:
              result:
                type: boolean
                description: Whether the address is valid.
              message:
                type: string
                description: Description of the validation result.
          examples:
            response:
              summary: Example response
              value:
                result: true
                message: Base58check format
```
