GraphQL Analytics API (3)

Last updated Apr 21, 2026 Privacy Proxy exposes metrics through Cloudflare's GraphQL Analytics API. All metrics are queryable through a single endpoint:

POST https://api.cloudflare.com/client/v4/graphql

Before you begin, you will need:

  • API token — Create a token with Account Analytics read permissions. For more information, refer to our Analytics API token documentation: Configure an Analytics API token.
  • Account ID — Your Cloudflare account ID, passed as accountTag in queries. For more information, refer to Find account and zone IDs.

Making a request

The following example shows how to query your Privacy Proxy metrics daily request volume using curl. Replace the placeholder values with your own.

curl https://api.cloudflare.com/client/v4/graphql \
  --header "Authorization: Bearer <API_TOKEN>" \
  --header "Content-Type: application/json" \
  --data '{
    "query": "query DailyRequestVolume($accountTag: String!, $startDate: Date!, $endDate: Date!) { viewer { accounts(filter: { accountTag: $accountTag }) { privacyProxyRequestMetricsAdaptiveGroups(filter: { date_geq: $startDate, date_leq: $endDate }, limit: 10000, orderBy: [date_ASC]) { count dimensions { date } } } } }",
    "variables": {
      "accountTag": "<YOUR_ACCOUNT_TAG>",
      "startDate": "2026-04-04",
      "endDate": "2026-04-06"
    }
  }'

Available nodes

Four GraphQL nodes are available. All four return aggregate data only — no raw per-connection records are exposed.

  1. privacyProxyRequestMetricsAdaptiveGroups — Query aggregate request volume and error rates, filterable by time, location, endpoint, status code, and proxy status dimensions.
  2. privacyProxyIngressConnMetricsAdaptiveGroups — Query client-to-proxy connection counts, bytes transferred, and latency percentiles, filterable by time, location, endpoint, and transport dimensions.
  3. privacyProxyEgressConnMetricsAdaptiveGroups — Query proxy-to-origin connection counts, bytes transferred, and latency percentiles, filterable by time, location, endpoint, and transport dimensions.
  4. privacyProxyAuthMetricsAdaptiveGroups — Query authentication attempt counts, filterable by time, location, endpoint, auth method, and auth result dimensions.

Adaptive sampling

Requests are sampled.


Schema

<details>

<summary>

Metrics

</summary>

<details>

<summary>

Sum fields

</summary>

Field Type Description Node
<code>bytesSentToClient</code> <code>uint64</code> Total bytes sent from the proxy back to the client. Ingress connection
<code>bytesRecvdFromClient</code> <code>uint64</code> Total bytes received by the proxy from the client. Ingress connection
<code>bytesSentToOrigin</code> <code>uint64</code> Total bytes sent from the proxy to the upstream origin. Egress connection
<code>bytesRecvdFromOrigin</code> <code>uint64</code> Total bytes received by the proxy from the upstream origin. Egress connection
<code>packetsSentToClient</code> <code>uint64</code> Total packets sent from the proxy back to the client. Ingress connection
<code>packetsRecvdFromClient</code> <code>uint64</code> Total packets received by the proxy from the client. Ingress connection
<code>packetsSentToOrigin</code> <code>uint64</code> Total packets sent from the proxy to the upstream origin. Egress connection
<code>packetsRecvdFromOrigin</code> <code>uint64</code> Total packets received by the proxy from the upstream origin. Egress connection

</details>

<details>

<summary>

Count fields

</summary>

All four nodes expose a <code>count</code> field that returns the total number of sampled events (requests, connections, or auth attempts) matching the query filter.

</details>

<details>

<summary>

Quantile fields

</summary>

Field Type Description Node
<code>durationMsP50</code> <code>float64</code> Median lifetime of a connection, in milliseconds. Ingress and egress connection
<code>durationMsP95</code> <code>float64</code> 95th percentile connection lifetime, in milliseconds. Ingress and egress connection
<code>durationMsP99</code> <code>float64</code> 99th percentile connection lifetime, in milliseconds. Ingress and egress connection
<code>handshakeDurationUsP50</code> <code>float64</code> Median TCP+TLS/QUIC handshake time, in microseconds. Ingress and egress connection
<code>handshakeDurationUsP95</code> <code>float64</code> 95th percentile handshake time, in microseconds. Ingress and egress connection
<code>handshakeDurationUsP99</code> <code>float64</code> 99th percentile handshake time, in microseconds. Ingress and egress connection
<code>connectRequestHandlingDurationUsP50</code> <code>float64</code> Median time to handle a CONNECT request, in microseconds. Not yet available. Request
<code>connectRequestHandlingDurationUsP95</code> <code>float64</code> 95th percentile time to handle a CONNECT request, in microseconds. Not yet available. Request
<code>connectRequestHandlingDurationUsP99</code> <code>float64</code> 99th percentile time to handle a CONNECT request, in microseconds. Not yet available. Request
<code>connectTunnelSetupDurationUsP50</code> <code>float64</code> Median time to establish a tunnel after receiving a CONNECT request, in microseconds. Not yet available. Request
<code>connectTunnelSetupDurationUsP95</code> <code>float64</code> 95th percentile tunnel setup time, in microseconds. Not yet available. Request
<code>connectTunnelSetupDurationUsP99</code> <code>float64</code> 99th percentile tunnel setup time, in microseconds. Not yet available. Request

</details>

</details>

<details>

<summary>

Dimensions

</summary>

<details>

<summary>

All nodes

</summary>

Field Type Description
<code>date</code> <code>Date</code> Calendar date (day granularity).
<code>datetimeMinute</code> <code>Time</code> Timestamp truncated to the minute.
<code>datetimeFiveMinutes</code> <code>Time</code> Timestamp truncated to five-minute intervals.
<code>datetimeFifteenMinutes</code> <code>Time</code> Timestamp truncated to fifteen-minute intervals.
<code>datetimeHour</code> <code>Time</code> Timestamp truncated to the hour.
<code>coloCode</code> <code>string</code> Cloudflare data center that handled the request.
<code>endpoint</code> <code>string</code> The appId that generated traffic.

All timestamp dimensions refer to the end of each connection or request, not the start.

</details>

<details>

<summary>

Request node only

</summary>

Field Type Description
<code>statusCode</code> <code>uint16</code> HTTP status code returned by the proxy to the client.
<code>proxyStatus</code> <code>string</code> Proxy-level error classification. <code>null</code> when no proxy-level error occurred. Refer to <a href="https://developers.cloudflare.com/privacy-proxy/reference/proxy-status/">proxy status reference</a> for possible values.
<code>tunnelType</code> <code>string</code> Tunnel protocol used (<code>connect-tcp</code>, <code>connect-udp</code>, <code>connect-ip</code>). Not yet available.

</details>

<details>

<summary>

Ingress connection node only

</summary>

Field Type Description
<code>transport</code> <code>string</code> Transport protocol on the client-to-proxy connection (<code>tcp</code>, <code>quic</code>).
<code>tlsVersion</code> <code>string</code> TLS version negotiated on the client-to-proxy connection. Not yet available.

</details>

<details>

<summary>

Egress connection node only

</summary>

Field Type Description
<code>transport</code> <code>string</code> Transport protocol on the proxy-to-origin connection (<code>tcp</code>, <code>quic</code>).

</details>

<details>

<summary>

Auth node only

</summary>

Field Type Description
<code>authMethod</code> <code>string</code> Authentication method used (for example, <code>Token</code>, <code>Psk</code>).
<code>authResult</code> <code>string</code> Authentication outcome (<code>success</code>, <code>failure</code>).

</details>

</details>

<details>

<summary>

Arguments

</summary>

All four nodes share the same argument signature.

  • <code>filter</code> required — Filters your data. <code>accountTag</code> is always required inside the filter.
  • <code>limit</code> optional — Maximum number of records to return.
  • <code>orderBy</code> optional — Sort order for results.

</details>


Sample queries

<details>

<summary>

privacyProxyRequestMetricsAdaptiveGroups node

</summary>

<details>

<summary>

Request volume overview

</summary>

Get a high-level view of daily request volume over a date range.

query DailyRequestVolume(
  $accountTag: String!
  $startDate: Date!
  $endDate: Date!
) {
  viewer {
    accounts(filter: { accountTag: $accountTag }) {
      privacyProxyRequestMetricsAdaptiveGroups(
        filter: {
          date_geq: $startDate
          date_leq: $endDate
        }
        limit: 10000
        orderBy: [date_ASC]
      ) {
        count
        dimensions {
          date
        }
      }
    }
  }
}
{
  "accountTag": "<YOUR_ACCOUNT_TAG>",
  "startDate": "2026-04-04",
  "endDate": "2026-04-06"
}

</details>

<details>

<summary>

Error breakdown by status code and proxy status

</summary>

Identify which HTTP status codes and proxy-level errors are occurring to pinpoint the source of failures.

query ErrorBreakdown(
  $accountTag: String!
  $start: Time!
  $end: Time!
) {
  viewer {
    accounts(filter: { accountTag: $accountTag }) {
      privacyProxyRequestMetricsAdaptiveGroups(
        filter: {
          datetimeFifteenMinutes_geq: $start
          datetimeFifteenMinutes_leq: $end
          statusCode_geq: 400
        }
        limit: 10000
        orderBy: [datetimeFifteenMinutes_ASC]
      ) {
        count
        dimensions {
          datetimeFifteenMinutes
          statusCode
          proxyStatus
        }
      }
    }
  }
}
{
  "accountTag": "<YOUR_ACCOUNT_TAG>",
  "start": "2026-04-04T00:00:00Z",
  "end": "2026-04-06T23:59:59Z"
}

</details>

<details>

<summary>

Top proxy errors by frequency

</summary>

Rank the most frequent proxy error types to prioritize investigation.

query TopProxyErrors(
  $accountTag: String!
  $start: Date!
  $end: Date!
) {
  viewer {
    accounts(filter: { accountTag: $accountTag }) {
      privacyProxyRequestMetricsAdaptiveGroups(
        filter: {
          date_geq: $start
          date_leq: $end
          proxyStatus_neq: ""
        }
        limit: 10000
        orderBy: [count_DESC]
      ) {
        count
        dimensions {
          proxyStatus
          statusCode
        }
      }
    }
  }
}
{
  "accountTag": "<YOUR_ACCOUNT_TAG>",
  "start": "2026-04-04",
  "end": "2026-04-06"
}