# Check credits Source: https://developers.speedvitals.com/api-reference/account/check-credits api-reference/openapi.json get /v1/account/credits Fetch lighthouse and ttfb credits available in account # Get a device Source: https://developers.speedvitals.com/api-reference/devices/get-a-device api-reference/openapi.json get /v1/devices/{id} Retrieves a device info # List all devices Source: https://developers.speedvitals.com/api-reference/devices/list-all-devices api-reference/openapi.json get /v1/devices Returns a list of SpeedVitals supported devices # Retrieve a lighthouse batch report Source: https://developers.speedvitals.com/api-reference/lighthouse-batch-tests/retrieve-a-lighthouse-batch-report api-reference/openapi.json get /v1/lighthouse-batch-tests/{id} Retrieves the report of lighthouse test. Supply the unique test ID from either a lighthouse test creation request or the lighthouse tests list, and SpeedVitals will return the corresponding test information. # Run a lighthouse batch test Source: https://developers.speedvitals.com/api-reference/lighthouse-batch-tests/run-a-lighthouse-batch-test api-reference/openapi.json post /v1/lighthouse-batch-tests Runs a new lighthouse batch test. # Get a report resource Source: https://developers.speedvitals.com/api-reference/lighthouse-tests/get-a-report-resource api-reference/openapi.json get /v1/lighthouse-tests/{id}/resources/{resource_name} Retrieves the resource of lighthouse report. Supply the unique test ID from either a lighthouse test creation request or the lighthouse tests list along with resource name to get that resource. # List all lighthouse reports Source: https://developers.speedvitals.com/api-reference/lighthouse-tests/list-all-lighthouse-reports api-reference/openapi.json get /v1/lighthouse-tests Returns a list of your lighthouse tests. The tests are returned sorted by creation date, with the most recently created test appearing first. # Retrieve a lighthouse report Source: https://developers.speedvitals.com/api-reference/lighthouse-tests/retrieve-a-lighthouse-report api-reference/openapi.json get /v1/lighthouse-tests/{id} Retrieves the report of lighthouse test. Supply the unique test ID from either a lighthouse test creation request or the lighthouse tests list, and SpeedVitals will return the corresponding test information. # Run a lighthouse test Source: https://developers.speedvitals.com/api-reference/lighthouse-tests/run-a-lighthouse-test api-reference/openapi.json post /v1/lighthouse-tests Runs a new lighthouse test. # Get a location Source: https://developers.speedvitals.com/api-reference/locations/get-a-location api-reference/openapi.json get /v1/locations/{id} Retrieves a location info # List all locations Source: https://developers.speedvitals.com/api-reference/locations/list-all-locations api-reference/openapi.json get /v1/locations Returns a list of SpeedVitals supported locations # Check API status Source: https://developers.speedvitals.com/api-reference/ping/check-api-status api-reference/openapi.json get /ping Responds a pong if the API is up and running. # Get a TTFB region Source: https://developers.speedvitals.com/api-reference/ttfb-regions/get-a-ttfb-region api-reference/openapi.json get /v1/ttfb-regions/{id} Retrieves a TTFB region info # List all TTFB regions Source: https://developers.speedvitals.com/api-reference/ttfb-regions/list-all-ttfb-regions api-reference/openapi.json get /v1/ttfb-regions Returns a list of SpeedVitals supported regions for TTFB test # Run a TTFB test Source: https://developers.speedvitals.com/api-reference/ttfb-tests/run-a-ttfb-test api-reference/openapi.json post /v1/ttfb-tests Runs a new TTFB test for a region. # Authentication Source: https://developers.speedvitals.com/authentication ## **Api key (http\_api\_key)** Send an authentication token in the `X-API-KEY` header to authenticate with the API. # Errors Source: https://developers.speedvitals.com/errors SpeedVitals uses conventional HTTP response codes to indicate the success or failure of an API request. In general, Codes in the `2xx`range indicate success. Codes in the `4xx`range indicate an error that failed given the information provided (e.g., a required parameter was omitted, lighthouse test failed, etc.). Codes in the `5xx`range indicate an error with SpeedVitals servers (these are rare). **List of common errors codes:** | **HTTP Status** | **Description** | | :-------------- | :--------------------------- | | **401** | **Unauthorized** | | **429** | **Rate Limit Exceeded** | | **500** | **Internal Server Error** | | **502** | **Server Under Maintenance** | # Rate Limits Source: https://developers.speedvitals.com/rate-limits SpeedVitals API has a rate limit to protect our service from attacks and ensure its stability. For normal use case, the limits are quite high and wouldn't cause any issue. There are primarily two rate limits: * **Global rate limit**: The global rate limit is the maximum number of requests that can be made in a given time period across all API endpoints. The global rate limit is 120 requests in a minute. When this exceeds, the 429 Status Code will show up along with the rate limit headers, as described in the table. * **Concurrency limit**: This rate limit applies on the number of tests running in parallel. The concurrency limit is 2 for single lighthouse test and 1 for batch lighthouse test. When this exceeds, the 429 Status Code will be returned and new test won't start until current tests finishes. If you are facing any issues regarding rate limits, please Contact Us. **List of response headers when global rate limit exceeds:** | Header | **Description** | | :------------------------ | :------------------------------------------------------------------------------ | | **Retry-After** | **The minimum time to wait in seconds before making next request** | | **X-RateLimit-Limit** | **The maximum number of requests available in the current time window.** | | **X-RateLimit-Remaining** | **The number of remaining requests in the current time window** | | **X-RateLimit-Reset** | **The time at which the current rate limit window resets in UTC epoch seconds** |