Create GTmetrix reports
Starts one GTmetrix test for each environment and page of the audit, in the background: read the audit's GTmetrix reports until generation.status is completed or failed. Each test uses GTmetrix credits, so send the number it starts as confirm_count: any other number is refused with the right number in the message. When some tests were not started, the next generation at the same location starts only those.
Path parameters
The id of an audit. Digits only. At least 1.
Body
The number of tests this starts. At least 1.
The id of one of GTmetrix's locations, as the GTmetrix locations list answers it. Up to 64 characters.
Returns
202 The generation is queued. Poll the operation until it finishes.
Fields of the 202 answer
At least 1.
On a failed generation: how many tests were not started.
Each test GTmetrix refused.
Fields of each item
Format: date-time.
Fields of each item
Format: date-time.
Whether it starts only the tests the last generation at this location did not start.
How many GTmetrix has started. At least 0.
queuedrunningcompletedfailedThe tests of the generation. At least 0.
If it is refused
| Status | Reason | What to do |
|---|---|---|
401 | none | Send a valid token as Authorization: Bearer <token>. |
403 | scope_required | Use a token with the scope named in scope. |
404 | none | Check the id. You see only what your account can reach. |
409 | conflict | The action conflicts with the object's present state. Read the message. |
409 | nothing_to_run | The audit has no domains or pages to test. Add them to the audit first. |
409 | run_in_progress | The audit is running. Wait for it to finish. |
409 | too_large | The upload is larger than the limit for one file. |
422 | confirm_mismatch | Send the confirmation exactly as the field named in field asks for it. |
422 | invalid | Fix the field named in field; errors says why. |
429 | rate_limited | Wait for the seconds in Retry-After. |
502 | upstream_unavailable | A service the action depends on did not answer. Try again later. |
503 | temporarily_unavailable | The Control Panel could not answer just now. Nothing was started; try again shortly. |
Reasons are listed by name in Errors and refusals.
The same task elsewhere
curl -X POST https://manage.corefinity.com/api/performance-audits/5210/gtmetrix-reports \
-H "Authorization: Bearer $COREFINITY_TOKEN" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"confirm_count": 4,
"location_id": "2"
}'use Illuminate\Support\Facades\Http;
$response = Http::withToken(env('COREFINITY_TOKEN'))
->acceptJson()
->post('https://manage.corefinity.com/api/performance-audits/5210/gtmetrix-reports', [
'confirm_count' => 4,
'location_id' => '2',
]);
$data = $response->json();const res = await fetch('https://manage.corefinity.com/api/performance-audits/5210/gtmetrix-reports', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.COREFINITY_TOKEN}`,
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
confirm_count: 4,
location_id: '2',
}),
});
// An answer with no body (204) has nothing to parse.
const text = await res.text();
const data = text && JSON.parse(text);import os
import requests
res = requests.post(
"https://manage.corefinity.com/api/performance-audits/5210/gtmetrix-reports",
headers={
"Authorization": f"Bearer {os.environ['COREFINITY_TOKEN']}",
"Accept": "application/json",
},
json={
"confirm_count": 4,
"location_id": "2",
},
)
data = res.json() if res.content else None{
"audit_id": 5210,
"error": null,
"failures": [],
"finished_at": null,
"id": "0d9c1a4e-6f1b-4f5e-9b8a-2d7c3e4f5a6b",
"location_id": "2",
"reports": [],
"requested_at": "2026-11-03T12:30:00+00:00",
"resumed": false,
"started": 0,
"status": "queued",
"tests": 4
}{
"message": "Unauthenticated."
}{
"code": "scope_required",
"message": "This access token does not have the destructive scope this needs. Use a token with the destructive scope.",
"reason": "scope_required",
"scope": "destructive"
}{
"message": "Not found."
}{
"code": "conflict",
"message": "Two of this audit's environment and page pairs have the same report name, \"Shop Home Home\", and GTmetrix reports are kept by that name. Rename an environment or a page of the audit first. Nothing was started.",
"reason": "conflict"
}{
"code": "confirm_mismatch",
"errors": {
"confirm_count": [
"This starts 4 GTmetrix tests, one for each environment and page, and each uses GTmetrix credits. Send confirm_count 4 to go ahead. Nothing was started."
]
},
"field": "confirm_count",
"message": "This starts 4 GTmetrix tests, one for each environment and page, and each uses GTmetrix credits. Send confirm_count 4 to go ahead. Nothing was started.",
"reason": "confirm_mismatch"
}{
"code": "rate_limited",
"message": "Too many requests. Try again in 60 seconds.",
"reason": "rate_limited",
"retry_after_seconds": 60
}{
"code": "upstream_unavailable",
"message": "GTmetrix could not list its locations: GTmetrix request failed (HTTP 500). Try again later.",
"reason": "upstream_unavailable"
}{
"code": "temporarily_unavailable",
"message": "GTmetrix reports are not available right now. Try again later.",
"reason": "temporarily_unavailable"
}Try it is off for this endpointIt can add to your bill. Copy the request and run it yourself when you are sure.