A team member reported an error while using the new Compliance API and asked if it was a known issue. Another member suggested creating a new API key as a possible solution and confirmed that the API was working for them. The team explained how to use the API and shared a code for testing API key access. After rechecking, the team found and fixed the issue.
Read the entire ‘Troubleshooting and Validating ControlUp’s Compliance API’ thread below:
Hi team, I’m trying to use the new Compliance API however I get an error when trying to use the below API call
https://api.controlup.com/compliance/devices
I get a 502 Bad gateway error, is this something that is an active issue with Compliance API?
Hi, can you try creating a new API key? I had a similar issue before and creating a new API key fixed it. I couldn’t reproduce the problem, but I’m sure the team will investigate if you had the same issue as well.
Just did a test request and the server is working for me.
Harrison, our test shows no issues at the moment. Are you using a VPN or a proxy for API requests?
Also can u share how u are using the API? using it in specific tool or Code?
You can use this code to validate the API key access
“`# ===============================================
ControlUp API Validation Script (Hard-coded Key)
===============================================
INSERT YOUR API KEY HERE
$ApiKey = "PASTE_YOUR_API_KEY_HERE"
$Url = "https://api.controlup.com/compliance/devices"
$Headers = @{
"Authorization" = "Bearer $ApiKey"
"Accept" = "application/json"
}
Write-Host "==============================================="
Write-Host " CONTROLUP API VALIDATION TEST"
Write-Host "==============================================="
Write-Host "Request URL: $Url"
Write-Host "Auth Header: Bearer * (hidden)"
Write-Host "Timestamp : $(Get-Date -Format ‘yyyy-MM-dd HH:mm:ss’)"
Write-Host "———————————————–"
try {
# Use Invoke-WebRequest to expose status code & raw content
$ProgressPreference = ‘SilentlyContinue’
$Response = Invoke-WebRequest -Uri $Url -Headers $Headers -Method GET -ErrorAction Stop
Write-Host "[OK] HTTP Request Completed Successfully" -ForegroundColor Green
Write-Host "HTTP Status Code : $($Response.StatusCode)"
Write-Host "Content Length : $($Response.RawContentLength)"
Write-Host "———————————————–"
# Parse JSON
$Json = $Response.Content | ConvertFrom-Json
Write-Host "Parsed Device Count: $($Json.devices.Count)"
Write-Host "———————————————–"
Write-Host "Sample Devices:" -ForegroundColor Cyan
$Json.devices |
Select-Object id, name, lastSeen, status |
Format-Table -AutoSize
}
catch {
Write-Host "[ERROR] Failed to call API" -ForegroundColor Red
Write-Host "———————————————–"
if ($_.Exception.Response) {
$RespStream = $_.Exception.Response.GetResponseStream()
$Reader = New-Object System.IO.StreamReader($RespStream)
$Body = $Reader.ReadToEnd()
Write-Host "HTTP Status: $($_.Exception.Response.StatusCode)" -ForegroundColor Yellow
Write-Host "Status Desc: $($_.Exception.Response.StatusDescription)"
Write-Host "Error Body:"
Write-Host $Body
}
else {
Write-Host "General Exception: $($_.Exception.Message)"
}
Write-Host "———————————————–"
}“`
you should see result like this

@member We rechecked and we believe we found the issue. now fixed. Kindly try again and let us know if you are still getting 502.
@member that has now worked, thank you 🙂
Continue reading and comment on the thread ‘Troubleshooting and Validating ControlUp’s Compliance API’. Not a member? Join Here!
Categories: All Archives, ControlUp for Compliance, ControlUp Scripts & Triggers
