Webperf's API

The API is under constant change – Work in Progress

More information and documentation is added continuously. Unless stated otherwise, responses are in JSON format. Want to see the OpenAPI/Swagger documentation? You'll find it here!

1. Open data

The data that Webperf releases as open data is published under the CC BY-SA 4.0 licence. This means you need to give proper attribution (that the data source is Webperf), and if you share the data source further, or adapt it, it must keep the same licence.

1.1 URLs to municipality and region websites

The URLs you get from this API endpoint point to the start page of municipality and region websites as stored at Webperf.se.
Note that Visby municipality in this list has been replaced by Region Gotland.

GET
https://api.webperf.se/public-sector/

The response contains the following data:

The point of URIs to Wikidata? Linked data!

"Linked data is a method of publishing structured data in a way that makes it possible to follow connections between pieces of information across multiple sources. Linked data builds on web standards such as HTTP and URIs, but instead of using them to present information to humans, the aim is to make data readable by machines. The goal is to enable widely differing actors to describe their information in a uniform way and thereby simplify reuse and interoperability."

So you can relate information at Webperf with Wikidata, which lets you fetch both even more data and also connect to various Wikipedia articles you may want to work with. This makes the data source machine-readable and processable automatically in your own application.

This can be handy if you want to automate fetching municipalities' names in other languages, which province they belong to, population size, their official email address, images from Wikimedia and everything else offered by Wikidata. See, for example, Wikidata's URI for Åmål municipality.

Code examples to get you started with Webperf's open data

On Webperf's GitHub account there are code examples you can reuse or take inspiration from.

1.2 Persistent URI (for municipalities and regions)

A URI is an identifier in the (linked) open data world. It is meant to be persistent and a unique reference that you may come across in datasets from Webperf. External parties are also free to use these URIs.
You'll find URIs in each listing and they can also be looked up. A URI for Webperf follows the syntax below and returns the public information that is available to share.

Do you have Premium? Then you can get your own data and the overall scores just by supplying an API key. See more about URIs for Premium.

GET
https://api.webperf.se/item/number

For example the following for Västra Götaland Region:

GET
https://api.webperf.se/item/141

The response contains the following data:

1.3 Test types

In several of the API's responses a field type_of_test appears – an integer that identifies which kind of test was run. This endpoint is an open catalogue of every test type in Webperf Core, with their id numbers and names. So you need no API key. The data source is Webperf Core and is released as open data.

Note that the names of the test types that are active in the current Webperf Core are taken verbatim from Webperf Core's own locale files. Descriptions, and names for historical (inactive) tests in Danish, Norwegian, Finnish and Icelandic, are machine-translated from Swedish/English and should be reviewed before you fully rely on them.

Fetch the whole list:

GET
https://api.webperf.se/v1/tests

Or a single test type by its id number:

GET
https://api.webperf.se/v1/tests/number

For example the following for the performance test (Sitespeed.io):

GET
https://api.webperf.se/v1/tests/15

There are two optional query parameters:

Example with English names and active tests only:

GET
https://api.webperf.se/v1/tests?lang=en&active=true

The response contains the following data:

The response is delivered with long cache headers and an ETag, so a conditional request with If-None-Match can return status code 304 (Not Modified) and save bandwidth.

2. Webperf's premium API

Quick links to the premium endpoints:

Only for you with a Webperf premium account of the medium or large variant. A few have bought the API add-on for their account; if that applies to you, you'll see it in the menu when you log in to Premium. You need to fetch your API key via your premium account to get started. If you don't have your API key yet, log in to premium.webperf.se and click My API key in the menu to create one.
Read more about Webperf's different premium accounts »

The premium APIs are versioned so that you can trust that your integrations won't suddenly break. Each version is supported for at least 6 months, and it may become longer as the API is released in newer versions going forward.
You don't have to pick a version in your calls, but if you do, it's an extra path segment with a decimal number in the API endpoints below. If you don't pick a versioned endpoint you always get the latest version.

If you don't have premium but want to try it out, you can use the demo account that exists for Webperf.se as a site. In that case it's API key 989089bfe899d6992ff320a97 and the site's id number 3843 that you use.

Looking for code examples to work with the premium API?

There are code examples in Python at the link below. It runs in Jupyter Notebook, which is also compatible with Google Colab as an environment if you prefer that.
With the code example you can interact with the premium API by asking which id number your website has, fetch the latest results, historical average scores and create a graph of the average scores over time.

These are just code examples. To give inspiration for what you can do to get started with the premium API. There are surely other automations and integrations you'll think of.

2.1 Fetch your latest scores

Here you get, in JSON format, the same tests you can see on Webperf.se as test results.

Initially you may not know which id number your website has. Then you can make the API request below together with your API key, and you'll find out which id numbers you have access to. This is also shown on the Info page if you log in to premium.

GET
https://api.webperf.se/stats/
https://api.webperf.se/0.1/stats/

HTTP header
Key: api-key
Value: your-api-key

Once you know the website's id number, your API endpoint is the following to get statistics:

GET
https://api.webperf.se/stats/number
https://api.webperf.se/0.1/stats/number

HTTP header
Key: api-key
Value: your-api-key

It might look like this if you use Webperf.se's demo account:

GET
https://api.webperf.se/stats/3843

HTTP header
Key: api-key
Value: 989089bfe899d6992ff320a97

The response contains the following data:

2.2 Historical scores

Webperf has collected test results for many years for certain websites. For example monthly for all municipalities since the summer of 2018. All scores are part of a kind of "category score", which is what you see reported in the recurring monthly reports on Webperf.se, but it can be tedious to compile your own data from those reports. That's why this API endpoint exists.

GET
https://api.webperf.se/stats_per_month/number
https://api.webperf.se/0.1/stats_per_month/number

HTTP header
Key: api-key
Value: your-api-key

It might look like this if you use Webperf.se's demo account:

GET
https://api.webperf.se/stats_per_month/3843

HTTP header
Key: api-key
Value: 989089bfe899d6992ff320a97

The response contains the following data:

2.3 Re-test the start page

Do you want to manually re-run the tests of your website so that Webperf.se takes a fresh look? The test applies to the start page of your website and the result will be published on Webperf.se when the test is done, and you can reach the new tests via the API through 2.1 Fetch your latest scores.

You have a limited number of credits per 4 weeks to do these re-tests. You can't overdraw; it's up to Webperf to stop you. So go for it.

The number you supply is the website's id number. If you don't know your website's id number, run the API request under 2.1 Fetch your latest scores and you'll get it in the response.

POST
https://api.webperf.se/retest/
https://api.webperf.se/0.1/retest/

HTTP header
Key: api-key
Value: your-api-key

Key: site-id
Value: number

Optional – if you only want to run certain tests:
Key: testnums
Value: [1, 2, 4, 5, 8, 9, 10, 15, 17,18, 20, 21, 22, 23, 24, 25]

It might look like this if you use Webperf.se's demo account:

POST
https://api.webperf.se/retest/

HTTP header
Key: api-key
Value: 989089bfe899d6992ff320a97

Key: site-id
Value: 3843

The response to your POST is status code 200 if it went well and a text confirmation along the lines of "Website with site-id 3843 will be retested in a couple of minutes". If something went wrong on the server side it's error 500. If you forgot to post site-id or api-key you get status code 400.

2.4 Start private tests

You can test up to 10 sub-pages of your choice per call to the API. The number of pages you can test is governed by which level of premium your website has. If you have one of the larger premium variants you have room to make several API posts in a row and then wait for the test results to come in over the 15-30 minutes it usually can take.
See 2.5 Fetch a list of your private tests for how, via the API, you get the API calls you make to reach these private tests.

You have a limited number of credits per 4 weeks to do these re-tests. You can't overdraw; it's up to Webperf to stop you. So go for it.

POST
https://api.webperf.se/test_once/
https://api.webperf.se/0.1/test_once/

HTTP header
Key: api-key
Value: your-api-key
Key: site-id
Value: number

HTTP body
Key: urls
Value: url1
or
Value: url1, url2, url3 – url10

It might look like this if you use Webperf.se's demo account:

POST
https://api.webperf.se/test_once/
https://api.webperf.se/0.1/test_once/

HTTP header
Key: api-key
Value: 989089bfe899d6992ff320a97
Key: site-id
Value: 3843

HTTP body
Key: urls
Value: https://webperf.se/articles/nyhetsbrev-38/, https://webperf.se/tag/tillganglighet/

The response to your POST is status code 200 if it went well and a text along the lines of "A once only test for # URL's belonging to site-id 3843 will be performed in a couple of minutes. The endpoint(s) is/are: {6481: 'https://api.webperf.se/private_stats/3843/6481', 6479: 'https://api.webperf.se/private_stats/3843/6479', 6477: 'https://api.webperf.se/private_stats/3843/6477', 6475: 'https://api.webperf.se/private_stats/3843/6475'}".

If you get status code 400 you have exceeded your quota for the current 4 weeks.

2.5 Fetch a list of your private tests

These are called private tests because they are not openly accessible on Webperf.se or to other users of the API than those with the same permission as you.

With the API response below you get URIs to fetch all test results for a privately tested URL. This API URI requires you to supply your API key to get the response, see 2.6 Fetch test results for one of your private tests below.

GET
https://api.webperf.se/private_stats/number
https://api.webperf.se/0.1/private_stats/number

HTTP header
Key: api-key
Value: your-api-key


HTTP body
Key: urls
Value: url1
or
Value: url1, url2, url3 – url10

It might look like this if you use Webperf.se's demo account:

GET
https://api.webperf.se/private_stats/3843
https://api.webperf.se/0.1/private_stats/3843

HTTP header
Key: api-key
Value: 989089bfe899d6992ff320a97
Key: site-id
Value: 3843

HTTP body
Key: urls
Value: https://webperf.se/articles/nyhetsbrev-38/, https://webperf.se/tag/tillganglighet/

The response contains the following data:

2.6 Fetch test results for one of your private tests

Only those with API access to the website at Webperf or logged in to Premium can access these results. They are not shared openly.

GET
https://api.webperf.se/private_stats/number/test_id
https://api.webperf.se/0.1/private_stats/number/test_id

HTTP header
Key: api-key
Value: your-api-key

It might look like this if you use Webperf.se's demo account:

GET
https://api.webperf.se/private_stats/3843/6360
https://api.webperf.se/0.1/private_stats/3843/6360

HTTP header
Key: api-key
Value: 989089bfe899d6992ff320a97

The response you get from the API is along the lines of what 2.1 Fetch your latest scores gives you.

2.7 Your own URI gives you your latest overall scores

This endpoint has some similarities with 1.2 Persistent URI (for municipalities and regions), but with the difference that it applies to your own website. You also get a bit more data because you supply your API key.

Note! Mind the hyphen in api-key in this particular code example.

GET
https://api.webperf.se/item/number

For example the following for Webperf's demo account:

GET
https://api.webperf.se/item/3843

HTTP header
Key: api-key
Value: 989089bfe899d6992ff320a97

The response contains the following data:

The response you get from the API is along the lines of what 2.1 Fetch your latest scores gives you. But complemented with the scores node.

2.8 Get a text's readability index (LIX)

A text can be more or less easy to read. LIX is a measure of this and you, with the premium API, can easily check your texts via the API. Sooner or later LIX calculation will be included in the quota system with test credits.

GET
https://api.webperf.se/tools/lix/
https://api.webperf.se/0.1/tools/lix/

HTTP header
Key: api-key
Value: your-api-key
Key: site-id
Value: your-site-id-number

Body form-data
Key: content
Value: your text to readability-test

The response contains the following data:

It might look like this:

[
    {
        "message": [
            52,
            "Svår, normalt värde för officiella texter"
        ]
    },
    200
]

If something goes wrong you will instead get False as the response and an error code.

2.9 The categories' average scores

The categories of websites that appear on Webperf.se have average scores in each score category. These you can fetch in a structured way with the premium API.

GET
https://api.webperf.se/categories/
https://api.webperf.se/0.1/categories/

HTTP header
Key: api-key
Value: your-api-key

The response contains the following data:

2.10 Trigger a Premium Audit

For you with a Premium account, you can trigger a Premium Audit via the API. It can only be done every four weeks. Posting form-data with content is optional. If it isn't done, a selection of pages to test will be chosen via sitemap and crawling.

GET
https://api.webperf.se/audit/
https://api.webperf.se/0.1/audit/

HTTP headers
Key: api-key
Value: your-api-key
Key: site-id
Value: your-site-id-number

Body form-data
Key: content
Value: https://url.se/1, https://url.se/2, https://url.se/3

The response contains the following data:

[
    {
        "message": "Website with site-id nnnn will be audited in a couple of hours"
    },
    200
]

Or if you posted a new request too soon:

[
    {
        "message": "Fail since the website with site-id nnnn had an
        audit the last four weeks. Most recent audit were 2025-05-27 23:23:53"
    },
    429
]

2.11 Fetch your Premium Audits or reviews

If you have already run a Premium Audit or want to know whether the one you ordered is done yet, you can use this endpoint. Under data you may get an empty result if nothing is finished, a single result as in the example below, or more than one result.

Variants of format are csv for primarily automated accessibility tests and audit.

This is how the results work:

GET
https://api.webperf.se/audits/
https://api.webperf.se/0.1/audits/

HTTP headers
Key: api-key
Value: your-api-key
Key: site-id
Value: your-site-id-number

The response looks as follows (if you have access):

[{
    "api_version": "0.1",
    "data": [
        {
            "content": "{'date': 'YYYY-MM-DD', 'folder': '/static/results/webbplats.se-yyyy_mm_dd_hh-results/', 'base_url': 'https://webbplats.se'}",
            "date_modified": "2025-05-12T22:20:01",
            "format": "audit",
            "result_files": [
                "https://premium.webperf.se/static/results/webbplats.se-2025_05_12_18-results/accessibility_summary.json",
                "https://premium.webperf.se/static/results/webbplats.se-2025_05_12_18-results/performance_summary.json",
                "https://premium.webperf.se/static/results/webbplats.se-2025_05_12_18-results/seo_summary.json",
                "https://premium.webperf.se/static/results/webbplats.se-2025_05_12_18-results/best-practices_summary.json"
            ],
            "site_id": nnnn,
            "title": "Audit Webbplats.se"
        }
    ],
    "result_count": 1,
    "timestamp": "2025-05-28 21:43:02.311244"
}

3. Premium for web agencies

As a web agency there is a special premium access. Part of it is that you can manage both your own website and your clients'. Another is that it gives you access to information that can make your sales work easier. What is exclusive to web agencies' premium is listed below.

3.1 Which web analytics tools are used on websites Webperf follows

This API requires that you have Premium for web agencies.

GET
https://api.webperf.se/webanalytics?api-key=API-key

The response you get from the API is a CSV file, separated by semicolons. For just under 4000 websites important to a digital Nordics, primarily Sweden.

What output do you get? Well:

4. Webhook for you with Webperf Premium

Webhooks are a way to have signals sent to your API when a SaaS service has something to tell you. As in this case, that one of Webperf's tests has run and has a test result for you. Read more about webhooks on Webperf.se

To benefit from webhooks via Webperf you first and foremost need to have a premium account. Set up an endpoint so you can receive the post from Webperf. Then you configure each website inside premium.webperf.se so we know where you want your result sent.

Below you have an example of what the content looks like that you get posted to your endpoint. The HTTP call will have a content-type of application/json and the payload below. You have two different signals about which page it concerns in the case of webhooks.

uri is the address you can later look up to check everything about the page as Webperf sees it. But if you test many pages continuously it's worth knowing that for webhooks there is also tested_url which directly tells you which page the test applies to. As usual, some tests don't evaluate that URL but instead go to your 404 page, check email settings, etc. But then you at least know which URL was fed in as the starting point.

        {
            "api_version": "undefined",
            "uri": "https://api.webperf.se/item/3843",
            "tested_url": "https://webperf.se",
            "timestamp": "2024-01-13T22:34:11.519410",
            "result_count": "1",
            "data": {
                "test_date": "2024-01-13T22:34:11.519410",
                "type_of_test": 4,
                "url": "https://webperf.se",
                "rating": 4.95,
                "check_report": "- Webbsidan kan ändå förbättras inom SEO.
                - Tryckmålen har inte lämplig storlek: 99 % av tryckmålen har lämplig storlek ( 4.40 betyg )
                - Alla bildelement har `[alt]`-attribut ( 5.00 betyg )
                - Dokumentet har en metabeskrivning ( 5.00 betyg )
                - Dokumentet har ett `<title>`-element ( 5.00 betyg )
                - Dokumentet har ett giltigt `hreflang`-värde ( 5.00 betyg )
                - Dokumentet har ett giltigt `rel=canonical`-värde ( 5.00 betyg )
                - Dokumentet har läsliga teckenstorlekar ( 5.00 betyg )
                - Dokumentet undviker plugin-program ( 5.00 betyg )
                - Har en `<meta name="viewport">`-tagg med `width` eller `initial-scale` ( 5.00 betyg )
                - Länkar har beskrivande text ( 5.00 betyg )
                - Länkarna är genomsökningsbara ( 5.00 betyg )
                - Sidan har en giltig HTTP-statuskod ( 5.00 betyg )
                - Sidan är inte blockerad från indexering ( 5.00 betyg )
                - robots.txt är giltig ( 5.00 betyg )",
                "check_report_a11y": "",
                "check_report_perf": "",
                "check_report_stand": "",
                "check_report_sec": "",
                "json_check_data": "{}"
            }
        }

5. Version history

A brief look at the versions that have been released and what the plan is for the next version.

6. Tips on tools and resources

To use Webperf's open data you can really just keep using your web browser. At least if you only want to download data. But for the premium API you need to send an API key in your request, which is most easily done with the Postman app if you're not building your call in some development environment.

Resources: