This chapter describes the REST API calls that can be used with MetaDefender Vault. Through the Application’s Interface, any 3rd party application can interact and communicate directly with MetaDefender Vault. This allows you to add MetaDefender Vault to your automated workflow. Each call should include an authentication key or user credentials (username and password) or use 8.4 API Keys.

About this REST API

The exposed endpoint is located by default at http://localhost:8010/vault_rest/ (i.e. for Initialize Group Transfer the endpoint is http://localhost:8010/vault_rest/transfer).

All endpoints require you to provide the Authorization header. The value for this header should be obtained by calling Request An API Key. Please note that an authentication key has a limited lifetime and it should be refreshed to avoid expiration policy.

In order to change the URL it is recommended to use the Protocol Configuration Tool(located by default in C:\Program Files\OPSWAT\MetaDefender Vault\Tools).

This URL can also be changed directly from the configuration file by following these steps:

  1. Go to the installation directory (by default C:\Program Files\OPSWAT\MetaDefender Vault)

  2. Navigate to the WebServer/conf folder

  3. Open the file called dynamic.conf using administrative privileges

  4. Edit the following section of the configuration file as you wish:

    listen <ip_address>:<port>;
    server_name "<machine_name>";

    Or, in case of TLS/SSL:

    listen <ip_address>:<port> ssl;
    server_name "<machine_name>";
    ssl_certificate "<certificate_path>";
    ssl_certificate_key "<certificate_key_path>";
    ssl_password_file "<password_file_path>";
  5. Restart MetaDefender Vault Helper Service (vaultHelper) for changes to apply.

Server
http://localhost:8010
Server Variables

Authentication Management

Overview

These APIs provide functionality to create, update and delete API keys. The first step should be to Request an API key before continuing with other API calls.

Request An API Key

Summary

This API allows a user to sign in and obtain an API key to use in subsequent API requests.

Use Cases (used by)

All clients accessing MetaDefender Vault REST must call this API first to obtain an API key.

The token required in the Authorization header is formed by joining the account's username and password, using the windows newline separator (CRLF - \r\n) as delimiter.

Example

Username: JohnDoe

Password: SecretPassword

Token: encodeBase64("JohnDoe\r\nSecretPassword")

Authorization: Basic Sm9obkRvZQ0KU2VjcmV0UGFzc3dvcmQ=

Auth
GET /vault_rest/authenticate
Copy
Responses
200

OK

objectobject
Response
Copy

Cancel Or Expire An API Key

Use Cases (used by)

Used by the user interface when the user logs out.

Auth
DELETE /vault_rest/authenticate
Copy
Responses
200

OK

objectobject
Response
Copy

Extend API Key

Summary

This API allows a user to extend an API key.

Use Cases (used by)

Used by clients that want to prevent an API to expire due to inactivity or change the expiration of an existing generated API key.

Auth
Headers
Tokenstring

The API key that you wish to extend. *Note: If this header is not present the API key from Authorization header will be used instead

ExtendBystring

Parameter value must be a time span (hh:mm:ss) value how long to extend the API key. If this parameter is not specified a default server value is used. Max value is 24h: 23:59:59

ExtendUntilnumber

Used to adjust 3rd party API key expiration date. Date should be specified in UTC, for example: 2016-01-02T12:00:00.0000000Z

Request Body
objectobject
PUT /vault_rest/token
Copy
Responses
200

OK

objectobject
Response
Copy

Create A 3rd Party API Key

Summary

This API allows you to create API keys to be used by 3rd party applications.

Auth
Request Body
objectobject
POST /vault_rest/token
Copy
Responses
200

OK

objectobject
Response
Copy

Enumerate API Keys

Summary

Returns a list of API keys generated by this user to allow 3rd party applications to connect to MetaDefender Vault .

Use Cases

Used by the web user interface to display generated API keys.

Auth
Headers
sort_columnstring

Possible values: Token, Created, Expires, Description, Role

sort_directionstring

Possible values, asc, desc

findstring

Searches Token & Description

findB64string

Free text search string (Base64 encoded to support all charsets). Will override any value specified in 'find' header.

Path Params
startinteger

[required] Zero based position in list from where to start returning data

countinteger

[required] Maximum number of list entries to return

GET /vault_rest/tokens/{start}/{count}
Copy
Responses
200

OK

objectobject
Response
Copy

Download a file

Summary

This API call allows you to download the files stored in MetaDefender Vault.

The call should be made to vault_rest/file/{file_id} through a GET request. Please note that you need to obtain {file_id} in order to retrieve the file.

Auth
Path Params
file_idstring

[required] Id of the file you wish to download

GET /vault_rest/file/{file_id}
Copy
Responses
200

Successful response

filefile
Response
Copy

Delete A File

Summary

Delete a file from the MetaDefender Vault storage. This API will only mark the file for deletion. The file will be physically deleted by the background worker.

Permissions Restrictions

Administrators can delete any file, including other user's files. Users can only delete their own files.

Auth
Path Params
file_idstring

[required] ID of file to delete

DELETE /vault_rest/file/{file_id}
Copy
Responses
200

Successful response

No response body
Response
Copy

Move A File

Summary

This API allows moving one or multiple files in MetaDefender Vault.

Auth
Request Body
objectobject
PUT /vault_rest/v2/move_files
Copy
Responses
200

Successful response

objectobject
Response
Copy

Rename A File

Summary

This API allows renaming a file in MetaDefender Vault.

Auth
Request Body
objectobject
PUT /vault_rest/rename_file
Copy
Responses
200

Successful response

No response body
Response
Copy

Share A File

Summary

This API allows sharing a file in MetaDefender Vault.

Auth
Request Body
objectobject
POST /vault_rest/update_file_share
Copy
Responses
200

Successful response

No response body
Response
Copy

Query File status

Summary

This API lets you query the current status of a file in MetaDefender Vault.

Auth
Path Params
file_idstring

[required] File ID of MetaDefender Vault file returned by Upload file call.

GET /vault_rest/file/status/{file_id}
Copy
Responses
200

OK

objectobject

Enumerate Files

Summary

Retrieve a list of the user's files.

Auth
Headers
sort_columnstring

Possible values: expires, name, size

sort_directionstring

Possible values: asc, desc

findstring

Free text search string (Use only with English characters)

findB64string

Free text search string (Base64 encoded to support all charsets). Will override any value specified in 'find' header.

columnsstring

Possible values: SearchId, FileTransferId, Subject, Body, Sender, Recepiet, FileName

AvailabilityStatestring

By default Files of all availability states are returned. To return files of certain states, specify them in the header (separate multiple states with a , (comma)) Possible states:

Composing QueuedForProcessing BeingProcessed Available Expired Deleted Blocked BlockedNoSanitization ProcessingFailed

Path Params
typestring

[required] Return entries of this specific type. Possible values: my, all

startstring

[required] Zero based position in list from where to start returning data

countstring

[required] Maximum number of list entries to return

GET /vault_rest/files/{type}/{start}/{count}
Copy
Responses
200

OK

objectobject
Response
Copy

Delete Multiple Files

Summary

Delete a group of files from the MetaDefender Managed File Transfer storage. This API will only mark the files for deletion. The files will be physically removed by a background worker.

Permissions Restrictions

Administrators can delete any file, including other user's files. Users can only delete their own files.

Auth
Request Body
DELETE /vault_rest/files
Copy
Responses
200

OK

objectobject
Response
Copy

Get file tags

This API endpoint, provides a list of {file_id} file's tags

Auth
GET /vault_rest/file_tags/{file_id}
Copy
Responses
200

Successful response

stringstring
Response
Copy

Add/Modify file tags

This API endpoint, allows user to modify file tags

Auth
Request Body
objectobject
PUT /vault_rest/file_tags
Copy
Responses
200

Successful response

No response body
Response
Copy

Modify a guest account

This API endpoint, allows the user to remove guest account.

Auth
Request Body
objectobject
PUT /vault_rest/guest
Copy
Responses
200

Successful response

objectobject
Response
Copy

Create a guest account

This API endpoint, allows user to create guest account

Auth
Request Body
objectobject
POST /vault_rest/guest
Copy
Responses
200

Successful response

No response body
Response
Copy

Enumerate accounts

This API endpoint, with the {type} parameter supporting options like local, external, guest, or active directory, provides a response containing a list of accounts.

Auth
Headers
findstring

Free text search string

findB64string

Free text search string (Base64 encoded to support all charsets). Will override any value specified in 'find' header.

sort_columnstring

Allows users to specify the column by which the query results should be sorted.

sort_directionstring

Allows them to specify whether the results should be in ascending or descending order.

Path Params
startstring

[required] Zero based position in list from where to start returning data

countstring

[required] Maximum number of list entries to return

typestring

[required] Account type

GET /vault_rest/accounts/{type}/{start}/{count}
Copy
Responses
200

Successful response

stringstring
Response
Copy

Create an account

This API endpoint, allows user to create an account

Auth
Request Body
objectobject
POST /vault_rest/account
Copy
Responses
200

Successful response

No response body
Response
Copy

Modify an account

This API endpoint, allows user to modify an account

Auth
Path Params
idstring

Account id

Request Body
objectobject
PUT /vault_rest/accounts/{id}
Copy
Responses
200

Successful response

objectobject
Response
Copy

Delete account(s)

This API endpoint, allows the removal of a user account, permanently erasing associated data and terminating access.

Auth
Request Body
objectobject
DELETE /vault_rest/accounts
Copy
Responses
200

Successful response

objectobject
Response
Copy

Get account details

This API endpoint, allows user to get an account's detailed info

Auth
GET /vault_rest/account/{id}
Copy
Responses
200

Successful response

No response body
Response
Copy

Archive Download

Overview

These APIs enable downloading of multiple files or folders as an archive from MetaDefender Vault.

Workflow

In order to start the process please follow these steps:

  1. Create an archive by calling Create Archive
  2. Wait until the archive is created by polling Get Archive Status
  3. Once the archive is available, you can obtain it by calling Download Archive

Error Handling

If an error prevents you from downloading the archive or you simply wish to stop the process or discard the archive, you can call Cancel Archive Download. Please note that it’s not mandatory to call this endpoint after a successful download because there is an automatic cleanup mechanism that will remove archives after they are downloaded.

Cancel Archive Download

Summary

This API allows the cancelation of a previously created archive.

Auth
Path Params
idstring

[required] Unique identifier of the archive to be canceled

Request Body
objectobject
PUT /vault_rest/cancel_archive_download/{id}
Copy
Responses
200

Successful response

No response body
Response
Copy

Create Archive

Summary

This API allows creating an archive containing multiple folders and files from MetaDefender Vault. This API will only initiate the archiving process, you need to use Get Archive Status to obtain the status of the archiving process and then download it.

Auth
Request Body
objectobject
POST /vault_rest/create_archive_download
Copy
Responses
200

OK

stringstring
Response
Copy

Download Archive

Summary

This API downloads an archive from MetaDefender Vault.

Auth
Path Params
idstring

[required] Unique identifier of the public archive.

GET /vault_rest/archive_download/{id}
Copy
Responses
200

Successful response

No response body
Response
Copy

Get Archive Status

Auth
Path Params
idstring

[required] Unique identifier of the archive.

GET /vault_rest/archive_download_status/{id}
Copy
Responses
200

Successful response

No response body
Response
Copy

Audit Events

Overview

View and export audit events.

Enumerate Audit Events

Auth
Headers
sort_columnstring

Possible values: date, description, event, location, status, user

sort_directionstring

Possible values: asc, desc

findstring

Free text search string

findB64string

Free text search string (Base64 encoded to support all charsets). Will override any value specified in 'find' header.

Path Params
startstring

[required] Zero based position in list from where to start returning data

countstring

[required] Maximum number of list entries to return

GET /vault_rest/audit/{start}/{count}
Copy
Responses
200

Successful response

No response body
Response
Copy

Export Audit Events

Auth
Query String
localestring
GET /vault_rest/audit/export
Copy
Responses
200

Successful response

No response body
Response
Copy

File Upload

Workflow

To upload one or more files in chunks to MetaDefender Vault , follow the workflow below:

  1. Create a transfer group by calling Initialize Group Transfer
  2. Create a file transfer by calling Initialize File Transfer
  3. Upload file chunks by calling Upload file chunk until the complete file is uploaded
  4. Call Complete File Transfer to commit the uploaded file in MetaDefender Vault .
  5. Repeat step 2 - 4 to upload additional files in the same group.
  6. Call Complete Group Transfer to commit the transfer in MetaDefender Vault and make it available for download.

Error Handling

During steps 3 to 5, it is possible to delete a partially/completely uploaded file by calling Delete File From File Transfer

During steps 2 to 5, it is possible to delete a group transfer (including any uploaded files) by calling Delete Group Transfer

Initialize group transfer

Permissions Restrictions

Even if the current API method is open to multiple user roles (i.e. Administrator and User), only the Administrator has a full set of permissions.

Administrators can impersonate users, or even other administrators.

For the User role, the permissions apply an even more strict rules set: they can only upload files in their own account - they don't have any impersonation rights. Although it's not something that applies directly to the current API method, it is worth mentioning that after a transfer has been started (i.e. this method has been called successfully), the other transfer methods (e.g. Init file transfer, Patch file, Complete File, etc.) will only be accessible to the user that has initiated the transfer (the one who's API key was used to make this request). No other user can alter a transfer that's in progress.

Auth
Headers
group_idstring

A unique transfer group id can be transmitted to support Diode scenarios. If no id has been specified MetaDefender Vault will generate a unique id. Must be a valid v4 UUID (RFC4122 standard).

impersonate_asstring

Must be a valid user or email address Note: please use impersonate_as header because send_as will be deprecated.

share_withstring

Must be one or more valid users or email addresses. Separate multiple entries with a comma (,). Note: please use share_with header because recipients will be deprecated.

subjectstring
messagestring
sourcestring

0 = REST (default) 1 = Kiosk 2 = WebUI

GET /vault_rest/transfer
Copy
Responses
200

Successful response

objectobject
Response
Copy

Complete group transfer

Permissions Restrictions

The API is limited to the user roles listed above (i.e. CO, Administrator, User), but assuming that a valid set of parameters is provided, including a group_id, only the transfer owner will be able alter the transfer.

Example:

The user test1 initiates a group transfer (i.e. calls /transfer successfully) and it receives a transfer group ID - group_id.

The user test2 tries to append a file to transfer with ID group_id. A 403 - Forbidden error will be returned stating that the user that has made the request is not authorized to alter the transfer.

The user test1 tries to append a file to the transfer - operation successful.

The user test1 completes the transfer by calling POST /transfer - operation successful.

Transfer with ID group_id will be accessible to the user until its expiration date.

Auth
Headers
group_idstring

A transfer group id obtained from the Initialize Group Transfer call.

expires_afterstring

Specify in DD:HH:MM:SS. Cannot be combined with 'expires' property.

The value ranges are the following:

  • Days, ranging from 1 to 9999;
  • Hours, ranging from 0 to 23;
  • Minutes, ranging from 0 to 59;
  • Optional seconds, ranging from 0 to 59.
POST /vault_rest/transfer
Copy
Responses
200

Successful response

objectobject
Response
Copy

Delete Group Transfer

Permissions Restrictions

The API is limited to the user roles listed above (i.e. CO, Administrator, User), but assuming that a valid set of parameters is provided, including a group_id, only the transfer owner will be able alter the transfer.

Example:

The user test1 initiates a group transfer (i.e. calls /transfer successfully) and it receives a transfer group ID - group_id.

The user test2 tries to append a file to transfer with ID group_id. A 403 - Forbidden error will be returned stating that the user that has made the request is not authorized to alter the transfer.

The user test1 tries to append a file to the transfer - operation successful.

The user test1 completes the transfer by calling POST /transfer - operation successful.

Transfer with ID group_id will be accessible to the user until its expiration date.

Auth
Headers
group_idstring

A transfer group id obtains from the Initialize Group Transfer call.

DELETE /vault_rest/transfer
Copy
Responses
200

Successful response

objectobject
Response
Copy

Initialize File Transfer

Permissions Restrictions

The API is limited to the user roles listed above (i.e. CO, Administrator, User), but assuming that a valid set of parameters is provided, including a group_id, only the transfer owner will be able alter the transfer.

Example:

The user test1 initiates a group transfer (i.e. calls /transfer successfully) and it receives a transfer group ID - group_id.

The user test2 tries to append a file to transfer with ID group_id. A 403 - Forbidden error will be returned stating that the user that has made the request is not authorized to alter the transfer.

The user test1 tries to append a file to the transfer - operation successful.

The user test1 completes the transfer by calling POST /transfer - operation successful.

Transfer with ID group_id will be accessible to the user until its expiration date.

Auth
Headers
GET /vault_rest/transfer_file
Copy
Responses
200

Successful response

objectobject
Response
Copy

Complete file transfer

Permissions Restrictions

The API is limited to the user roles listed above (i.e. CO, Administrator, User), but assuming that a valid set of parameters is provided, including a group_id, only the transfer owner will be able alter the transfer.

Example:

The user test1 initiates a group transfer (i.e. calls /transfer successfully) and it receives a transfer group ID - group_id.

The user test2 tries to append a file to transfer with ID group_id. A 403 - Forbidden error will be returned stating that the user that has made the request is not authorized to alter the transfer.

The user test1 tries to append a file to the transfer - operation successful.

The user test1 completes the transfer by calling POST /transfer - operation successful.

Transfer with ID group_id will be accessible to the user until its expiration date.

Auth
Headers
group_idstring

A transfer group id obtained from the Initialize Group Transfer call.

file_idstring

A file ID obtained from the Initialize File Transfer call.

POST /vault_rest/transfer_file
Copy
Responses
200

Successful response

objectobject
Response
Copy

Delete File From File Transfer

Permissions Restrictions

The API is limited to the user roles listed above (i.e. CO, Administrator, User), but assuming that a valid set of parameters is provided, including a group_id, only the transfer owner will be able alter the transfer.

Example:

The user test1 initiates a group transfer (i.e. calls /transfer successfully) and it receives a transfer group ID - group_id.

The user test2 tries to append a file to transfer with ID group_id. A 403 - Forbidden error will be returned stating that the user that has made the request is not authorized to alter the transfer.

The user test1 tries to append a file to the transfer - operation successful.

The user test1 completes the transfer by calling POST /transfer - operation successful.

Transfer with ID group_id will be accessible to the user until its expiration date.

Auth
Headers
group_idstring

A transfer group id obtains from the Initialize Group Transfer call.

file_idstring

A file id obtained from the Initialize File Transfer call.

DELETE /vault_rest/transfer_file
Copy
Responses
200

Successful response

objectobject
Response
Copy

Upload File Chunk

Permissions Restrictions

The API is limited to the user roles listed above (i.e. CO, Administrator, User), but assuming that a valid set of parameters is provided, including a group_id, only the transfer owner will be able alter the transfer.

Example:

The user test1 initiates a group transfer (i.e. calls /transfer successfully) and it receives a transfer group ID - group_id.

The user test2 tries to append a file to transfer with ID group_id. A 403 - Forbidden error will be returned stating that the user that has made the request is not authorized to alter the transfer.

The user test1 tries to append a file to the transfer - operation successful.

The user test1 completes the transfer by calling POST /transfer - operation successful.

Transfer with ID group_id will be accessible to the user until its expiration date.

Auth
Headers
group_idstring

A transfer group id obtained from the 1. Initialize Group Transfer call.

file_idstring

A file ID obtained from a call to "Initialize File Transfer".

chunk_offsetstring

The offset (location) of the chunk in the reassembled file.

chunk_checksumstring

Used to verify data integrity when chunk has been received. If no value is provided no checksum will be performed.

Request Body
objectobject
PATCH /vault_rest/transfer_file
Copy
Responses
200

Successful response

objectobject
Response
Copy

Delete A Folder

Summary

Delete a folder from the MetaDefender Vault storage. This API will only mark the folder for deletion. The folder will be physically deleted by the background worker.

Permissions Restrictions

Administrators can delete any folder, including other user's folders. Users can only delete their own folders.

Auth
Path Params
folder_idstring

[required]

DELETE /vault_rest/folder/{folder_id}
Copy
Responses
200

Successful response

No response body
Response
Copy

Delete Multiple Folders

Summary

Delete a group of folders from the MetaDefender Vault storage. This API will only mark the folders for deletion. The folders will be physically removed by a background worker.

Permissions Restrictions

Administrators can delete any folder, including other user's folders. Users can only delete their own folders.

Auth
DELETE /vault_rest/folders
Copy
Responses
200

Successful response

No response body
Response
Copy

Enumerate Folder Content

Summary

Retrieve a list of the user's files.

Auth
Headers
sort_columnstring

Possible values: name, size, datecreated.

sort_directionstring

Possible values: asc, desc.

findstring

Free text search string (Use only with English characters).

findB64string

Free text search string (Base64 encoded to support all charsets). Will override any value specified in 'find' header.

Path Params
idstring

[required]

startstring

[required]

countstring

[required]

GET /vault_rest/folder_content/{id}/{start}/{count}
Copy
Responses
200

Successful response

No response body
Response
Copy

Get Root Folder

Summary

List information about the 'root' folder.

Auth
GET /vault_rest/root_folder
Copy
Responses
200

Successful response

objectobject
Response
Copy

Move Folders

Summary

This API allows moving one or multiple folders in MetaDefender Vault.

Auth
Request Body
objectobject
PUT /vault_rest/v2/move_folders
Copy
Responses
200

Successful response

objectobject
Response
Copy

Rename A Folder

Summary

This API allows renaming a folder in MetaDefender Vault.

Auth
Request Body
objectobject
PUT /vault_rest/rename_folder
Copy
Responses
200

Successful response

No response body
409

Conflict

Response
Copy

Share A Folder

Summary

This API allows sharing a folder in MetaDefender Vault.

Auth
Request Body
objectobject
POST /vault_rest/update_folder_share
Copy
Responses
200

Successful response

No response body
Response
Copy

Create A Folder

Summary

This API allows creating a folder in MetaDefender Vault.

Auth
Request Body
objectobject
POST /vault_rest/folder
Copy
Responses
200

Successful response

objectobject
400

Bad Request

409

Conflict

Response
Copy

Default

Version

Auth
Headers
Authorizationstring
GET /vault_rest/version
Copy
Responses
200

Successful response

objectobject
Response
Copy