When integrating with the Hyperproof API, managing scoped controls is a critical part of the process. This article explains the essential concepts and shows you how to work with scoped controls—from retrieving scope data to updating assignments through API calls.
A scoped control is the child control of a parent control. Scoped controls have a variety of use cases, but the most common is to track proof collection on controls for subdivisions of an organization. For more information, refer to Working with scopes.
When a scope is assigned to a control in the UI, Hyperproof generates a new child control. This control includes a parentControlId that links it to the original control, maintaining a clear hierarchy and ensuring each scoped control can be traced back to its source.
If you call https://api.hyperproof.app/v1/controls/{controlId} to retrieve a control’s details, you may notice that scopeName and other scope-related fields aren’t included in the response. That's expected behavior.
Use the GET /controls endpoint with the expandscopes=true query parameter. This returns additional scoped-control details, including:
- Controls that have a
parentControlId, indicating their parent control. - The associated
scopeIdandscopeNamefor each scoped control.
GET https://api.hyperproof.app/v1/controls?expandscopes=trueTo update the scope of an existing control, issue a PATCH request to https://api.hyperproof.app/v1/controls/{controlId}. Be sure to include the scopeId you want to assign in the request body. This links the control to the specified scope.
Note: Because there's no API endpoint to list all available
scopeIds, thescopeIdmust be determined beforehand. To get thescopeId, run theGET /controls?expandscopes=truecall. Be sure to double-check that thescopeIdis valid for your Hyperproof setup before sending the request.
PATCH https://api.hyperproof.app/v1/controls/{controlId}
Content-Type: application/json
{
"scopeId": "desiredScopeId"
}If you’re creating a control from scratch, you can assign a scope right away with the POST /controls endpoint. Be sure to use the desired scopeId in the request payload alongside other control details.
Note: This action creates a NEW control that can be used as a parent. Child controls are not created using the API.
Currently, the creation of scoped child controls on existing controls is not supported.
POST https://api.hyperproof.app/v1/controls
Content-Type: application/json
{
"name": "New Control Name",
"scopeId": "desiredScopeId",
...other control properties...
}Since there is no dedicated endpoint for listing scopeIds, the recommended approach for finding scope IDs is to query controls with the expandscopes=true parameter or retrieve the IDs directly from the Hyperproof UI.