For pre-receive hooks which are allowed to be configured at the org level, you can set
enforcement and allow_downstream_configuration
PATCH /orgs/:org/pre-receive-hooks/:pre_receive_hook_id
{
"enforcement": "enabled",
"allow_downstream_configuration": false
}
Status: 200 OK
{
"id": 42,
"name": "Check Commits",
"enforcement": "enabled",
"configuration_url": "https://github.example.com/api/v3/orgs/octocat/pre-receive-hooks/42",
"allow_downstream_configuration": false
}