Network logs
Use the REST API to retrieve the network requests Percy made while capturing and rendering a comparison. This is the same data that the Debug panel shows above each snapshot on the Percy dashboard. Use it to find assets that failed to load, such as requests that returned 4xx or 5xx errors, were blocked, or timed out.
Get network logs
Retrieves the network logs for the given comparison_id. Get comparison IDs from the comparisons included in the List snapshots API response. The comparison must be finished. The API returns 403 if the comparison is still processing.
Note: Authentication
This endpoint accepts only your BrowserStack username and access key, passed through HTTP Basic auth. Project tokens aren’t supported. Find your username and access key on the BrowserStack profile page.
Request parameters
cURL request
curl --location 'https://percy.io/api/v1/network-logs?comparison_id=<comparison_id>' \
--header "Authorization: Basic $(echo -n '<username>:<accesskey>' | base64)"
cURL request to list only the failed requests in a comparison
curl --location 'https://percy.io/api/v1/network-logs?comparison_id=<comparison_id>' \
--header "Authorization: Basic $(echo -n '<username>:<accesskey>' | base64)" \
| jq '."network-logs" | to_entries | map(select(.value."status-error"))'
-
comparison_id* String
ID of a finished comparison. Get comparison IDs from the
comparisonsincluded in the List snapshots response.
Response attributes 200 OK JSON
The response is plain JSON and doesn’t follow the JSON:API format. The API returns 200 even when the logs are no longer available. Check the meta object to confirm that the logs are complete. In the response, head refers to the current build and base refers to the baseline build. Fields with no data contain the string NA, not null.
Response
{
"network-logs": {
"https://example.com:443/assets/app.css": {
"base-status": 200,
"head-status": 404,
"status-summary": "Current: Percy infra error\nBaseline: call via cache",
"status-error": true,
"domain": "example.com:443",
"file": "app.css",
"mimetype": "text/css",
"details": {
"cli-network-call": {
"head": 404,
"base": "ok"
},
"asset-captured": {
"head": "error",
"base": "ok",
"head-hostname": "public",
"base-hostname": "allowed"
},
"possible-fixes": "NA"
}
}
},
"meta": {
"is-head-expired": false,
"is-base-expired": false,
"is-base-present": true
}
}
-
network-logs Object
â–¶ SHOW VALUESNetwork requests for the comparison, keyed by request URL. Each value describes one request. URLs can include an explicit port, such as
:443. Percy-internal URLs aren’t included.-
head-status Integer | String
The HTTP status that Percy’s renderer received for the request in the current build.
NAif the request wasn’t made in that render. -
base-status Integer | String
The HTTP status that Percy’s renderer received for the request in the baseline build.
NAif the request wasn’t made in that render. -
status-error Boolean
trueif the request failed in the current or the baseline render. Filter on this field to find failed requests. -
status-summary String
Result of the request, with one line for the current build and one for the baseline, such as
Current: call via cache. Possible values arecall by network request,call via cache,Percy infra error,Request skipped in cli,Error in cli network request, andasset not present. -
domain String
The host of the request URL, including the port when the URL has one.
-
file String
The last path segment of the request URL. Returns
/for the page itself. -
mimetype String
Content type of the response, without parameters.
NAif not available. -
details Object
â–¶ SHOW VALUESDetails of how the Percy CLI discovered the asset and how Percy served it at render time.
-
cli-network-call.head Integer | String
The result of the request when the Percy CLI discovered assets for the current build. An HTTP status,
ok,skipped,error, orNA. -
cli-network-call.base Integer | String
The result of the request when the Percy CLI discovered assets for the baseline build. An HTTP status,
ok,skipped,error, orNA. -
asset-captured.head String
okif Percy served the asset from the captured resources in the current build,errorif the request returned a non-2xx status at render time, andNAif the asset wasn’t captured. -
asset-captured.base String
okif Percy served the asset from the captured resources in the baseline build,errorif the request returned a non-2xx status at render time, andNAif the asset wasn’t captured. -
asset-captured.head-hostname String
Describes how Percy reached the asset host in the current build.
allowedif Percy served it from captured resources,publicif Percy fetched it from the internet at render time, anddisallowedifdiscovery.disallowedHostnamesblocks the host. -
asset-captured.base-hostname String
Describes how Percy reached the asset host in the baseline build.
allowedif Percy served it from captured resources,publicif Percy fetched it from the internet at render time, anddisallowedifdiscovery.disallowedHostnamesblocks the host. -
possible-fixes String
Reserved for future use. The value is currently always
NA.
-
-
-
meta Object
â–¶ SHOW VALUESAvailability of the logs for the current build and the baseline.
-
is-head-expired Boolean
trueif the logs for the current build aren’t available. This happens when the 30-day retention period expires, for builds created with the legacypercy-agent, or when Percy can’t read the logs.network-logsis then empty or partial. -
is-base-expired Boolean
trueif the logs for the baseline build aren’t available, for the same reasons asis-head-expired. -
is-base-present Boolean
falseif the comparison has no baseline, such as for a new snapshot.
-
Limitations
- Percy keeps network logs for 30 days. After that,
meta.is-head-expiredistrue, andnetwork-logsis empty. - Builds created with the legacy
percy-agentdon’t have network logs. - Each call reads the logs from storage, so a response typically takes between 0.5 and 4 seconds. To scan a whole build, call this API once per comparison with no more than 5 requests in parallel.
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.