Skip to main content
PATCH
/
v1
/
asset
/
policy
/
{policy_id}
Update asset policy
curl --request PATCH \
  --url https://api.projectdiscovery.io/v1/asset/policy/{policy_id} \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "policies": {
    "is_tech": true,
    "is_favicon": true,
    "is_new": true,
    "labels": "<string>",
    "host": "<string>",
    "port": "<string>",
    "status_code": "<string>",
    "content_length": "<string>",
    "title": "<string>",
    "domain": [
      "<string>"
    ],
    "cname": "<string>",
    "technologies": "<string>",
    "ip": "<string>",
    "is_screenshot": true,
    "time": "last_day",
    "start_date": "2023-12-25",
    "end_date": "2023-12-25",
    "custom_filter": "<string>",
    "search": "<string>",
    "enumeration_ids": [
      "<string>"
    ],
    "only_dns": true,
    "only_ip": true
  },
  "name": "<string>",
  "enumeration_ids": [
    "<string>"
  ],
  "policy_type": "alert",
  "labels": [
    "<string>"
  ],
  "alerting_config_ids": [
    "<string>"
  ],
  "apply_to_existing": true
}
'
{
  "message": "<string>",
  "id": "<string>"
}
The update_type query parameter controls how values are merged:
ModeBehavior
append (default)Merges new values with existing ones. For example, adding new alerting_config_ids keeps the current ones.
replaceCompletely overwrites the policy. All required fields for the policy type must be provided.
In replace mode, alerting_config_ids is required for alert policies and labels is required for set_label/remove_label policies.

Example Requests

Append new labels to an existing policy

curl -X PATCH "https://api.projectdiscovery.io/v1/asset/policy/POLICY_ID?update_type=append" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "labels": ["new-label"]
  }'

Replace policy conditions entirely

curl -X PATCH "https://api.projectdiscovery.io/v1/asset/policy/POLICY_ID?update_type=replace" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Updated policy",
    "policy_type": "delete",
    "policies": {
      "host": "staging.example.com",
      "status_code": "503"
    }
  }'

Authorizations

X-API-Key
string
header
required

Path Parameters

policy_id
string
required

Unique identifier of the asset policy

Query Parameters

update_type
enum<string>

Update strategy. append (default) merges new values with existing ones. replace overwrites the entire policy — all required fields for the policy type must be provided.

Available options:
append,
replace

Body

application/json
policies
AssetFilters · object
name
string

Display name for the policy

enumeration_ids
string[]

Optional list of enumeration IDs to scope this policy to specific enumerations

policy_type
enum<string>

Type of action to perform when policy matches assets

Available options:
alert,
delete,
set_label,
remove_label
labels
string[]

List of labels to apply/remove (required when policy_type is set_label or remove_label). In append mode, merged with existing labels. In replace mode, replaces all labels.

alerting_config_ids
string[]

List of alerting configuration IDs (required when policy_type is alert). In append mode, merged with existing configs. In replace mode, replaces all configs.

apply_to_existing
boolean

When true, the policy action is applied to existing matching assets in addition to future assets.

Response

OK

message
string
id
string