You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/api/reference.md
+14-17Lines changed: 14 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,14 +21,11 @@ The WebPageTest API uses API keys to authenticate all tests submitted to the pub
21
21
API keys may or may not be required for requests made to any [private instances](/private-instances/) you maintain on your own. Check with the administrator of your private instance to verify.
22
22
:::
23
23
24
-
You can pass your API key along with tests requests by using the `k` parameter.
24
+
You can pass your API key along with tests requests by using the `X-WPT-API-KEY` HTTP header.
curl --request POST --url https://www.webpagetest.org/runtest.php?url={your_domain} --header "X-WPT-API-KEY: {your_api_key}"
28
28
```
29
-
30
-
If you prefer, instead of passing the `k` parameter, you may pass the request header `X-WPT-API-KEY`
31
-
32
29
::: warning
33
30
Your API keys are directly tied to your account, so be sure to keep them secure. Avoid sharing them in any public area, such as GitHub or client-side code.
34
31
:::
@@ -55,13 +52,13 @@ You can optionally set the response format using the `f` parameter to return eit
curl --request POST https://www.webpagetest.org/runtest.php?url={your_domain}&f=json --header "X-WPT-API-KEY: {your_api_key}"
65
62
```
66
63
67
64
Here's an example response when the format parameter is provided to the endpoint:
@@ -125,10 +122,10 @@ A URL to the full detailed results (including request-level data and timings) in
125
122
126
123
### Full List of Parameters
127
124
::: api-list
125
+
-`X-WPT-API-KEY` <small>header, required</small>
126
+
API Key. Applies only to calls made to the runtest.php endpoint. *API Key is optional for any private instances you maintain on your own.
128
127
-`url` <small>required</small>
129
128
The URL to be tested. The value must be UTF-8 encoded to work.
130
-
-`k` <small>required</small>
131
-
API Key. Applies only to calls made to the runtest.php endpoint. *API Key is optional for any private instances you maintain on your own.
132
129
-`label` <small>optional</small>
133
130
A label for the test.
134
131
-`location` <small>optional</small>
@@ -317,7 +314,7 @@ Browser is only required in a Chrome/Firefox install where wptdriver is configur
317
314
318
315
### Available locations for API calls
319
316
320
-
On the public instance with an API key that starts with "A.", only locations listed [here](https://www.webpagetest.org/getLocations.php?k=A&f=html) are available for API calls. Others will return `invalid location` when requested.
317
+
On the public instance with an API key that starts with "A.", only locations listed [here](curl --request GET --url https://www.webpagetest.org/getLocations.php?&f=html --header "X-WPT-API-KEY: {your_api_key}") are available for API calls. Others will return `invalid location` when requested.
321
318
322
319
### Examples
323
320
Test www.aol.com and redirect to the results page:
@@ -603,14 +600,14 @@ Request ID. Will echo back in the response object.
603
600
To cancel a test that has not started running, you can use the http://www.webpagetest.org/cancelTest.php endpoint.
0 commit comments