Skip to main content
PATCH
/
v1
/
asset
/
labels
Update Asset Labels
curl --request PATCH \
  --url https://api.projectdiscovery.io/v1/asset/labels \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '{
  "filters": {
    "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_id": "<string>",
    "only_dns": true,
    "only_ip": true
  },
  "labels": [
    "<string>"
  ]
}'
{
  "message": "<string>",
  "asset_count": 123,
  "async": true
}
When filters are empty or not specified, this operation applies to ALL assets in your account. Always specify filters to target specific assets unless you intentionally want to update your entire asset inventory.

Overview

Bulk update labels across multiple assets using powerful filters. This endpoint allows you to add, replace, or delete labels on many assets at once, making it ideal for organizing large asset inventories efficiently.

Key Features

Flexible Update Modes

  • Append: Add new labels without removing existing ones
  • Replace: Replace all existing labels with new ones
  • Delete: Remove specific labels from assets

Filter-Based Selection

Apply labels to assets that match your filter criteria:
  • Technology stack (e.g., all WordPress sites)
  • Port numbers (e.g., assets with port 443)
  • Status codes (e.g., all 200 responses)
  • Domains, hosts, IP addresses
  • Custom filters for complex queries

Asynchronous Processing

Large operations are processed asynchronously, allowing you to label thousands of assets without waiting for the request to complete.

Update Modes Explained

Append Mode (Default)

Adds new labels while preserving existing ones:
  • Existing labels: ["prod", "api"]
  • New labels: ["critical"]
  • Result: ["prod", "api", "critical"]

Replace Mode

Replaces all existing labels with new ones:
  • Existing labels: ["prod", "api"]
  • New labels: ["critical", "review"]
  • Result: ["critical", "review"]

Delete Mode

Removes specific labels from assets:
  • Existing labels: ["prod", "api", "critical"]
  • Labels to delete: ["critical"]
  • Result: ["prod", "api"]

Request Body Structure

Target specific assets using filters:
{
  "filters": {
    "technologies": "wordpress,nginx",
    "domain": ["example.com", "api.example.com"],
    "port": "443,8080",
    "status_code": "200,301",
    "is_new": true,
    "labels": "existing-label",
    "time": "last_week",
    "custom_filter": "encoded_custom_query"
  },
  "labels": ["label1", "label2", "label3"]
}

Without Filters (Applies to ALL Assets)

This will update every asset in your account:
{
  "filters": {},
  "labels": ["label-for-all-assets"]
}
Example:
# This deletes "test1" label from ALL assets in your account
curl -X PATCH "https://api.projectdiscovery.io/v1/asset/labels?update_type=delete" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "filters": {},
    "labels": ["test1"]
  }'

Response

Synchronous Response

For small operations:
{
  "message": "Labels updated successfully",
  "asset_count": 42,
  "async": false
}

Asynchronous Response

For large operations:
{
  "message": "Label update queued",
  "asset_count": 5000,
  "async": true
}

Available Filters

FilterDescriptionExample
technologiesFilter by technology stack"wordpress,nginx"
domainFilter by domain names["example.com"]
hostFilter by specific hosts"https://api.example.com"
portFilter by port numbers"443,8080"
status_codeFilter by HTTP status codes"200,301,404"
titleFilter by page titles"Admin Panel"
ipFilter by IP addresses"192.168.1.1"
cnameFilter by CNAME records"cdn.example.com"
is_newFilter only new assetstrue
is_techAssets with technology datatrue
is_screenshotAssets with screenshotstrue
labelsFilter by existing labels"prod,api"
timeTime range filter"last_week"
enumeration_idSpecific enumeration"enum_123"

Authorizations

X-API-Key
string
header
required

Headers

X-Team-Id
string

Query Parameters

update_type
enum<string>
default:append

Append or Replace update_type

Available options:
append,
replace,
delete

Body

application/json
filters
object
required
labels
string[]
required

Response

Example response

message
string
required
asset_count
integer
required
async
boolean
required

Whether the operation is running asynchronously