> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.galleon8.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.galleon8.com/_mcp/server.

# ankr_getLogs

POST https://advanced-api-docs-proxy.galleon8.workers.dev
Content-Type: application/json

Retrieves historical data for the specified range of blocks.

Reference: https://docs.galleon8.com/api-reference/advanced-api/api-endpoints/query-api/ankr-get-logs

## Request

### Body (application/json)

This endpoint expects an object.

- `address` (ankr_getLogs_Param_address, optional) — Contract address or a list of addresses from which logs should originate.
- `blockchain` (BlockchainSelector, optional, nullable) — Name of the blockchain or list of blockchain names. Single: eth. Multiple: [eth, bsc, fantom, avalanche, polygon, arbitrum, syscoin, optimism, eth_goerli, polygon_mumbai, avalanche_fuji]. All chains: empty value.
- `decodeLogs` (boolean, optional) — Decode logs (true) or not (false).
- `descOrder` (boolean, optional) — Sorting order. Descending (true) or ascending (false).
- `fromBlock` (BlockRangeValue, optional) — Number of the first block in a range. Integer or string (hex value or earliest).
- `fromTimestamp` (integer, optional) — Beginning of a time period. UNIX timestamp.
- `pageSize` (integer, optional) — Number of entries per page. Max value — 10000, default value — 1000.
- `pageToken` (string, optional) — Current page token for pagination.
- `toBlock` (BlockRangeValue, optional) — Number of the last block in a range. Integer or string (hex value or latest).
- `toTimestamp` (integer, optional) — End of a time period. UNIX timestamp.
- `topics` (list of AnkrGetLogsParamTopicsItems, optional) — An array of DATA topics.

## Response

### 200

Result returned by ankr_getLogs.

- `logs` (list of AnkrGetLogsResultLogsItems, required, nullable)
- `nextPageToken` (string, optional) — Next page token for pagination.

## Types

### ankr_getLogs_Param_address

### BlockchainSelector

A single blockchain identifier or an array of blockchain identifiers.

### BlockRangeValue

Block number, hex block number, latest, or earliest.

### AnkrGetLogsParamTopicsItems

### AnkrGetLogsResultLogsItems

- `address` (string, required) — Blockchain address, ENS name, or contract address where supported.
- `blockHash` (string, required) — Hash of the block that included the log. Null when pending.
- `blockNumber` (string, required) — Block number where the log was included. Null when pending.
- `blockchain` (enum, required) — Supported blockchain identifier.
  - Allowed values: `arbitrum`, `avalanche`, `avalanche_fuji`, `bsc`, `eth`, `eth_goerli`, `fantom`, `optimism`, `polygon`, `polygon_mumbai`, `polygon_zkevm`, `syscoin`
- `data` (string, required) — One or more 32B non-indexed arguments of the log.
- `logIndex` (string, required) — Index position of the log in the block. Null when pending.
- `removed` (boolean, required) — Status of the log. True when the log was removed due to a chain reorganization, and false if it's a valid log.
- `topics` (list of string, required, nullable)
- `transactionHash` (string, required) — Hash of the transaction that created the log. Null when pending.
- `transactionIndex` (string, required) — Index position of the transaction that created the log. Null when pending.
- `event` (AnkrGetLogsResultLogsItemsEvent, optional) — Metadata of the log.

### AnkrGetLogsResultLogsItemsEvent

Metadata of the log.

- `anonymous` (boolean, optional) — Anonymous event (true) or not (false).
- `id` (string, optional) — Hash of the event signature.
- `inputs` (list of AnkrGetLogsResultLogsItemsEventInputsItems, optional, nullable)
- `name` (string, optional) — Name of the event.
- `signature` (string, optional) — Signature of the event.
- `string` (string, optional) — String containing signature of the event.
- `verified` (boolean, optional) — Status of the contract. Verified (true) or not verified (false).

### AnkrGetLogsResultLogsItemsEventInputsItems

- `indexed` (boolean, optional) — Indexed event input (true) or non-indexed (false).
- `name` (string, optional) — Name of the input.
- `size` (integer, optional) — Size of the event input.
- `type` (string, optional) — Type of the input.
- `valueDecoded` (string, optional) — Decoded value of the event input (unmarshalled).

## Examples

### ankr_getLogs_from_earliest_to_latest

**Request**

```json
[
  [
    "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
  ],
  "eth",
  false,
  false,
  "earliest",
  null,
  1,
  null,
  "latest",
  null,
  [
    "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
  ]
]
```

**Response**

```json
{
  "jsonrpc": "2.0",
  "id": "1",
  "result": {
    "logs": [
      {
        "address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
        "blockHash": "0x76fe73c4d2a66bb0cba343482521c8cd44f0ef824e97493f3c4f3e5140422ea5",
        "blockNumber": "0xdaf6b4",
        "blockchain": "eth",
        "data": "0x00000000000000000000000000000000000000000000000000787f498b5b22b7",
        "event": {
          "anonymous": false,
          "id": "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
          "inputs": [
            {
              "indexed": true,
              "name": "_from",
              "size": 20,
              "type": "address",
              "valueDecoded": "0xDef1C0ded9bec7F1a1670819833240f027b25EfF"
            },
            {
              "indexed": true,
              "name": "_to",
              "size": 20,
              "type": "address",
              "valueDecoded": "0x3dd49f67E9d5Bc4C5E6634b3F70BfD9dc1b6BD74"
            },
            {
              "indexed": false,
              "name": "_value",
              "size": 256,
              "type": "uint256",
              "valueDecoded": "33916951052624567"
            }
          ],
          "name": "Transfer",
          "signature": "Transfer(address,address,uint256)",
          "string": "event Transfer(address indexed _from, address indexed _to, uint256 _value)",
          "verified": false
        },
        "logIndex": "0x49",
        "removed": false,
        "topics": [
          "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
          "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff",
          "0x0000000000000000000000003dd49f67e9d5bc4c5e6634b3f70bfd9dc1b6bd74"
        ],
        "transactionHash": "0x6f11297b0964a0fb0630e6667093a6c9cee4b383495c94e99becc6b88aed8f14",
        "transactionIndex": "0x3f"
      }
    ]
  }
}
```

**SDK Code**

```python ankr_getLogs_from_earliest_to_latest
import requests

url = "https://advanced-api-docs-proxy.galleon8.workers.dev/"

payload = [["0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"], "eth", False, False, "earliest", None, 1, None, "latest", None, ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]]
headers = {"Content-Type": "application/json"}

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

print(response.json())
```

```javascript ankr_getLogs_from_earliest_to_latest
const url = 'https://advanced-api-docs-proxy.galleon8.workers.dev/';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '[["0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"],"eth",false,false,"earliest",null,1,null,"latest",null,["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]]'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go ankr_getLogs_from_earliest_to_latest
package main

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

func main() {

	url := "https://advanced-api-docs-proxy.galleon8.workers.dev/"

	payload := strings.NewReader("[\n  [\n    \"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\"\n  ],\n  \"eth\",\n  false,\n  false,\n  \"earliest\",\n  null,\n  1,\n  null,\n  \"latest\",\n  null,\n  [\n    \"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef\"\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(res)
	fmt.Println(string(body))

}
```

```ruby ankr_getLogs_from_earliest_to_latest
require 'uri'
require 'net/http'

url = URI("https://advanced-api-docs-proxy.galleon8.workers.dev/")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "[\n  [\n    \"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\"\n  ],\n  \"eth\",\n  false,\n  false,\n  \"earliest\",\n  null,\n  1,\n  null,\n  \"latest\",\n  null,\n  [\n    \"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef\"\n  ]\n]"

response = http.request(request)
puts response.read_body
```

```java ankr_getLogs_from_earliest_to_latest
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://advanced-api-docs-proxy.galleon8.workers.dev/")
  .header("Content-Type", "application/json")
  .body("[\n  [\n    \"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\"\n  ],\n  \"eth\",\n  false,\n  false,\n  \"earliest\",\n  null,\n  1,\n  null,\n  \"latest\",\n  null,\n  [\n    \"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef\"\n  ]\n]")
  .asString();
```

```php ankr_getLogs_from_earliest_to_latest
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://advanced-api-docs-proxy.galleon8.workers.dev/', [
  'body' => '[
  [
    "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
  ],
  "eth",
  false,
  false,
  "earliest",
  null,
  1,
  null,
  "latest",
  null,
  [
    "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
  ]
]',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp ankr_getLogs_from_earliest_to_latest
using RestSharp;

var client = new RestClient("https://advanced-api-docs-proxy.galleon8.workers.dev/");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "[\n  [\n    \"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\"\n  ],\n  \"eth\",\n  false,\n  false,\n  \"earliest\",\n  null,\n  1,\n  null,\n  \"latest\",\n  null,\n  [\n    \"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef\"\n  ]\n]", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift ankr_getLogs_from_earliest_to_latest
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [["0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"], "eth", false, false, "earliest", , 1, , "latest", , ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://advanced-api-docs-proxy.galleon8.workers.dev/")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### ankr_getLogs_with_event_decoding

**Request**

```json
[
  [
    "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
  ],
  "eth",
  true,
  false,
  "0xdaf6b1",
  null,
  1,
  null,
  14350010,
  null,
  [
    "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
    "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff",
    "0x0000000000000000000000003dd49f67e9d5bc4c5e6634b3f70bfd9dc1b6bd74"
  ]
]
```

**SDK Code**

```python ankr_getLogs_with_event_decoding
import requests

url = "https://advanced-api-docs-proxy.galleon8.workers.dev/"

payload = [["0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"], "eth", True, False, "0xdaf6b1", None, 1, None, 14350010, None, ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", "0x0000000000000000000000003dd49f67e9d5bc4c5e6634b3f70bfd9dc1b6bd74"]]
headers = {"Content-Type": "application/json"}

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

print(response.json())
```

```javascript ankr_getLogs_with_event_decoding
const url = 'https://advanced-api-docs-proxy.galleon8.workers.dev/';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '[["0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"],"eth",true,false,"0xdaf6b1",null,1,null,14350010,null,["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff","0x0000000000000000000000003dd49f67e9d5bc4c5e6634b3f70bfd9dc1b6bd74"]]'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go ankr_getLogs_with_event_decoding
package main

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

func main() {

	url := "https://advanced-api-docs-proxy.galleon8.workers.dev/"

	payload := strings.NewReader("[\n  [\n    \"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\"\n  ],\n  \"eth\",\n  true,\n  false,\n  \"0xdaf6b1\",\n  null,\n  1,\n  null,\n  14350010,\n  null,\n  [\n    \"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef\",\n    \"0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff\",\n    \"0x0000000000000000000000003dd49f67e9d5bc4c5e6634b3f70bfd9dc1b6bd74\"\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(res)
	fmt.Println(string(body))

}
```

```ruby ankr_getLogs_with_event_decoding
require 'uri'
require 'net/http'

url = URI("https://advanced-api-docs-proxy.galleon8.workers.dev/")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "[\n  [\n    \"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\"\n  ],\n  \"eth\",\n  true,\n  false,\n  \"0xdaf6b1\",\n  null,\n  1,\n  null,\n  14350010,\n  null,\n  [\n    \"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef\",\n    \"0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff\",\n    \"0x0000000000000000000000003dd49f67e9d5bc4c5e6634b3f70bfd9dc1b6bd74\"\n  ]\n]"

response = http.request(request)
puts response.read_body
```

```java ankr_getLogs_with_event_decoding
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://advanced-api-docs-proxy.galleon8.workers.dev/")
  .header("Content-Type", "application/json")
  .body("[\n  [\n    \"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\"\n  ],\n  \"eth\",\n  true,\n  false,\n  \"0xdaf6b1\",\n  null,\n  1,\n  null,\n  14350010,\n  null,\n  [\n    \"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef\",\n    \"0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff\",\n    \"0x0000000000000000000000003dd49f67e9d5bc4c5e6634b3f70bfd9dc1b6bd74\"\n  ]\n]")
  .asString();
```

```php ankr_getLogs_with_event_decoding
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://advanced-api-docs-proxy.galleon8.workers.dev/', [
  'body' => '[
  [
    "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
  ],
  "eth",
  true,
  false,
  "0xdaf6b1",
  null,
  1,
  null,
  14350010,
  null,
  [
    "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
    "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff",
    "0x0000000000000000000000003dd49f67e9d5bc4c5e6634b3f70bfd9dc1b6bd74"
  ]
]',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp ankr_getLogs_with_event_decoding
using RestSharp;

var client = new RestClient("https://advanced-api-docs-proxy.galleon8.workers.dev/");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "[\n  [\n    \"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\"\n  ],\n  \"eth\",\n  true,\n  false,\n  \"0xdaf6b1\",\n  null,\n  1,\n  null,\n  14350010,\n  null,\n  [\n    \"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef\",\n    \"0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff\",\n    \"0x0000000000000000000000003dd49f67e9d5bc4c5e6634b3f70bfd9dc1b6bd74\"\n  ]\n]", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift ankr_getLogs_with_event_decoding
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [["0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"], "eth", true, false, "0xdaf6b1", , 1, , 14350010, , ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", "0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff", "0x0000000000000000000000003dd49f67e9d5bc4c5e6634b3f70bfd9dc1b6bd74"]] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://advanced-api-docs-proxy.galleon8.workers.dev/")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```