patch https://www.virustotal.com/api/v3/collections/
This endpoint allows updating an IoC collection's attributes (such as name or description) and adding new elements to the IoC collection by using a raw text.
The following request body shows an example of how to update an IoC collection's name and add new IOCs to it by using a raw text:
{
"data": {
"attributes": {
"name": "Updating the name"
},
"raw_items": "This is a text containing a IoC, www.virustotal.com",
"type": "collection"
}
}
Examples
Change the name and description of a private IoC collection.
import requests
object_id = "bd4dbd7a189ca9a31cb1b0bdbe64aaba6aa1454ddcfde707518b811d2bc5b363"
url = f"https://www.virustotal.com/api/v3/collections/{object_id}"
payload = { "data":
{
"type": "collection",
"attributes":
{
"name": "New name",
"description": "New description."
}
}
}
headers = {
"accept": "application/json","x-apikey": <api-key>,"content-type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
Make public a private IoC collection.
import requests
object_id = "bd4dbd7a189ca9a31cb1b0bdbe64aaba6aa1454ddcfde707518b811d2bc5b363"
url = f"https://www.virustotal.com/api/v3/collections/{object_id}"
payload = { "data":
{
"type": "collection",
"attributes":
{
"private": False
}
}
}
headers = {
"accept": "application/json","x-apikey": <api-key>,"content-type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)