The VulnCheck platform uses a token system that is shared by both the API and the portal. This shared token system allows you to use the API and web portal with the same token (and flip back and forth between the two) as well as manage your tokens in one place. This guide will walk you through the process of creating and using tokens.
To get started with making API calls to the VulnCheck platform, you need to issue a token to your account. To do so, follow the instructions below:
Any token that has not been used for 30 days will expire.
VulnCheck supports 3 ways of passing your token.
Adding it as a custom header as Authorization: Bearer insert_token_here
.
curl --request GET \
--url https://api.vulncheck.com/v3/index/initial-access \
--header 'Accept: application/json' \
--header 'Authorization: Bearer insert_token_here'
client := &http.Client{}
var responseJSON interface{}
request, _ := http.NewRequest("GET", "https://api.vulncheck.com/v3/index/initial-access", nil)
request.Header.Set("Accept", "application/json")
request.Header.Set("Authorization", "Bearer " + "insert_token_here")
response, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
_ := json.NewDecoder(response.Body).Decode(responseJSON)
import requests
url = "https://api.vulncheck.com/v3/index/initial-access"
headers = {
"accept": "application/json",
"authorization": "Bearer {token}"
}
params = {}
response = requests.get(url, headers=headers, params=params)
print(response.json())
You can pass the API Token as a GET/URL parameter - making it easy to test tokens and browse endpoints in a browser.
curl --request GET \
--url https://api.vulncheck.com/v3/index/initial-access \
--header 'Accept: application/json' \
--url-query token=insert_token_here
client := &http.Client{}
var responseJSON interface{}
request, _ := http.NewRequest("GET", "https://api.vulncheck.com/v3/index/initial-access", nil)
request.Header.Set("Accept", "application/json")
params := url.Values{}
params.Add("token", "insert_token_here")
response, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
_ := json.NewDecoder(response.Body).Decode(responseJSON)
import requests
url = "https://api.vulncheck.com/v3/index/initial-access"
headers = {
"accept": "application/json"
}
params = {
"token": "insert_token_here"
}
response = requests.get(url, headers=headers, params=params)
print(response.json())
We allow the token to be passed as a cookie - this is actually how our web portal works, allowing you API access via the portal with full control of your tokens.
curl --request GET \
--url https://api.vulncheck.com/v3/index/initial-access \
--header 'Accept: application/json' \
--cookie "token=insert_token_here"
client := &http.Client{}
var responseJSON interface{}
request, _ := http.NewRequest("GET", "https://api.vulncheck.com/v3/index/initial-access", nil)
request.Header.Set("Accept", "application/json")
request.AddCookie(&http.Cookie{
Name: "token",
Value: "insert_token_here",
})
response, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
_ := json.NewDecoder(response.Body).Decode(responseJSON)
import requests
url = "https://api.vulncheck.com/v3/index/initial-access"
headers = {
"accept": "application/json"
}
cookies = {
"token": "insert_token_here"
}
response = requests.get(url, headers=headers, cookies=cookies)
print(response.json())
VulnCheck provides a CLI and SDK to interact with the API. You can use the token in the CLI or SDK by setting the VC_TOKEN
environment variable.
package main
import (
"encoding/json"
"fmt"
"log"
"github.com/vulncheck-oss/sdk-go"
)
func main() {
client := sdk.Connect("https://api.vulncheck.com", "insert_token_here")
response, err := client.GetIndexInitialAccess(sdk.IndexQueryParameters{})
if err != nil {
panic(err)
}
prettyJSON, err := json.MarshalIndent(response.Data, "", " ")
if err != nil {
log.Fatalf("Failed to generate JSON: %v", err)
return
}
fmt.Println(string(prettyJSON))
}
import vulncheck_sdk
configuration = vulncheck_sdk.Configuration(host="https://api.vulncheck.com/v3")
configuration.api_key["Bearer"] = "insert_token_here"
with vulncheck_sdk.ApiClient(configuration) as api_client:
indices_client = vulncheck_sdk.IndicesApi(api_client)
api_response = indices_client.index_initial_access_get()
print(api_response.data)
export VC_TOKEN=insert_token_here
vulncheck index browse initial-access