curl --request POST \
--url https://api.speedvitals.com/v1/lighthouse-batch-tests \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"urls": [
"https://speedvitals.com",
"https://blog.speedvitals.com"
],
"devices": [
"macbookAirM1"
],
"locations": [
"us"
],
"batch_type": "multiple-urls"
}
'import requests
url = "https://api.speedvitals.com/v1/lighthouse-batch-tests"
payload = {
"urls": ["https://speedvitals.com", "https://blog.speedvitals.com"],
"devices": ["macbookAirM1"],
"locations": ["us"],
"batch_type": "multiple-urls"
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
urls: ['https://speedvitals.com', 'https://blog.speedvitals.com'],
devices: ['macbookAirM1'],
locations: ['us'],
batch_type: 'multiple-urls'
})
};
fetch('https://api.speedvitals.com/v1/lighthouse-batch-tests', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.speedvitals.com/v1/lighthouse-batch-tests",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'urls' => [
'https://speedvitals.com',
'https://blog.speedvitals.com'
],
'devices' => [
'macbookAirM1'
],
'locations' => [
'us'
],
'batch_type' => 'multiple-urls'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.speedvitals.com/v1/lighthouse-batch-tests"
payload := strings.NewReader("{\n \"urls\": [\n \"https://speedvitals.com\",\n \"https://blog.speedvitals.com\"\n ],\n \"devices\": [\n \"macbookAirM1\"\n ],\n \"locations\": [\n \"us\"\n ],\n \"batch_type\": \"multiple-urls\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.speedvitals.com/v1/lighthouse-batch-tests")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"urls\": [\n \"https://speedvitals.com\",\n \"https://blog.speedvitals.com\"\n ],\n \"devices\": [\n \"macbookAirM1\"\n ],\n \"locations\": [\n \"us\"\n ],\n \"batch_type\": \"multiple-urls\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.speedvitals.com/v1/lighthouse-batch-tests")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"urls\": [\n \"https://speedvitals.com\",\n \"https://blog.speedvitals.com\"\n ],\n \"devices\": [\n \"macbookAirM1\"\n ],\n \"locations\": [\n \"us\"\n ],\n \"batch_type\": \"multiple-urls\"\n}"
response = http.request(request)
puts response.read_body{
"id": "lbt_IU8rN0XQmIWEqGkP",
"urls": [
"https://speedvitals.com",
"https://blog.speedvitals.com"
],
"devices": [
"macbookAirM1"
],
"locations": [
"us"
],
"batch_type": "multiple-urls",
"status": "idle",
"lighthouse_version": "9.6.2",
"report_url": "https://speedvitals.com/result/afd98w0l/",
"created_at": 1657539924734,
"expires_at": 1660131924733,
"reports": [
{
"id": "lt_dObdG5EW4d231hto",
"url": "https://speedvitals.com",
"device": "macbookAirM1",
"location": "us",
"status": "success",
"metrics": {
"cumulative_layout_shift": 0,
"first_contentful_paint": 292,
"first_meaningful_paint": 297,
"time_to_interactive": 297,
"largest_contentful_paint": 434,
"server_response_time": 32,
"speed_index": 900,
"total_blocking_time": 0,
"performance_score": 100
},
"report_url": "https://speedvitals.com/report/speedvitals.com/IvWenx/",
"error": null
},
{
"id": "lt_dmpbeQ2xk1XPh4UP",
"url": "https://blog.speedvitals.com",
"device": "macbookAirM1",
"location": "us",
"status": "idle",
"metrics": {
"cumulative_layout_shift": 0,
"first_contentful_paint": 322,
"first_meaningful_paint": 365,
"time_to_interactive": 368,
"largest_contentful_paint": 488,
"server_response_time": 68,
"speed_index": 1406,
"total_blocking_time": 0,
"performance_score": 99
},
"report_url": "https://speedvitals.com/report/blog.speedvitals.com/3t4lm7",
"error": null
}
]
}{
"code": "<string>",
"message": "<string>"
}{
"code": "<string>",
"message": "<string>"
}Run a lighthouse batch test
Runs a new lighthouse batch test.
curl --request POST \
--url https://api.speedvitals.com/v1/lighthouse-batch-tests \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"urls": [
"https://speedvitals.com",
"https://blog.speedvitals.com"
],
"devices": [
"macbookAirM1"
],
"locations": [
"us"
],
"batch_type": "multiple-urls"
}
'import requests
url = "https://api.speedvitals.com/v1/lighthouse-batch-tests"
payload = {
"urls": ["https://speedvitals.com", "https://blog.speedvitals.com"],
"devices": ["macbookAirM1"],
"locations": ["us"],
"batch_type": "multiple-urls"
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
urls: ['https://speedvitals.com', 'https://blog.speedvitals.com'],
devices: ['macbookAirM1'],
locations: ['us'],
batch_type: 'multiple-urls'
})
};
fetch('https://api.speedvitals.com/v1/lighthouse-batch-tests', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.speedvitals.com/v1/lighthouse-batch-tests",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'urls' => [
'https://speedvitals.com',
'https://blog.speedvitals.com'
],
'devices' => [
'macbookAirM1'
],
'locations' => [
'us'
],
'batch_type' => 'multiple-urls'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.speedvitals.com/v1/lighthouse-batch-tests"
payload := strings.NewReader("{\n \"urls\": [\n \"https://speedvitals.com\",\n \"https://blog.speedvitals.com\"\n ],\n \"devices\": [\n \"macbookAirM1\"\n ],\n \"locations\": [\n \"us\"\n ],\n \"batch_type\": \"multiple-urls\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.speedvitals.com/v1/lighthouse-batch-tests")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"urls\": [\n \"https://speedvitals.com\",\n \"https://blog.speedvitals.com\"\n ],\n \"devices\": [\n \"macbookAirM1\"\n ],\n \"locations\": [\n \"us\"\n ],\n \"batch_type\": \"multiple-urls\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.speedvitals.com/v1/lighthouse-batch-tests")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"urls\": [\n \"https://speedvitals.com\",\n \"https://blog.speedvitals.com\"\n ],\n \"devices\": [\n \"macbookAirM1\"\n ],\n \"locations\": [\n \"us\"\n ],\n \"batch_type\": \"multiple-urls\"\n}"
response = http.request(request)
puts response.read_body{
"id": "lbt_IU8rN0XQmIWEqGkP",
"urls": [
"https://speedvitals.com",
"https://blog.speedvitals.com"
],
"devices": [
"macbookAirM1"
],
"locations": [
"us"
],
"batch_type": "multiple-urls",
"status": "idle",
"lighthouse_version": "9.6.2",
"report_url": "https://speedvitals.com/result/afd98w0l/",
"created_at": 1657539924734,
"expires_at": 1660131924733,
"reports": [
{
"id": "lt_dObdG5EW4d231hto",
"url": "https://speedvitals.com",
"device": "macbookAirM1",
"location": "us",
"status": "success",
"metrics": {
"cumulative_layout_shift": 0,
"first_contentful_paint": 292,
"first_meaningful_paint": 297,
"time_to_interactive": 297,
"largest_contentful_paint": 434,
"server_response_time": 32,
"speed_index": 900,
"total_blocking_time": 0,
"performance_score": 100
},
"report_url": "https://speedvitals.com/report/speedvitals.com/IvWenx/",
"error": null
},
{
"id": "lt_dmpbeQ2xk1XPh4UP",
"url": "https://blog.speedvitals.com",
"device": "macbookAirM1",
"location": "us",
"status": "idle",
"metrics": {
"cumulative_layout_shift": 0,
"first_contentful_paint": 322,
"first_meaningful_paint": 365,
"time_to_interactive": 368,
"largest_contentful_paint": 488,
"server_response_time": 68,
"speed_index": 1406,
"total_blocking_time": 0,
"performance_score": 99
},
"report_url": "https://speedvitals.com/report/blog.speedvitals.com/3t4lm7",
"error": null
}
]
}{
"code": "<string>",
"message": "<string>"
}{
"code": "<string>",
"message": "<string>"
}Body
This is the lighthouse batch test body object
For multiple-devices batch type, provide an array of device ids to test or leave it empty for testing on all preset devices. For other batch types, provide a single device id in array and if multiple device ids are provided, only first in the list will be used for the test. All invalid device ids in the array will be ignored.
mobile, desktop, macbookAirM1, highEndLaptop, ipad102, galaxyTabS7, iphone13ProMax, iphone11, galaxyS10Plus, redmiNote8Pro, iphone7, galaxyA50, galaxyJ8, motoG5, redmi5A 5000For multiple-locations batch type, provide an array of location ids to test or leave it empty for testing on all preset locations. For other batch types, provide just a single location id in array and if multiple location ids are provided, only first in the list will be used for the test. All invalid location ids in the array will be ignored.
us, ca, br, de, uk, nl, pl, ch, jp, in, sg, au, id, kr, tw 5000Response
A lighthouse batch report to be returned