alert-policies

Update Org Alert Policy

Changed on

Update an alert policy. Only the provided fields change; repository_ids replaces the full set of repositories the policy scopes to. The default policy cannot be renamed and its scope is implicit. Requires a token with org-wide repository access; repo-restricted tokens receive 403.

This endpoint consumes 1 unit of your quota.

This endpoint requires the following org token scopes:

  • alert-policy:update
put/orgs/{org_slug}/alert-policies/{policy_id}

Request

  • Base URL
    https://api.socket.dev/v0
  • URL
    https://api.socket.dev/v0/orgs/{org_slug}/alert-policies/{policy_id}
  • Auth
    • HTTP bearer
    • or HTTP basic

Path parameters

org_slugstring required

The slug of the organization

policy_idstring required

The ID of the alert policy: a UUID, or default for the default policy

Query parameters

dry_runboolean

Rehearse the write: authorize and validate the request and return the response body a real write would produce, then discard it. Accepts true, 1, or yes. Other present values return 400 so a typo cannot persist. Nothing is persisted. A dry-run success is HTTP 200 with dry_run: true, not 201.

Request body

namestring

The policy name (1-120 characters). The default policy cannot be renamed.

descriptionstring nullable

Operator-provided description (up to 256 characters).

repository_idsstring[] nullable

Full replacement set of repositories the policy scopes to. The default policy scope is implicit and cannot be set.

baselinestring nullable

Baseline rule bundle the policy starts from. One of: essential, balanced, comprehensive. Null to remove the baseline.

Response

The updated alert policy. Dry-run responses include dry_run: true and were not persisted.

idstring required

The ID of the policy: a UUID, or default for the default policy until it is first customized.

namestring nullable required

The policy name. Null for the default policy, which applies to all repositories without a policy label.

descriptionstring nullable required

Operator-provided description.

apply_method'labeled_repos' | 'unlabeled_repos' required

How the policy scopes to repositories: labeled_repos applies to repositories carrying the policy repo label; unlabeled_repos is the default policy for all unlabeled repositories.

repo_label_idstring nullable required

The repo label that scopes this policy. Null for the default policy.

repository_idsstring[] required

Repositories the policy scopes to. Empty for the default policy and for policies with no repository assignments.

baselinestring nullable required

Baseline rule bundle the policy starts from. One of: essential, balanced, comprehensive. Null when the policy has no baseline.

created_bystring nullable required

User ID that created the policy.

updated_bystring nullable required

User ID that last updated the policy.

created_atstring nullable required

ISO-8601 creation timestamp. Null for the default policy until it is first customized.

updated_atstring nullable required

ISO-8601 last-update timestamp. Null for the default policy until it is first customized.

dry_runboolean

True when ?dry_run=true (or 1 / yes) rehearsed the write; nothing was persisted.

Changes