post
https://www.virustotal.com/api/v3/saved_searches//relationship/
Use this endpoint to grant viewer or editor permissions to a certain saved search for:
- individual users
- owner's group
This endpoint is restricted to use by the owner and editors of the saved search only.
Note that **editor** privileges can **only be granted to members belonging to the same group as the owner** of the saved search.This is an example request body:
{
"data": [
{
"id": "user id",
"type": "user"
},
{
"id": "group id",
"type": "group"
}
]
}
To revoke the access to a saved search check out this endpoint.
Examples
Grant view access to all members of my group for the saved search with ID f60631d600b44a91a8b20cef8c77aeac.
import requests
object_id = "f60631d600b44a91a8b20cef8c77aeac"
access = "viewers"
url = f"https://www.virustotal.com/api/v3/saved_searches/{object_id}/relationship/{access}"
payload = {
"data": [
{
"id": "my_group_id",
"type": "group"
}
]
}
headers = {"accept": "application/json","x-apikey": <api-key>,"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
Grant edit access to ana and alex for the saved search with ID f60631d600b44a91a8b20cef8c77aeac.
import requests
object_id = "f60631d600b44a91a8b20cef8c77aeac"
access = "editors"
url = f"https://www.virustotal.com/api/v3/saved_searches/{object_id}/relationship/{access}"
payload = {
"data": [
{
"id": "ana",
"type": "user"
},
{
"id": "alex",
"type": "user"
}
]
}
headers = {"accept": "application/json","x-apikey": <api-key>,"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
