Legacy API Docs. These docs are for Virtool 4.3.3.

Authentication

Explanation

Virtool uses API keys for authentication. All API endpoints will return 401 Unauthorized for requests without valid authentication.

First, you will need to create an API key with the permission scope defined by you. See the account documentation to learn how to create API keys.

Using an API key for authentication is easy and should be familiar to developers who have made use of other HTTP-based APIs. When making requests, use Basic authentication and provide your username and API key.

Examples

curl

curl -X GET -u igboyes:74e8b0d15ded4c538c66fce3922d415a https://demo.virtool.ca/api/account

Python requests

import requests
from requests.auth import HTTPBasicAuth

basic_auth = HTTPBasicAuth("igboyes", "74e8b0d15ded4c538c66fce3922d415a")

requests.get("http://localhost:9950/api/account", auth=basic_auth)

Javascript fetch

let headers = new Headers();

headers.append("Authorization", `Basic ${btoa("igboyes:74e8b0d15ded4c538c66fce3922d415a"}`);

fetch("http://localhost:9950/api/account", {method: "GET", headers})
    .then(resp => resp.json())
    .then(json => console.log(json));