# zks_getConfirmedTokens

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

POST https://zksync-mainnet.g.alchemy.com/v2/{apiKey}

Retrieves the confirmed tokens on zkSync.

Reference: https://www.alchemy.com/docs/chains/zksync/zk-sync-api-endpoints/zks-get-confirmed-tokens

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| From token ID | integer | Yes | Token ID from which to start listing. |
| Limit | integer | Yes | Maximum number of tokens to list. |

## Result

**Confirmed tokens** (object[]): List of confirmed tokens on zkSync.

## Example

### Request

```json
{
  "jsonrpc": "2.0",
  "method": "zks_getConfirmedTokens",
  "params": [
    1,
    3
  ],
  "id": 1
}
```

### Response

```json
{
  "jsonrpc": "2.0",
  "result": [
    {
      "l1Address": "0xb6ed7644c69416d67b522e20bc294a9a9b405b31",
      "l2Address": "0xfea352c0d005a1e4ac7e092ef14fca18b8e6c8fd",
      "name": "0xBitcoin Token",
      "symbol": "0xBTC",
      "decimals": 8
    }
  ],
  "id": 1
}
```

## Code Examples

### cURL

```bash
curl --request POST \
  --url https://zksync-mainnet.g.alchemy.com/v2/docs-demo \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "zks_getConfirmedTokens",
  "params": [
    1,
    3
  ]
}'
```

### JavaScript

```javascript
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({jsonrpc: '2.0', id: 1, method: 'zks_getConfirmedTokens', params: [1, 3]})
};

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

### Python

```python
import requests

url = "https://zksync-mainnet.g.alchemy.com/v2/docs-demo"

payload = {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "zks_getConfirmedTokens",
    "params": [1, 3]
}
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://zksync-mainnet.g.alchemy.com/v2/docs-demo"

	payload := strings.NewReader("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"zks_getConfirmedTokens\",\n  \"params\": [\n    1,\n    3\n  ]\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://zksync-mainnet.g.alchemy.com/v2/docs-demo")
  .header("Content-Type", "application/json")
  .body("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"zks_getConfirmedTokens\",\n  \"params\": [\n    1,\n    3\n  ]\n}")
  .asString();
```

### C#

```csharp
using RestSharp;


var options = new RestClientOptions("https://zksync-mainnet.g.alchemy.com/v2/docs-demo");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddJsonBody("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"zks_getConfirmedTokens\",\n  \"params\": [\n    1,\n    3\n  ]\n}", false);
var response = await client.PostAsync(request);

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

```


## OpenRPC Method Specification

```yaml
name: zks_getConfirmedTokens
summary: Retrieves the confirmed tokens on zkSync.
description: Retrieves the confirmed tokens on zkSync.
params:
  - name: From token ID
    required: true
    description: Token ID from which to start listing.
    schema:
      type: integer
      format: uint32
  - name: Limit
    required: true
    description: Maximum number of tokens to list.
    schema:
      type: integer
      format: uint8
result:
  name: Confirmed tokens
  description: List of confirmed tokens on zkSync.
  schema:
    type: array
    items:
      type: object
      properties:
        l1Address:
          title: hex encoded address
          type: string
          pattern: ^0x[0-9a-fA-F]{40}$
          description: Layer 1 address of the token (Ethereum)
        l2Address:
          title: hex encoded address
          type: string
          pattern: ^0x[0-9a-fA-F]{40}$
          description: Layer 2 address of the token (ZKsync Chain)
        name:
          type: string
          description: Name of the token
        symbol:
          type: string
          description: Symbol of the token
        decimals:
          type: integer
          format: uint8
          description: Number of decimals the token uses
examples:
  - name: zks_getConfirmedTokens example
    params:
      - name: From token ID
        value: 1
      - name: Limit
        value: 3
    result:
      name: Confirmed tokens
      value:
        - l1Address: '0xb6ed7644c69416d67b522e20bc294a9a9b405b31'
          l2Address: '0xfea352c0d005a1e4ac7e092ef14fca18b8e6c8fd'
          name: 0xBitcoin Token
          symbol: 0xBTC
          decimals: 8
```
