A run is one execution of a test: it starts as queued, becomes running and ends as passed, failed or error. Finished runs carry their checks and findings, and their evidence downloads as a ZIP or as single files such as report.pdf when the organisation's plan includes run evidence.
Run
One run with its status, trigger, timing, checks, findings and evidence; artifacts.url and artifacts.filesUrl point at the v1 downloads.
Fields: Run
Field
Type
Description
id
string
The run's id, a decimal string; read the run again with GET /runs/{id}.
Which of the organisation’s notification channels a test notifies: all of them or only the selected ones.
Fields: NotificationRouting
Field
Type
Description
scope
"all" | "selected"
all (the default): finished runs notify every active notification channel of the organisation; selected: only the channels in channelIds. Each channel's own choice between failed runs only and every finished run still applies, and the run e-mails to members are not affected.
channelIds
string[] (≤ 20 distinct channel ids, ascending)
The ids of the selected channels in ascending order (NotificationChannel.id from GET /notification-channels), always empty with all; an empty list with selected means no channel notifications, and a deleted channel leaves every list. Test files exported from the app leave the routing out, because channel ids belong to one organisation.
Example: NotificationRoutingJSON
{
"scope": "selected",
"channelIds": [
"12"
]
}
NotificationChannel
A notification channel of the organisation: its provider, name, masked target and when it notifies; never the webhook URL or key.
Fields: NotificationChannel
Field
Type
Description
id
string
The channel's id, a decimal string; use it in notificationRouting.channelIds.
provider
"slack" | "teams" | "pumble" | "pagerduty"
Where the channel posts: slack, teams (Microsoft Teams), pumble or pagerduty.
name
string
The channel's name as shown in Settings.
targetHint
string
The masked webhook address or integration key, such as hooks.slack.com…Xk2f; the full value is never returned.
onlyFailures
boolean
true when the channel hears about failed and errored runs only (PagerDuty also resolves its incident when the test passes again), false for every finished run.
active
boolean
false while the channel is paused: tests can still select it, but it receives nothing.
locale
"en" | "de" | "tr"
The language every message to the channel is written in, its run links included: en (English), de (German) or tr (Turkish), chosen in Settings.
Lists every run in the key's scope, newest first; the optional filters project, test and status combine. Needs read access. The example lists the failed runs of project 42, two per page, and next continues with older runs.
Needs a key with access: Read
Parameters
Parameters: GET /runs
Name
In
Type
Required
Description
Example
project
Query string
string (numeric project id)
No
Returns only the runs of tests in this project (numeric id).
42
test
Query string
string (numeric id or tst_… id)
No
Returns only the runs of this test (numeric id or tst_… id).
// Java 11+: save as Main.java and run `java Main.java`import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public classMain {
public static void main(String[] args) throwsException {
String url = "https://optisway.com/api/v1/runs?project=42&status=failed&limit=2";
HttpRequest request = HttpRequest.newBuilder(URI.create(url))
.header("Authorization", "Bearer " + System.getenv("OPTISWAY_API_KEY"))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() >= 300) {
String error = response.body();
System.err.println(response.statusCode() + " " + field(error, "error") + ": "
+ field(error, "message"));
System.exit(1);
}
// { "items": [...], "next": ... } -- any JSON library (Jackson, Gson, org.json) parses it;// this example stays dependency-free and prints the raw JSON.System.out.println(response.body());
}
/** The first string value of a JSON key (dependency-free; Jackson or Gson parse JSON properly). */static String field(String json, String key) {
Matcher match = Pattern.compile("\"" + key + "\"\\s*:\\s*(?:\"((?:[^\"\\\\]|\\\\.)*)\"|null)")
.matcher(json);
return match.find() ? match.group(1) : null;
}
}
package main
import (
"encoding/json""fmt""net/http""os"
)
func main() {
url := "https://optisway.com/api/v1/runs?project=42&status=failed&limit=2"
req, err := http.NewRequest(http.MethodGet, url, nil)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("OPTISWAY_API_KEY"))
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
if resp.StatusCode >= 300 {
var envelope struct {
Error string`json:"error"`
Message string`json:"message"`
}
_ = json.NewDecoder(resp.Body).Decode(&envelope)
fmt.Fprintf(os.Stderr, "%d %s: %s\n", resp.StatusCode, envelope.Error, envelope.Message)
os.Exit(1)
}
var body map[string]anyif err := json.NewDecoder(resp.Body).Decode(&body); err != nil {
panic(err)
}
for _, raw := range body["items"].([]any) {
item := raw.(map[string]any)
fmt.Println(item["id"], item["status"], item["summary"])
}
}
// .NET 8: `dotnet new console`, replace Program.cs with this file, then `dotnet run`usingSystem.Net.Http.Headers;
usingSystem.Net.Http.Json;
usingSystem.Text.Json;
using var client = newHttpClient();
client.DefaultRequestHeaders.Authorization =
newAuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("OPTISWAY_API_KEY"));
var url = "https://optisway.com/api/v1/runs?project=42&status=failed&limit=2";
using var response = await client.GetAsync(url);
if (!response.IsSuccessStatusCode)
{
var envelope = await response.Content.ReadFromJsonAsync<JsonElement>();
var error = envelope.GetProperty("error");
var message = envelope.GetProperty("message");
Console.Error.WriteLine($"{(int)response.StatusCode}{error}: {message}");
Environment.Exit(1);
}
var body = await response.Content.ReadFromJsonAsync<JsonElement>();
foreach (var item in body.GetProperty("items").EnumerateArray())
{
Console.WriteLine(string.Join(" ",
item.GetProperty("id"), item.GetProperty("status"), item.GetProperty("summary")));
}
Example response
Returns: An object with items (Run objects) and next (the path of the next page, or null on the last page).
invalid_request400 A path, filter or limit is invalid, or a JSON body is unreadable, too large or invalid.
unauthorized401 The key is missing, malformed, unknown, revoked or expired, or its creator is no longer a member.
rate_limited429 The key sent too many requests; wait the seconds in Retry-After.
unavailable503 A temporary problem on our side; try again later.
Read a runGET/runs/{id}
Reads one run: its status, timing, check counts, every finding and the artifact download paths. Needs read access; after starting a run, read it every 10 seconds until status is passed, failed or error. The example shows run 4821 after it failed because the page answered 503.
Needs a key with access: Read
Parameters
Parameters: GET /runs/{id}
Name
In
Type
Required
Description
Example
id
Path
string (numeric run id)
Yes
The numeric id of the run, as returned in Run.id and in the Location header of a started run.
// .NET 8: `dotnet new console`, replace Program.cs with this file, then `dotnet run`usingSystem.Net.Http.Headers;
usingSystem.Net.Http.Json;
usingSystem.Text.Json;
using var client = newHttpClient();
client.DefaultRequestHeaders.Authorization =
newAuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("OPTISWAY_API_KEY"));
var url = "https://optisway.com/api/v1/runs/4821";
using var response = await client.GetAsync(url);
if (!response.IsSuccessStatusCode)
{
var envelope = await response.Content.ReadFromJsonAsync<JsonElement>();
var error = envelope.GetProperty("error");
var message = envelope.GetProperty("message");
Console.Error.WriteLine($"{(int)response.StatusCode}{error}: {message}");
Environment.Exit(1);
}
var body = await response.Content.ReadFromJsonAsync<JsonElement>();
Console.WriteLine($"Status: {body.GetProperty("status")}");
Console.WriteLine($"Summary: {body.GetProperty("summary")}");
not_found404 The resource does not exist or is outside the key’s scope.
unauthorized401 The key is missing, malformed, unknown, revoked or expired, or its creator is no longer a member.
rate_limited429 The key sent too many requests; wait the seconds in Retry-After.
unavailable503 A temporary problem on our side; try again later.
Download the artifacts ZIPGET/runs/{id}/artifacts
Downloads the run's evidence as one ZIP file: the PDF report, manifest.json and, depending on the kind, screenshots, proof shots, the video and visual comparison images. Needs read access; a run that stored no artifacts answers 404 not_found, or 422 plan_limit_reached when the organisation's plan does not include run evidence (a ZIP stored earlier still downloads). The example saves the ZIP of run 4821 under the name from Content-Disposition.
Needs a key with access: Read
Parameters
Parameters: GET /runs/{id}/artifacts
Name
In
Type
Required
Description
Example
id
Path
string (numeric run id)
Yes
The numeric id of the run, as returned in Run.id and in the Location header of a started run.
// .NET 8: `dotnet new console`, replace Program.cs with this file, then `dotnet run`usingSystem.Net.Http.Headers;
usingSystem.Net.Http.Json;
usingSystem.Text.Json;
using var client = newHttpClient();
client.DefaultRequestHeaders.Authorization =
newAuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("OPTISWAY_API_KEY"));
var url = "https://optisway.com/api/v1/runs/4821/artifacts";
using var response = await client.GetAsync(url);
if (!response.IsSuccessStatusCode)
{
var envelope = await response.Content.ReadFromJsonAsync<JsonElement>();
var error = envelope.GetProperty("error");
var message = envelope.GetProperty("message");
Console.Error.WriteLine($"{(int)response.StatusCode}{error}: {message}");
Environment.Exit(1);
}
var bytes = await response.Content.ReadAsByteArrayAsync();
awaitFile.WriteAllBytesAsync("run-4821.zip", bytes);
Console.WriteLine($"Saved run-4821.zip ({bytes.Length} bytes)");
The body is the ZIP file itself, not JSON; write it to a file. Errors still answer with the JSON error object.
Errors you can get
not_found404 The resource does not exist or is outside the key’s scope.
plan_limit_reached422 The organisation’s plan does not allow it: the test limit is reached, the kind is not included, or (on artifact downloads) run evidence is not included in the plan.
unauthorized401 The key is missing, malformed, unknown, revoked or expired, or its creator is no longer a member.
rate_limited429 The key sent too many requests; wait the seconds in Retry-After.
unavailable503 A temporary problem on our side; try again later.
Download one artifact fileGET/runs/{id}/files
Downloads one entry of the run's ZIP without the rest, for example the PDF report. Needs read access; a path that names no possible entry answers 400 invalid_request, an entry this ZIP does not hold 404 not_found, and a run without a ZIP on a plan that does not include run evidence 422 plan_limit_reached. The example saves report.pdf of run 4821.
Needs a key with access: Read
Parameters
Parameters: GET /runs/{id}/files
Name
In
Type
Required
Description
Example
id
Path
string (numeric run id)
Yes
The numeric id of the run, as returned in Run.id and in the Location header of a started run.
4821
path
Query string
string (entry inside the ZIP, e.g. report.pdf)
Yes
The entry inside the run's ZIP: report.pdf, video.webm, manifest.json, screenshots/<name>.jpg, screenshots_proof/<name>.jpg or visual/<width>x<height>-(baseline|current|diff).png.
// .NET 8: `dotnet new console`, replace Program.cs with this file, then `dotnet run`usingSystem.Net.Http.Headers;
usingSystem.Net.Http.Json;
usingSystem.Text.Json;
using var client = newHttpClient();
client.DefaultRequestHeaders.Authorization =
newAuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("OPTISWAY_API_KEY"));
var url = "https://optisway.com/api/v1/runs/4821/files?path=report.pdf";
using var response = await client.GetAsync(url);
if (!response.IsSuccessStatusCode)
{
var envelope = await response.Content.ReadFromJsonAsync<JsonElement>();
var error = envelope.GetProperty("error");
var message = envelope.GetProperty("message");
Console.Error.WriteLine($"{(int)response.StatusCode}{error}: {message}");
Environment.Exit(1);
}
var bytes = await response.Content.ReadAsByteArrayAsync();
awaitFile.WriteAllBytesAsync("report.pdf", bytes);
Console.WriteLine($"Saved report.pdf ({bytes.Length} bytes)");
Example response
Returns: The file itself, with its own content type (application/pdf for the report).
The body is the requested file itself, not JSON; write it to a file. Content-Type matches the entry: application/pdf, image/jpeg, image/png, video/webm or application/json.
Errors you can get
invalid_request400 A path, filter or limit is invalid, or a JSON body is unreadable, too large or invalid.
not_found404 The resource does not exist or is outside the key’s scope.
plan_limit_reached422 The organisation’s plan does not allow it: the test limit is reached, the kind is not included, or (on artifact downloads) run evidence is not included in the plan.
unauthorized401 The key is missing, malformed, unknown, revoked or expired, or its creator is no longer a member.
rate_limited429 The key sent too many requests; wait the seconds in Retry-After.
unavailable503 A temporary problem on our side; try again later.
List notification channelsGET/notification-channels
Lists the notification channels of the key's organisation, the Slack, Microsoft Teams, Pumble and PagerDuty destinations that owners and admins add in Settings → Integrations → Notification channels, whose ids go in notificationRouting.channelIds; the webhook URL or integration key is never returned, only the masked targetHint. Needs read access and is not paged; channels belong to the organisation, so a key limited to one project sees all of them too. The example lists the checkout team's Slack channel 12 and the paused PagerDuty service 15.
// Java 11+: save as Main.java and run `java Main.java`import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public classMain {
public static void main(String[] args) throwsException {
String url = "https://optisway.com/api/v1/notification-channels";
HttpRequest request = HttpRequest.newBuilder(URI.create(url))
.header("Authorization", "Bearer " + System.getenv("OPTISWAY_API_KEY"))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() >= 300) {
String error = response.body();
System.err.println(response.statusCode() + " " + field(error, "error") + ": "
+ field(error, "message"));
System.exit(1);
}
// { "items": [...], "next": ... } -- any JSON library (Jackson, Gson, org.json) parses it;// this example stays dependency-free and prints the raw JSON.System.out.println(response.body());
}
/** The first string value of a JSON key (dependency-free; Jackson or Gson parse JSON properly). */static String field(String json, String key) {
Matcher match = Pattern.compile("\"" + key + "\"\\s*:\\s*(?:\"((?:[^\"\\\\]|\\\\.)*)\"|null)")
.matcher(json);
return match.find() ? match.group(1) : null;
}
}
package main
import (
"encoding/json""fmt""net/http""os"
)
func main() {
url := "https://optisway.com/api/v1/notification-channels"
req, err := http.NewRequest(http.MethodGet, url, nil)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("OPTISWAY_API_KEY"))
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
if resp.StatusCode >= 300 {
var envelope struct {
Error string`json:"error"`
Message string`json:"message"`
}
_ = json.NewDecoder(resp.Body).Decode(&envelope)
fmt.Fprintf(os.Stderr, "%d %s: %s\n", resp.StatusCode, envelope.Error, envelope.Message)
os.Exit(1)
}
var body map[string]anyif err := json.NewDecoder(resp.Body).Decode(&body); err != nil {
panic(err)
}
for _, raw := range body["items"].([]any) {
item := raw.(map[string]any)
fmt.Println(item["id"], item["provider"], item["name"])
}
}
// .NET 8: `dotnet new console`, replace Program.cs with this file, then `dotnet run`usingSystem.Net.Http.Headers;
usingSystem.Net.Http.Json;
usingSystem.Text.Json;
using var client = newHttpClient();
client.DefaultRequestHeaders.Authorization =
newAuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("OPTISWAY_API_KEY"));
var url = "https://optisway.com/api/v1/notification-channels";
using var response = await client.GetAsync(url);
if (!response.IsSuccessStatusCode)
{
var envelope = await response.Content.ReadFromJsonAsync<JsonElement>();
var error = envelope.GetProperty("error");
var message = envelope.GetProperty("message");
Console.Error.WriteLine($"{(int)response.StatusCode}{error}: {message}");
Environment.Exit(1);
}
var body = await response.Content.ReadFromJsonAsync<JsonElement>();
foreach (var item in body.GetProperty("items").EnumerateArray())
{
Console.WriteLine(string.Join(" ",
item.GetProperty("id"), item.GetProperty("provider"), item.GetProperty("name")));
}
Example response
Returns: An object whose items array holds NotificationChannel objects.