Grant viewer or editor access to a private file

Grant viewer or editor permissions on a private file to users (including service accounts) in the owning group or to the owning group itself.

🚧

Premium feature

Private Scanning is only available to VirusTotal Enterprise users with a Private Scanning license.

Use this endpoint to grant viewer or editor permissions on a Private File to:

  • Individual users (including service accounts) in the owning VirusTotal group.
  • The owning group itself.

This endpoint is restricted to the file's owner, group administrators of the owning group, and existing editors. The owner relationship is read-only, and the file's owner cannot be added to viewers or editors.

Adding an existing viewer to editors (or an existing editor to viewers) automatically moves them to the new role. The operation is idempotent and returns 200 OK with an empty response body on success.

This is an example request body:

{
  "data": [
    {
      "id": "<user_id>",
      "type": "user"
    },
    {
      "id": "<group_id>",
      "type": "group"
    }
  ]
}

To revoke access, see Revoke viewer or editor access from a private file. For full sharing rules, see Sharing private analyses.

Examples

Grant editor access to a user in the owning group:

import requests

file_id = "275a021bbfb6489e54d471899f7db9d1663fc695ec2fe2a2c4538aabf651fd0f"
url = f"https://www.virustotal.com/api/v3/private/files/{file_id}/relationships/editors"
payload = {
    "data": [
        {"type": "user", "id": "analyst_username"}
    ]
}
headers = {
    "x-apikey": "<api-key>",
    "content-type": "application/json",
}
response = requests.post(url, json=payload, headers=headers)

Grant viewer access to the owning group:

import requests

file_id = "275a021bbfb6489e54d471899f7db9d1663fc695ec2fe2a2c4538aabf651fd0f"
url = f"https://www.virustotal.com/api/v3/private/files/{file_id}/relationships/viewers"
payload = {
    "data": [
        {"type": "group", "id": "my_group_id"}
    ]
}
headers = {
    "x-apikey": "<api-key>",
    "content-type": "application/json",
}
response = requests.post(url, json=payload, headers=headers)
Path Params
string
required

File's SHA-256

string
enum
required

Sharing relationship to grant (viewers or editors). owner is read-only.

Allowed:
Body Params
data
array of objects
required

Array of user (including service accounts) and/or owning group descriptors.

data*
Headers
string
required

Your API key

Responses
200

200 OK (empty response body)

Language
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json