Skip to main content
PUT
/
api
/
v1
/
deployments
/
{deploymentId}
/
policies
/
{policyId}
Update policy
curl --request PUT \
  --url https://semgrep.dev/api/v1/deployments/{deploymentId}/policies/{policyId} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "deploymentId": 123,
  "policyId": 456,
  "rulePath": "<string>"
}
'
{
  "policyId": "1",
  "updatedRule": {
    "category": "security",
    "confidence": "CONFIDENCE_HIGH",
    "cweCategories": [
      "CWE-918: Server-Side Request Forgery (SSRF)"
    ],
    "hasValidators": true,
    "id": "<string>",
    "languages": [
      "python"
    ],
    "lastChangeAt": "2024-07-29T22:33:37.380Z",
    "lastChangeBy": "<string>",
    "owaspCategories": [
      "A07: Cross-Site Scripting (XSS)"
    ],
    "path": "python.rule.1",
    "policyMode": "MODE_BLOCK",
    "registryMaintainer": "semgrep",
    "rulesets": [],
    "secretType": "<string>",
    "severity": "SEVERITY_HIGH",
    "source": "SOURCE_COMMUNITY",
    "technologies": [
      "django",
      "flask"
    ],
    "url": "<string>",
    "vulnerabilityClass": "Improper Authentication"
  }
}

Documentation Index

Fetch the complete documentation index at: https://docs.semgrep.dev/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

Authorization
string
header
required

Get access to data with your API token. Example header:

Authorization: Bearer 2991e2fb4b540fe75b8f90677b0b892b6314e4961cb001fe6eb452eee248a628

The token can be provisioned from the Tokens section in your Settings, and requires explicitly enabling Web API access.

Path Parameters

deploymentId
string<uint64>
required

Deployment ID (numeric). Example: 123. Can be found at /deployments, or in your Settings in the web UI.

Example:

123

policyId
string<uint64>
required

Policy ID (numeric). Example: 456. Can be found at /deployments/{deploymentId}/policies.

Example:

456

Body

application/json
deploymentId
string<uint64>

Deployment ID (numeric). Example: 123. Can be found at /deployments, or in your Settings in the web UI.

Example:

123

policyId
string<uint64>

Policy ID (numeric). Example: 456. Can be found at /deployments/{deploymentId}/policies.

Example:

456

policyMode
enum<string>

New policy mode to set for the Rule.

  • MODE_MONITOR: Monitor mode, silently report findings
  • MODE_COMMENT: Comment mode, leaves PR comments but does not block
  • MODE_BLOCK: Block mode, leaves PR comments and blocks PR
  • MODE_DISABLED: Disabled mode, not active
valuedescription
MODE_MONITORMonitor mode, silently report findings
MODE_COMMENTComment mode, leaves PR comments but does not block
MODE_BLOCKBlock mode, leaves PR comments and blocks PR
MODE_DISABLEDDisabled mode, not active
Available options:
MODE_MONITOR,
MODE_COMMENT,
MODE_BLOCK,
MODE_DISABLED
rulePath
string

Full path of the Rule.

Response

200 - application/json

OK

policyId
string<uint64>

Policy ID (numeric). Example: 456. Can be found at /deployments/{deploymentId}/policies.

Example:

"1"

updatedRule
Rule · object