post https://www.virustotal.com/api/v3/collections//
As explained in /collections, for the urls
relationship you either use {"type": "url", "url": <a URL string>}
or {"type": "url", "id": <a sha256 URL identifier>}
as object descriptors. For domains and IP addresses you can use {"type": "domain", "id": <a domain>}
or {"type": "ip_address", "id": <an IP address>}
.
Examples
Add new elements, google.com
and virustotal.com
domains, to an existing IoC collection.
import requests
object_id = "bd4dbd7a189ca9a31cb1b0bdbe64aaba6aa1454ddcfde707518b811d2bc5b363"
relationship = "domains"
url = f"https://www.virustotal.com/api/v3/collections/{object_id}/{relationship}"
payload = { "data":
[
{
"type": "domain",
"id": "google.com"
},
{
"type": "domain",
"id": "virustotal.com"
}
]
}
headers = {
"accept": "application/json","x-apikey": <api-key>,"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)