Call the PerformanceGuard API
Use the PerformanceGuard REST API to read collected data and manage PerformanceGuard from your own scripts and tools. This page shows you how to find the API documentation, sign in, and set the time interval for data requests.
For an overview of the API, see PerformanceGuard API.
Open the API documentation
Section titled “Open the API documentation”The API documentation is built into PerformanceGuard as an interactive Swagger page.
- In a browser, open the PerformanceGuard web interface and sign in.
- In the address bar, replace the path with
/swagger. For example:https://performanceguard.example.com/swagger.
The Swagger page lists all endpoints, grouped by area, with their parameters and responses. Because you’re signed in, you can select an endpoint and try it directly from the page.
Send requests from a script
Section titled “Send requests from a script”All endpoints are under the /api path of the PerformanceGuard web interface address, for example https://performanceguard.example.com/api/agent. Requests and responses use JSON unless the endpoint says otherwise.
Authenticate in one of two ways.
Basic authentication
Section titled “Basic authentication”Send the PerformanceGuard user name and password in a standard HTTP Authorization: Basic header with each request. This is the simplest method for scripts.
$cred = Get-CredentialInvoke-RestMethod -Uri "https://performanceguard.example.com/api/agent?pattern=PC-01" ` -Authentication Basic -Credential $credThe -Authentication parameter requires PowerShell 7 or newer.
Sign in with a session
Section titled “Sign in with a session”- Send a
POSTrequest to/api/loginwith a JSON body that containsusernameandpassword. - PerformanceGuard returns a session cookie called
JSESSIONID_MERLIN. Include that cookie in the following requests. - When you’re done, send a
DELETErequest to/api/loginto end the session.
$body = @{ username = "api-user"; password = "<password>" } | ConvertTo-JsonInvoke-RestMethod -Method Post -Uri "https://performanceguard.example.com/api/login" ` -Body $body -ContentType "application/json" -SessionVariable pg
Invoke-RestMethod -Uri "https://performanceguard.example.com/api/agent?pattern=PC-01" -WebSession $pg
Invoke-RestMethod -Method Delete -Uri "https://performanceguard.example.com/api/login" -WebSession $pgIf the credentials are wrong, PerformanceGuard returns 401 Unauthorized.
Set the time interval
Section titled “Set the time interval”Endpoints that return data for a period take an interval query parameter. The value has up to three parts, separated by |:
<period>|<end>|<offset>
| Part | Required | Description |
|---|---|---|
period |
Yes | The length of the interval. See the values in the next table. |
end |
No | The end of the interval, as an ISO 8601 date and time with a time zone, or a UTC timestamp in milliseconds. If you leave it out or leave it empty, the interval ends now. |
offset |
No | A time zone offset in minutes that’s used when PerformanceGuard calculates calendar periods and the current time. |
These are the values you can use for period:
| Value | Meaning |
|---|---|
A number, for example 3600000 |
The number of milliseconds before the end. 3600000 is one hour. |
0 |
Two delivery intervals before the end. |
XD followed by a number, for example XD30 |
The number of days before the end. |
CH, CD, CW, CM, CQ, CY |
The current hour, day, week, month, quarter, or year, from its start until the end. |
PH, PD, PW, PM, PQ, PY |
The previous full hour, day, week, month, quarter, or year. |
Examples:
interval=86400000: the last 24 hours.interval=XD7: the last seven days.interval=PD: yesterday.interval=86400000|2026-01-31T00:00:00Z: the 24 hours before midnight UTC on 31 January 2026.
URL-encode the | character as %7C when you build the address yourself. To check how PerformanceGuard reads an interval value, try it on the /api/internal/interval endpoint in Swagger.
Get data as a spreadsheet
Section titled “Get data as a spreadsheet”Some endpoints can also return an Excel workbook. In Swagger, those endpoints list application/vnd.openxmlformats-officedocument.spreadsheetml.sheet as a response type. To get the workbook, send that value in the Accept header of the request.