Skip to content
Start here

Get current aggregated analytics

client.spectrum.analytics.aggregates.currents.get(CurrentGetParams { zone_id, appID, colo_name } params, RequestOptionsoptions?): CurrentGetResponse { appID, bytesEgress, bytesIngress, 2 more }
GET/zones/{zone_id}/spectrum/analytics/aggregate/current

Retrieves analytics aggregated from the last minute of usage on Spectrum applications underneath a given zone.

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
Analytics Read
ParametersExpand Collapse
params: CurrentGetParams { zone_id, appID, colo_name }
zone_id: string

Path param: Identifier.

maxLength32
appID?: string

Query param: Comma-delimited list of Spectrum Application Id(s). If provided, the response will be limited to Spectrum Application Id(s) that match.

colo_name?: string

Query param: Co-location identifier.

maxLength3
ReturnsExpand Collapse
CurrentGetResponse = Array<CurrentGetResponseItem>
appID: string

Application identifier.

maxLength32
bytesEgress: number

Number of bytes sent

bytesIngress: number

Number of bytes received

connections: number

Number of connections

durationAvg: number

Average duration of connections

Get current aggregated analytics

import Cloudflare from 'cloudflare';

const client = new Cloudflare({
  apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted
});

const currents = await client.spectrum.analytics.aggregates.currents.get({
  zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
});

console.log(currents);
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": [
    {
      "appID": "023e105f4ecef8ad9ca31a8372d0c353",
      "bytesEgress": 0,
      "bytesIngress": 0,
      "connections": 0,
      "durationAvg": 0
    }
  ]
}
Returns Examples
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": [
    {
      "appID": "023e105f4ecef8ad9ca31a8372d0c353",
      "bytesEgress": 0,
      "bytesIngress": 0,
      "connections": 0,
      "durationAvg": 0
    }
  ]
}