Budgets


List budgets

GET /{website-id}/budgets

The result looks like this:

200 OK
{
"result": {
"list": [
{
"id": "x7wcqghdlo",
"metric": "lcp",
"operator": "lt",
"value": "700",
"device": "desktop",
"status": "at-risk",
"pages": [
{
"id": "l2o71voacg",
"device": "desktop",
"alias": "Blog overview",
"status": "at-risk"
}
]
},
{
"id": "ky60fto1rt",
"metric": "dom_elements",
"operator": "lt",
"value": "1000",
"device": "all",
"status": "ok",
"pages": []
},
...
]
}
}

The result.list array shows the budgets:

PropertyDescription
idThe internal ID of the budget
metricThe metric the budget is measuring
operatorEither "lt" (less than) or "gt" (greater than)
valueThe threshold value of the budget
devicedesktop, mobile or all
statusok, at-risk or exceeded. At-risk means within 10% of the threshold
pagesAn array of the pages that either exceed or are at risk of exceeding the budget

Each page item represents a page-device combination and has these properties:

PropertyDescription
idThe internal ID of the page
deviceThe device of the page
aliasThe page alias
statusok, at-risk or exceeded. At-risk means within 10% of the threshold

Create new budget

Adds a new budgets to the website. admin

POST /{website-id}/budgets
{
  "metric": "lcp",
  "operator": "lt",
  "value": 2500,
  "device": "desktop"
}

Returns the same object, but with the id added:

201 Created
{
"id": "x7wcqghdlo",
"metric": "lcp",
"operator": "lt",
"value": 2500,
"device": "desktop"
}

Edit budget

Edits an existing budget. admin

PUT /{website-id}/budgets/{budget-id}
{
  "metric": "lcp",
  "operator": "lt",
  "value": 2500,
  "device": "desktop"
}

Returns the budget object:

200 OK
{
"id": "x7wcqghdlo",
"metric": "lcp",
"operator": "lt",
"value": 2500,
"device": "desktop",
}

Delete budget

Removes the budget from the website. admin

DELETE /{website-id}/budgets/{budget-id}

If successful, you'll receive a 204 No Content response.