List core web vital metrics trend
speed.pages.trend(strurl, PageTrendParams**kwargs) -> Trend
GET/zones/{zone_id}/speed_api/pages/{url}/trend
Lists the core web vital metrics trend over time for a specific page.
Security
API Token
The preferred authorization scheme for interacting with the Cloudflare API. Create a token.
Example:
API Email + API Key
The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.
Example:
The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.
Example:
Accepted Permissions (at least one required)
Parameters
List core web vital metrics trend
import os
from datetime import datetime
from cloudflare import Cloudflare
client = Cloudflare(
api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted
)
trend = client.speed.pages.trend(
url="example.com",
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
device_type="DESKTOP",
metrics="performanceScore,ttfb,fcp,si,lcp,tti,tbt,cls",
region="us-central1",
start=datetime.fromisoformat("2014-01-01T05:20:00.12345"),
tz="tz",
)
print(trend.cls){
"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": {
"cls": [
0
],
"fcp": [
0
],
"lcp": [
0
],
"performanceScore": [
0
],
"si": [
0
],
"tbt": [
0
],
"ttfb": [
0
],
"tti": [
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": {
"cls": [
0
],
"fcp": [
0
],
"lcp": [
0
],
"performanceScore": [
0
],
"si": [
0
],
"tbt": [
0
],
"ttfb": [
0
],
"tti": [
0
]
}
}