cURL
curl --request PATCH \ --url https://api.projectdiscovery.io/v1/asset/{asset_id}/labels \ --header 'Content-Type: application/json' \ --header 'X-API-Key: <api-key>' \ --data ' { "labels": [ "<string>" ] } '
{ "message": "<string>" }
curl -X PATCH "https://api.projectdiscovery.io/v1/asset/123456/labels?update_type=append" \ -H "X-Api-Key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "labels": ["new-label"] }'
curl -X PATCH "https://api.projectdiscovery.io/v1/asset/123456/labels?update_type=replace" \ -H "X-Api-Key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "labels": ["only-these-labels"] }'
curl -X PATCH "https://api.projectdiscovery.io/v1/asset/123456/labels?update_type=delete" \ -H "X-Api-Key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "labels": ["remove-this-label"] }'
update_type
append
replace
delete
{ "labels": ["label1", "label2", "label3"] }
{ "message": "Asset labels updated successfully" }
{ "id": 123456, "name": "https://api.example.com", "labels": ["production", "api"] }
curl -X PATCH "https://api.projectdiscovery.io/v1/asset/123456/labels?update_type=append" \ -H "X-Api-Key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "labels": ["critical", "monitoring"] }'
{ "id": 123456, "name": "https://api.example.com", "labels": ["production", "api", "critical", "monitoring"] }
{ "id": 123456, "name": "https://api.example.com", "labels": ["production", "api", "old-label", "deprecated"] }
curl -X PATCH "https://api.projectdiscovery.io/v1/asset/123456/labels?update_type=replace" \ -H "X-Api-Key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "labels": ["staging", "testing"] }'
{ "id": 123456, "name": "https://api.example.com", "labels": ["staging", "testing"] }
{ "id": 123456, "name": "https://api.example.com", "labels": ["production", "api", "needs-review", "temporary"] }
curl -X PATCH "https://api.projectdiscovery.io/v1/asset/123456/labels?update_type=delete" \ -H "X-Api-Key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "labels": ["needs-review", "temporary"] }'
# Change from staging to production curl -X PATCH "https://api.projectdiscovery.io/v1/asset/123456/labels?update_type=replace" \ -H "X-Api-Key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "labels": ["production", "critical", "monitored"] }'
# Remove temporary labels after review curl -X PATCH "https://api.projectdiscovery.io/v1/asset/123456/labels?update_type=delete" \ -H "X-Api-Key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "labels": ["under-review", "pending"] }'
# Upgrade to high priority curl -X PATCH "https://api.projectdiscovery.io/v1/asset/123456/labels?update_type=delete" \ -H "X-Api-Key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"labels": ["low-priority"]}' curl -X PATCH "https://api.projectdiscovery.io/v1/asset/123456/labels?update_type=append" \ -H "X-Api-Key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"labels": ["high-priority"]}'
Append or Replace update_type
Example response
Was this page helpful?