GET
/
v1
/
apiLogs
import { AvaCloudSDK } from "@avalabs/avacloud-sdk";

const avaCloudSDK = new AvaCloudSDK({
  chainId: "43114",
  network: "mainnet",
});

async function run() {
  const result = await avaCloudSDK.data.usageMetrics.getApiLogs({
    startTimestamp: 1698100000,
    endTimestamp: 1698300000,
  });

  for await (const page of result) {
    // Handle the page
    console.log(page);
  }
}

run();
{
  "nextPageToken": "<string>",
  "orgId": "<string>",
  "logs": [
    {
      "orgId": "<string>",
      "logId": "<string>",
      "eventTimestamp": 123,
      "apiKeyId": "<string>",
      "apiKeyAlias": "<string>",
      "hostRegion": "<string>",
      "requestType": "rpc",
      "requestPath": "<string>",
      "apiCreditsConsumed": 123,
      "requestDurationMsecs": 123,
      "responseCode": 123,
      "chainId": "<string>",
      "rpcMethod": "<string>",
      "metadata": {
        "ipAddress": "<string>",
        "host": "<string>",
        "userAgent": "<string>"
      }
    }
  ]
}

Authorizations

x-glacier-api-key
string
header
required

Api keys provide higher access to rate limits. To obtain an api key, sign up for an account at https://avacloud.io/.

Query Parameters

orgId
string

Organization ID to fetch usage metrics for

startTimestamp
integer

The start time of the range as a UNIX timestamp. The requested start time will be rounded down to 0:00 UTC of the day.

Required range: x > 0
endTimestamp
integer

The end time of the range as a UNIX timestamp. The requested end time will be rounded down to 0:00 UTC of the day.

Required range: x > 0
chainId
string

Filter data by chain ID.

responseCode
string

Filter data by response status code.

requestType
enum<string>

Filter data by request type.

Available options:
data,
rpc
apiKeyId
string

Filter data by API key ID.

requestPath
string

Filter data by request path.

pageToken
string

A page token, received from a previous list call. Provide this to retrieve the subsequent page.

pageSize
integer
default:
10

The maximum number of items to return.

Required range: 1 < x < 100

Response

200
application/json
Successful response
orgId
string
required

The organization id of the request.

logs
object[]
required

An array of logs representing the requests made by clients.

nextPageToken
string

A token, which can be sent as pageToken to retrieve the next page. If this field is omitted or empty, there are no subsequent pages.