Ava Labs Data API Usage Metrics API
Usage metrics and logs for the Data API.
Usage metrics and logs for the Data API.
openapi: 3.1.0
info:
title: Data AVAX Supply Data API Usage Metrics API
description: The Data API provides web3 application developers with multi-chain data related to Avalanche's primary network, Avalanche subnets, and Ethereum. With Data API, you can easily build products that leverage real-time and historical transaction and transfer history, native and token balances, and various types of token metadata. The API is in Beta and may be subject to change.</br></br>If you have feedback or feature requests for the API, please submit them <a href="https://portal.productboard.com/dndv9ahlkdfye4opdm8ksafi/tabs/4-glacier-api">here</a>. Bug reports can be submitted <a href="https://docs.google.com/forms/d/e/1FAIpQLSeJQrcp7QoNiqozMDKrVJGX5wpU827d3cVTgF8qa7t_J1Pb-g/viewform">here</a>, and any potential security issues can be reported <a href="https://immunefi.com/bounty/avalabs">here</a>.
version: 1.0.0
contact: {}
servers:
- url: https://glacier-api.avax.network
security:
- apiKey: []
- {}
tags:
- name: Data API Usage Metrics
description: Usage metrics and logs for the Data API.
paths:
/v1/apiUsageMetrics:
get:
operationId: getApiUsageMetrics
x-speakeasy-name-override: getUsage
x-speakeasy-group: data.usageMetrics
x-execution-weight: xxl
summary: Get usage metrics for the Data API
description: Gets metrics for Data API usage over a specified time interval aggregated at the specified time-duration granularity.
parameters:
- name: orgId
required: false
in: query
description: Organization ID to fetch usage metrics for
schema:
type: string
- name: startTimestamp
required: false
in: query
description: 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.
example: 1739507200
schema:
minimum: 0
type: integer
- name: endTimestamp
required: false
in: query
description: 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.
example: 1739664000
schema:
minimum: 0
type: integer
- name: timeInterval
required: false
in: query
description: Time interval granularity for data aggregation
example: daily
schema:
$ref: '#/components/schemas/TimeIntervalGranularityExtended'
- name: groupBy
required: false
in: query
description: Query param for the criterion used for grouping metrics
example: requestPath
schema:
$ref: '#/components/schemas/UsageMetricsGroupByEnum'
- name: chainId
required: false
in: query
description: Filter data by chain ID.
schema:
type: string
- name: responseCode
required: false
in: query
description: Filter data by response status code.
schema:
type: string
- name: requestType
required: false
in: query
description: Filter data by request type.
schema:
enum:
- data
- rpc
type: string
- name: apiKeyId
required: false
in: query
description: Filter data by API key ID.
schema:
type: string
- name: requestPath
required: false
in: query
description: Filter data by request path.
schema:
type: string
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/UsageMetricsResponseDTO'
'400':
description: "Bad requests generally mean the client has passed invalid \n or malformed parameters. Error messages in the response could help in \n evaluating the error."
content:
application/json:
schema:
$ref: '#/components/schemas/BadRequest'
'401':
description: "When a client attempts to access resources that require \n authorization credentials but the client lacks proper authentication \n in the request, the server responds with 401."
content:
application/json:
schema:
$ref: '#/components/schemas/Unauthorized'
'403':
description: "When a client attempts to access resources with valid\n credentials but doesn't have the privilege to perform that action, \n the server responds with 403."
content:
application/json:
schema:
$ref: '#/components/schemas/Forbidden'
'404':
description: "The error is mostly returned when the client requests\n with either mistyped URL, or the passed resource is moved or deleted, \n or the resource doesn't exist."
content:
application/json:
schema:
$ref: '#/components/schemas/NotFound'
'429':
description: "This error is returned when the client has sent too many,\n and has hit the rate limit."
content:
application/json:
schema:
$ref: '#/components/schemas/TooManyRequests'
'500':
description: "The error is a generic server side error that is \n returned for any uncaught and unexpected issues on the server side. \n This should be very rare, and you may reach out to us if the problem \n persists for a longer duration."
content:
application/json:
schema:
$ref: '#/components/schemas/InternalServerError'
'502':
description: "This is an internal error indicating invalid response \n received by the client-facing proxy or gateway from the upstream server."
content:
application/json:
schema:
$ref: '#/components/schemas/BadGateway'
'503':
description: "The error is returned for certain routes on a particular\n Subnet. This indicates an internal problem with our Subnet node, and may \n not necessarily mean the Subnet is down or affected."
content:
application/json:
schema:
$ref: '#/components/schemas/ServiceUnavailable'
tags:
- Data API Usage Metrics
x-codeSamples:
- lang: javascript
label: JavaScript
source: "import { Avalanche } from \"@avalanche-sdk/chainkit\";\n\nconst avalanche = new Avalanche();\n\nasync function run() {\n const result = await avalanche.data.usageMetrics.getUsage({\n startTimestamp: 1739507200,\n endTimestamp: 1739664000,\n timeInterval: \"daily\",\n groupBy: \"requestPath\",\n });\n\n console.log(result);\n}\n\nrun();"
/v1/apiLogs:
get:
operationId: getApiLogs
x-speakeasy-name-override: getLogs
x-speakeasy-pagination:
type: cursor
inputs:
- name: pageToken
in: parameters
type: cursor
outputs:
nextCursor: $.nextPageToken
x-speakeasy-group: data.usageMetrics
x-execution-weight: xxl
summary: Get logs for requests made by client
description: Gets logs for requests made by client over a specified time interval for a specific organization.
parameters:
- name: orgId
required: false
in: query
description: Organization ID to fetch usage metrics for
schema:
type: string
- name: startTimestamp
required: false
in: query
description: 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.
example: 1739507200
schema:
minimum: 0
type: integer
- name: endTimestamp
required: false
in: query
description: 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.
example: 1739664000
schema:
minimum: 0
type: integer
- name: chainId
required: false
in: query
description: Filter data by chain ID.
schema:
type: string
- name: responseCode
required: false
in: query
description: Filter data by response status code.
schema:
type: string
- name: requestType
required: false
in: query
description: Filter data by request type.
schema:
enum:
- data
- rpc
type: string
- name: apiKeyId
required: false
in: query
description: Filter data by API key ID.
schema:
type: string
- name: requestPath
required: false
in: query
description: Filter data by request path.
schema:
type: string
- name: pageToken
required: false
in: query
description: A page token, received from a previous list call. Provide this to retrieve the subsequent page.
schema:
type: string
- name: pageSize
required: false
in: query
description: The maximum number of items to return.
schema:
minimum: 1
maximum: 100
default: 10
type: integer
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/LogsResponseDTO'
'400':
description: "Bad requests generally mean the client has passed invalid \n or malformed parameters. Error messages in the response could help in \n evaluating the error."
content:
application/json:
schema:
$ref: '#/components/schemas/BadRequest'
'401':
description: "When a client attempts to access resources that require \n authorization credentials but the client lacks proper authentication \n in the request, the server responds with 401."
content:
application/json:
schema:
$ref: '#/components/schemas/Unauthorized'
'403':
description: "When a client attempts to access resources with valid\n credentials but doesn't have the privilege to perform that action, \n the server responds with 403."
content:
application/json:
schema:
$ref: '#/components/schemas/Forbidden'
'404':
description: "The error is mostly returned when the client requests\n with either mistyped URL, or the passed resource is moved or deleted, \n or the resource doesn't exist."
content:
application/json:
schema:
$ref: '#/components/schemas/NotFound'
'429':
description: "This error is returned when the client has sent too many,\n and has hit the rate limit."
content:
application/json:
schema:
$ref: '#/components/schemas/TooManyRequests'
'500':
description: "The error is a generic server side error that is \n returned for any uncaught and unexpected issues on the server side. \n This should be very rare, and you may reach out to us if the problem \n persists for a longer duration."
content:
application/json:
schema:
$ref: '#/components/schemas/InternalServerError'
'502':
description: "This is an internal error indicating invalid response \n received by the client-facing proxy or gateway from the upstream server."
content:
application/json:
schema:
$ref: '#/components/schemas/BadGateway'
'503':
description: "The error is returned for certain routes on a particular\n Subnet. This indicates an internal problem with our Subnet node, and may \n not necessarily mean the Subnet is down or affected."
content:
application/json:
schema:
$ref: '#/components/schemas/ServiceUnavailable'
tags:
- Data API Usage Metrics
x-codeSamples:
- lang: javascript
label: JavaScript
source: "import { Avalanche } from \"@avalanche-sdk/chainkit\";\n\nconst avalanche = new Avalanche();\n\nasync function run() {\n const result = await avalanche.data.usageMetrics.getLogs({\n startTimestamp: 1739507200,\n endTimestamp: 1739664000,\n });\n\n for await (const page of result) {\n console.log(page);\n }\n}\n\nrun();"
/v1/subnetRpcUsageMetrics:
get:
operationId: getSubnetRpcUsageMetrics
x-speakeasy-name-override: getSubnetRpcUsage
x-speakeasy-group: data.usageMetrics
x-execution-weight: xxl
summary: Get usage metrics for the Subnet RPC
description: Gets metrics for public Subnet RPC usage over a specified time interval aggregated at the specified time-duration granularity.
parameters:
- name: timeInterval
required: false
in: query
description: "Time interval granularity for data aggregation for subnet\n rpc metrics"
example: daily
schema:
$ref: '#/components/schemas/SubnetRpcTimeIntervalGranularity'
- name: startTimestamp
required: false
in: query
description: 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.
example: 1739507200
schema:
minimum: 0
type: integer
- name: endTimestamp
required: false
in: query
description: 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.
example: 1739664000
schema:
minimum: 0
type: integer
- name: groupBy
required: false
in: query
example: rpcMethod
description: Query param for the criterion used for grouping metrics
schema:
$ref: '#/components/schemas/RpcUsageMetricsGroupByEnum'
- name: chainId
required: false
in: query
description: Filter data by chain ID.
schema:
type: string
- name: responseCode
required: false
in: query
description: Filter data by response status code.
schema:
type: string
- name: rpcMethod
required: false
in: query
description: Filter data by RPC method.
schema:
type: string
- name: rlBypassApiToken
required: false
in: query
description: Filter data by Rl Bypass API Token.
schema:
type: string
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/SubnetRpcUsageMetricsResponseDTO'
'400':
description: "Bad requests generally mean the client has passed invalid \n or malformed parameters. Error messages in the response could help in \n evaluating the error."
content:
application/json:
schema:
$ref: '#/components/schemas/BadRequest'
'401':
description: "When a client attempts to access resources that require \n authorization credentials but the client lacks proper authentication \n in the request, the server responds with 401."
content:
application/json:
schema:
$ref: '#/components/schemas/Unauthorized'
'403':
description: "When a client attempts to access resources with valid\n credentials but doesn't have the privilege to perform that action, \n the server responds with 403."
content:
application/json:
schema:
$ref: '#/components/schemas/Forbidden'
'404':
description: "The error is mostly returned when the client requests\n with either mistyped URL, or the passed resource is moved or deleted, \n or the resource doesn't exist."
content:
application/json:
schema:
$ref: '#/components/schemas/NotFound'
'429':
description: "This error is returned when the client has sent too many,\n and has hit the rate limit."
content:
application/json:
schema:
$ref: '#/components/schemas/TooManyRequests'
'500':
description: "The error is a generic server side error that is \n returned for any uncaught and unexpected issues on the server side. \n This should be very rare, and you may reach out to us if the problem \n persists for a longer duration."
content:
application/json:
schema:
$ref: '#/components/schemas/InternalServerError'
'502':
description: "This is an internal error indicating invalid response \n received by the client-facing proxy or gateway from the upstream server."
content:
application/json:
schema:
$ref: '#/components/schemas/BadGateway'
'503':
description: "The error is returned for certain routes on a particular\n Subnet. This indicates an internal problem with our Subnet node, and may \n not necessarily mean the Subnet is down or affected."
content:
application/json:
schema:
$ref: '#/components/schemas/ServiceUnavailable'
tags:
- Data API Usage Metrics
x-codeSamples:
- lang: javascript
label: JavaScript
source: "import { Avalanche } from \"@avalanche-sdk/chainkit\";\n\nconst avalanche = new Avalanche();\n\nasync function run() {\n const result = await avalanche.data.usageMetrics.getSubnetRpcUsage({\n timeInterval: \"daily\",\n startTimestamp: 1739507200,\n endTimestamp: 1739664000,\n groupBy: \"rpcMethod\",\n });\n\n console.log(result);\n}\n\nrun();"
/v1/rpcUsageMetrics:
get:
operationId: getRpcUsageMetrics
x-speakeasy-group: data.usageMetrics
x-execution-weight: xxl
description: '**[Deprecated]** Gets metrics for public Subnet RPC usage over a specified time interval aggregated at the specified time-duration granularity.
⚠️ **This operation will be removed in a future release. Please use /v1/subnetRpcUsageMetrics endpoint instead**.'
deprecated: true
parameters:
- name: timeInterval
required: false
in: query
description: "Time interval granularity for data aggregation for subnet\n rpc metrics"
example: daily
schema:
$ref: '#/components/schemas/SubnetRpcTimeIntervalGranularity'
- name: startTimestamp
required: false
in: query
description: 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.
example: 1739507200
schema:
minimum: 0
type: integer
- name: endTimestamp
required: false
in: query
description: 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.
example: 1739664000
schema:
minimum: 0
type: integer
- name: groupBy
required: false
in: query
example: rpcMethod
description: Query param for the criterion used for grouping metrics
schema:
$ref: '#/components/schemas/RpcUsageMetricsGroupByEnum'
- name: chainId
required: false
in: query
description: Filter data by chain ID.
schema:
type: string
- name: responseCode
required: false
in: query
description: Filter data by response status code.
schema:
type: string
- name: rpcMethod
required: false
in: query
description: Filter data by RPC method.
schema:
type: string
- name: rlBypassApiToken
required: false
in: query
description: Filter data by Rl Bypass API Token.
schema:
type: string
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/SubnetRpcUsageMetricsResponseDTO'
'400':
description: "Bad requests generally mean the client has passed invalid \n or malformed parameters. Error messages in the response could help in \n evaluating the error."
content:
application/json:
schema:
$ref: '#/components/schemas/BadRequest'
'401':
description: "When a client attempts to access resources that require \n authorization credentials but the client lacks proper authentication \n in the request, the server responds with 401."
content:
application/json:
schema:
$ref: '#/components/schemas/Unauthorized'
'403':
description: "When a client attempts to access resources with valid\n credentials but doesn't have the privilege to perform that action, \n the server responds with 403."
content:
application/json:
schema:
$ref: '#/components/schemas/Forbidden'
'404':
description: "The error is mostly returned when the client requests\n with either mistyped URL, or the passed resource is moved or deleted, \n or the resource doesn't exist."
content:
application/json:
schema:
$ref: '#/components/schemas/NotFound'
'429':
description: "This error is returned when the client has sent too many,\n and has hit the rate limit."
content:
application/json:
schema:
$ref: '#/components/schemas/TooManyRequests'
'500':
description: "The error is a generic server side error that is \n returned for any uncaught and unexpected issues on the server side. \n This should be very rare, and you may reach out to us if the problem \n persists for a longer duration."
content:
application/json:
schema:
$ref: '#/components/schemas/InternalServerError'
'502':
description: "This is an internal error indicating invalid response \n received by the client-facing proxy or gateway from the upstream server."
content:
application/json:
schema:
$ref: '#/components/schemas/BadGateway'
'503':
description: "The error is returned for certain routes on a particular\n Subnet. This indicates an internal problem with our Subnet node, and may \n not necessarily mean the Subnet is down or affected."
content:
application/json:
schema:
$ref: '#/components/schemas/ServiceUnavailable'
tags:
- Data API Usage Metrics
/v1/primaryNetworkRpcUsageMetrics:
get:
operationId: getPrimaryNetworkRpcUsageMetrics
x-speakeasy-name-override: getPrimaryNetworkRpcUsage
x-speakeasy-ignore: true
x-speakeasy-group: data.usageMetrics
x-execution-weight: xxl
summary: Get usage metrics for the Primary Network RPC
description: Gets metrics for public Primary Network RPC usage over a specified time interval aggregated at the specified time-duration granularity.
parameters:
- name: timeInterval
required: false
in: query
description: "Time interval granularity for data aggregation for subnet\n rpc metrics"
example: daily
schema:
$ref: '#/components/schemas/PrimaryNetworkRpcTimeIntervalGranularity'
- name: startTimestamp
required: false
in: query
description: 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.
example: 1739507200
schema:
minimum: 0
type: integer
- name: endTimestamp
required: false
in: query
description: 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.
example: 1739664000
schema:
minimum: 0
type: integer
- name: groupBy
required: false
in: query
example: rpcMethod
description: Query param for the criterion used for grouping metrics
schema:
$ref: '#/components/schemas/PrimaryNetworkRpcMetricsGroupByEnum'
- name: responseCode
required: false
in: query
description: Filter data by response status code.
schema:
type: string
- name: requestPath
required: false
in: query
description: Filter data by request path.
schema:
type: string
- name: country
required: false
in: query
description: Filter data by Country. Input must be a valid ISO 3166-1 alpha-2 country code. "XX" - Represents clients without country code data. "T1" - Represents clients using the Tor network.
schema:
type: string
- name: continent
required: false
in: query
description: Filter data by Continent. Input must be a valid ISO 3166-1 alpha-2 continent code.
schema:
type: string
- name: userAgent
required: false
in: query
description: Filter data by User Agent.
schema:
type: string
- name: rpcMethod
required: false
in: query
description: Filter data by RPC method.
schema:
type: string
- name: network
required: true
in: query
description: Either mainnet or testnet/fuji.
example: mainnet
schema:
$ref: '#/components/schemas/Network'
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/PrimaryNetworkRpcUsageMetricsResponseDTO'
'400':
description: "Bad requests generally mean the client has passed invalid \n or malformed parameters. Error messages in the response could help in \n evaluating the error."
content:
application/json:
schema:
$ref: '#/components/schemas/BadRequest'
'401':
description: "When a client attempts to access resources that require \n authorization credentials but the client lacks proper authentication \n in the request, the server responds with 401."
content:
application/json:
schema:
$ref: '#/components/schemas/Unauthorized'
'403':
description: "When a client attempts to access resources with valid\n credentials but doesn't have the privilege to perform that action, \n the server responds with 403."
content:
application/json:
schema:
$ref: '#/components/schemas/Forbidden'
'404':
description: "The error is mostly returned when the client requests\n with either mistyped URL, or the passed resource is moved or deleted, \n or the resource doesn't exist."
content:
application/json:
schema:
$ref: '#/components/schemas/NotFound'
'429':
description: "This error is returned when the client has sent too many,\n and has hit the rate limit."
content:
application/json:
schema:
$ref: '#/components/schemas/TooManyRequests'
'500':
description: "The error is a generic server side error that is \n returned for any uncaught and unexpected issues on the server side. \n This should be very rare, and you may reach out to us if the problem \n persists for a longer duration."
content:
application/json:
schema:
$ref: '#/components/schemas/InternalServerError'
'502':
description: "This is an internal error indicating invalid response \n received by the client-facing proxy or gateway from the upstream server."
content:
application/json:
schema:
$ref: '#/components/schemas/BadGateway'
'503':
description: "The error is returned for certain routes on a particular\n Subnet. This indicates an internal problem with our Subnet node, and may \n not necessarily mean the Subnet is down or affected."
content:
application/json:
schema:
$ref: '#/components/schemas/ServiceUnavailable'
tags:
- Data API Usage Metrics
components:
schemas:
BadRequest:
type: object
properties:
message:
description: The error message describing the reason for the exception
oneOf:
- type: string
- type: array
items:
type: string
statusCode:
type: number
description: The HTTP status code of the response
examples:
- 400
error:
type: string
description: The type of error
examples:
- Bad Request
required:
- message
- statusCode
- error
LogsFormat:
type: object
properties:
orgId:
type: string
description: The organization id of the request.
logId:
type: string
description: The unique log id of the request.
eventTimestamp:
type: number
description: The timestamp of the request.
apiKeyId:
type: string
description: The apiKey used to make the request.
apiKeyAlias:
type: string
description: The alias of the apiKey used to make the request.
hostRegion:
type: string
description: The region of the host for the request made by the client.
requestType:
examples:
- rpc
$ref: '#/components/schemas/RequestType'
requestPath:
type: string
description: The path of the request made by the client.
apiCreditsConsumed:
type: number
description: The number of API credits consumed by the request.
requestDurationMsecs:
type: number
description: The duration of the request in milliseconds.
responseCode:
type: number
description: The response code of the request.
chainId:
type: string
description: The chain id of the request.
rpcMethod:
type: string
description: The rpc method of the request.
metadata:
description: The metadata of the request.
allOf:
- $ref: '#/components/schemas/LogsFormatMetadata'
required:
- orgId
- logId
- eventTimestamp
- apiKeyId
- apiKeyAlias
- hostRegion
- requestType
- requestPath
- apiCreditsConsumed
- requestDurationMsecs
- responseCode
- metadata
RequestType:
type: string
description: The type of request made by the client.
enum:
- data
- rpc
PrimaryNetworkRpcUsageMetricsResponseDTO:
type: object
properties:
aggregateDuration:
type: string
description: Duration in which the metrics value is aggregated
metrics:
description: Metrics values
type: array
items:
$ref: '#/components/schemas/RpcMetrics'
network:
type: string
description: Network type for which the metrics are aggregated
enum:
- mainnet
- testnet
# --- truncated at 32 KB (44 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/ava-labs/refs/heads/main/openapi/ava-labs-data-api-usage-metrics-api-openapi.yml