Get snapshot
curl --request GET \
--url https://app.kosli.com/api/v2/snapshots/{org}/{env_name}/{snapshot_expression} \
--header 'Authorization: Bearer <token>'import requests
url = "https://app.kosli.com/api/v2/snapshots/{org}/{env_name}/{snapshot_expression}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://app.kosli.com/api/v2/snapshots/{org}/{env_name}/{snapshot_expression}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.kosli.com/api/v2/snapshots/{org}/{env_name}/{snapshot_expression}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://app.kosli.com/api/v2/snapshots/{org}/{env_name}/{snapshot_expression}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://app.kosli.com/api/v2/snapshots/{org}/{env_name}/{snapshot_expression}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.kosli.com/api/v2/snapshots/{org}/{env_name}/{snapshot_expression}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"index": 123,
"is_latest": true,
"artifact_compliance_count": {},
"timestamp": 123,
"type": "<string>",
"compliant": true,
"html_url": "<string>",
"artifacts": [
{}
],
"applied_policies": [
{}
],
"next_snapshot_timestamp": 123
}Get snapshot
Get a snapshot for an environment.
`snapshot_expression` can be specified as follows:
- `N`: the Nth snapshot, counting from 1. Negative values count from the latest snapshot i.e. -1 is the latest snapshot.
example: 42
- `~N`: the Nth snapshot behind the latest, at the time of the request
example: ~5
- `@{YYYY-MM-DDTHH:MM:SS}`: the snapshot at specific moment in time in UTC
example: @{2023-10-02T12:00:00}
- `@{N.<hours|days|weeks|months>.ago}`: the snapshot at a time relative to the time of the request. N is a positive integer.
example: @{2.hours.ago}
- `@{now}`: the snapshot at the time of the request
example: @{now}
GET
/
snapshots
/
{org}
/
{env_name}
/
{snapshot_expression}
Get snapshot
curl --request GET \
--url https://app.kosli.com/api/v2/snapshots/{org}/{env_name}/{snapshot_expression} \
--header 'Authorization: Bearer <token>'import requests
url = "https://app.kosli.com/api/v2/snapshots/{org}/{env_name}/{snapshot_expression}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://app.kosli.com/api/v2/snapshots/{org}/{env_name}/{snapshot_expression}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.kosli.com/api/v2/snapshots/{org}/{env_name}/{snapshot_expression}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://app.kosli.com/api/v2/snapshots/{org}/{env_name}/{snapshot_expression}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://app.kosli.com/api/v2/snapshots/{org}/{env_name}/{snapshot_expression}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.kosli.com/api/v2/snapshots/{org}/{env_name}/{snapshot_expression}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"index": 123,
"is_latest": true,
"artifact_compliance_count": {},
"timestamp": 123,
"type": "<string>",
"compliant": true,
"html_url": "<string>",
"artifacts": [
{}
],
"applied_policies": [
{}
],
"next_snapshot_timestamp": 123
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Response
200 - application/json
Successful Response
The index of the snapshot
True if this snapshot is the most recent
The number of compliant and non-compliant artifacts in the snapshot
Show child attributes
Show child attributes
The timestamp of the snapshot creation
The type of the environment
Whether the snapshot is compliant
The HTML URL to the snapshot
The list of artifacts in the snapshot
The list of policies applied to this snapshot
The creation timestamp of the next snapshot if one exists
Last modified on September 2, 2026