Optisway home
Documentation menu

REST API reference: Tests

The API lists and reads tests and starts their runs; with a manage key it also creates, changes and deletes them, while their configuration stays in the app. Every test has a numeric id and a public tst_… id shown in the app, and both work wherever a path takes a test {id}.

Test

A test with its kind, schedule, next run, latest run, pass statistics and the notification channels it notifies.

Fields: Test
FieldTypeDescription
idstringThe test's numeric id, as a decimal string.
customIdstring (tst_…)The public test id (tst_ and 12 characters) shown in the app; it never changes and works wherever a test id is accepted.
projectIdstringThe id of the project the test belongs to.
namestringThe test's name as shown in the app.
kind"availability" | "links" | "seo" | "vitals" | "visual" | "a11y" | "rest" | "graphql" | "script" | "journey"What the test checks: one of the ten test kinds.
urlstringThe address the test opens or calls.
descriptionstringThe test's description; an empty string when none was written.
scheduleMinutesinteger | nullMinutes between two scheduled runs (1440 = once a day), or null when the test runs only on demand.
enabledbooleanfalse while the test is paused; a paused test gets no scheduled runs.
nextRunAtISO 8601 string | nullWhen the next scheduled run is due (UTC), or null without an active schedule.
lastRunRunSummary | nullThe test's newest run as a RunSummary, or null before the first run.
stats.runsintegerHow many runs the test had in the last 30 days.
stats.passedintegerHow many of those runs passed.
stats.failedintegerHow many of those runs failed.
stats.passRateinteger (0–100) | nullPassed runs as a whole percentage (0–100) of the passed and failed runs of the last 30 days, or null when there were none.
notificationRoutingNotificationRoutingWhich notification channels the test's finished runs notify: every active channel of the organisation (the default) or only the selected ones.
createdAtISO 8601 stringWhen the test was created (UTC).
updatedAtISO 8601 stringWhen the test was last changed (UTC).
links.selfstringThe path of this test (GET /tests/{id}).
links.runsstringThe path of this test's runs: GET lists them, POST starts a new one.
links.projectstringThe path of the project the test belongs to.
Example: TestJSON
{
  "id": "318",
  "customId": "tst_7k2m9q4xh3vd",
  "projectId": "42",
  "name": "Checkout page",
  "kind": "availability",
  "url": "https://shop.example.com/",
  "description": "Checks that the checkout answers quickly and without errors.",
  "scheduleMinutes": 1440,
  "enabled": true,
  "nextRunAt": "2026-10-20T09:12:00.000Z",
  "lastRun": {
    "id": "4821",
    "status": "failed",
    "trigger": "api",
    "startedAt": "2026-10-19T09:12:01.000Z",
    "finishedAt": "2026-10-19T09:12:03.140Z",
    "durationMs": 2140,
    "summary": "503 Service Unavailable in 184 ms"
  },
  "stats": {
    "runs": 30,
    "passed": 28,
    "failed": 2,
    "passRate": 93
  },
  "notificationRouting": {
    "scope": "all",
    "channelIds": []
  },
  "createdAt": "2026-09-02T14:05:00.000Z",
  "updatedAt": "2026-10-12T08:41:00.000Z",
  "links": {
    "self": "/api/v1/tests/318",
    "runs": "/api/v1/tests/318/runs",
    "project": "/api/v1/projects/42"
  }
}

List tests GET /tests

Lists the tests in the key's scope; the optional filters project, kind and query combine. Needs read access, and the list is not paged. The example finds the availability test “Checkout page” in project 42.

Needs a key with access: Read

Parameters

Parameters: GET /tests
NameInTypeRequiredDescriptionExample
projectQuery stringstring (numeric project id)NoReturns only the tests of this project (numeric id).42
kindQuery string"availability" | "links" | "seo" | "vitals" | "visual" | "a11y" | "rest" | "graphql" | "script" | "journey"NoReturns only tests of this kind.availability
queryQuery stringstring, 2–100 charactersNoReturns only tests whose name, URL or tst_… id contains this text (2–100 characters).checkout

Example request

curl --fail-with-body -sS \
  "https://optisway.com/api/v1/tests?project=42&kind=availability&query=checkout" \
  -H "Authorization: Bearer $OPTISWAY_API_KEY"
// Node.js 18+: save as optisway.mjs and run `node optisway.mjs`
const url = "https://optisway.com/api/v1/tests?project=42&kind=availability&query=checkout";
const response = await fetch(url, {
  headers: {
    Authorization: `Bearer ${process.env.OPTISWAY_API_KEY}`,
  },
});
if (!response.ok) {
  const { error, message } = await response.json();
  console.error(`${response.status} ${error}: ${message}`);
  process.exit(1);
}
const { items } = await response.json();
for (const item of items) console.log(item.id, item.name);
# pip install requests
import os
import sys

import requests

api_key = os.environ["OPTISWAY_API_KEY"]
response = requests.get(
    "https://optisway.com/api/v1/tests?project=42&kind=availability&query=checkout",
    headers={"Authorization": f"Bearer {api_key}"},
    timeout=30,
)
if not response.ok:
    envelope = response.json()
    print(f"{response.status_code} {envelope['error']}: {envelope['message']}", file=sys.stderr)
    sys.exit(1)
for item in response.json()["items"]:
    print(item["id"], item["name"])
require "json"
require "net/http"
require "uri"

uri = URI("https://optisway.com/api/v1/tests?project=42&kind=availability&query=checkout")
request = Net::HTTP::Get.new(uri)
request["Authorization"] = "Bearer #{ENV.fetch("OPTISWAY_API_KEY")}"
response = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(request) }
unless response.is_a?(Net::HTTPSuccess)
  envelope = JSON.parse(response.body)
  warn "#{response.code} #{envelope["error"]}: #{envelope["message"]}"
  exit 1
end
JSON.parse(response.body)["items"].each do |item|
  puts [item["id"], item["name"]].join("  ")
end
<?php
$curl = curl_init("https://optisway.com/api/v1/tests?project=42&kind=availability&query=checkout");
curl_setopt_array($curl, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer " . getenv("OPTISWAY_API_KEY"),
  ],
]);
$body = curl_exec($curl);
if ($body === false) {
  fwrite(STDERR, curl_error($curl) . "\n");
  exit(1);
}
$status = curl_getinfo($curl, CURLINFO_RESPONSE_CODE);
if ($status < 200 || $status >= 300) {
  $envelope = json_decode($body, true);
  fwrite(STDERR, "$status {$envelope['error']}: {$envelope['message']}\n");
  exit(1);
}
foreach (json_decode($body, true)["items"] as $item) {
  echo $item["id"], "  ", $item["name"], "\n";
}
// 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 class Main {
  public static void main(String[] args) throws Exception {
    String url = "https://optisway.com/api/v1/tests?project=42&kind=availability&query=checkout";
    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/tests?project=42&kind=availability&query=checkout"
	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]any
	if 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["name"])
	}
}
// .NET 8: `dotnet new console`, replace Program.cs with this file, then `dotnet run`
using System.Net.Http.Headers;
using System.Net.Http.Json;
using System.Text.Json;

using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization =
  new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("OPTISWAY_API_KEY"));
var url = "https://optisway.com/api/v1/tests?project=42&kind=availability&query=checkout";
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("name")));
}

Example response

Returns: An object whose items array holds Test objects.

Status: 200 OK

Headers: Content-Type: application/json; charset=utf-8 Cache-Control: no-store

Response body: List testsJSON
{
  "items": [
    {
      "id": "318",
      "customId": "tst_7k2m9q4xh3vd",
      "projectId": "42",
      "name": "Checkout page",
      "kind": "availability",
      "url": "https://shop.example.com/",
      "description": "Checks that the checkout answers quickly and without errors.",
      "scheduleMinutes": 1440,
      "enabled": true,
      "nextRunAt": "2026-10-20T09:12:00.000Z",
      "lastRun": {
        "id": "4821",
        "status": "failed",
        "trigger": "api",
        "startedAt": "2026-10-19T09:12:01.000Z",
        "finishedAt": "2026-10-19T09:12:03.140Z",
        "durationMs": 2140,
        "summary": "503 Service Unavailable in 184 ms"
      },
      "stats": {
        "runs": 30,
        "passed": 28,
        "failed": 2,
        "passRate": 93
      },
      "notificationRouting": {
        "scope": "all",
        "channelIds": []
      },
      "createdAt": "2026-09-02T14:05:00.000Z",
      "updatedAt": "2026-10-12T08:41:00.000Z",
      "links": {
        "self": "/api/v1/tests/318",
        "runs": "/api/v1/tests/318/runs",
        "project": "/api/v1/projects/42"
      }
    }
  ]
}

Errors you can get

  • invalid_request 400 A path, filter or limit is invalid, or a JSON body is unreadable, too large or invalid.
  • unauthorized 401 The key is missing, malformed, unknown, revoked or expired, or its creator is no longer a member.
  • rate_limited 429 The key sent too many requests; wait the seconds in Retry-After.
  • unavailable 503 A temporary problem on our side; try again later.

Read a test GET /tests/{id}

Reads one test by its numeric id or by the public tst_… id shown on the test in the app. Needs read access. The test's configuration (steps, scripts, API requests, visual and accessibility settings, session setup) is never returned; you edit it in the app.

Needs a key with access: Read

Parameters

Parameters: GET /tests/{id}
NameInTypeRequiredDescriptionExample
idPathstring (numeric id or tst_… id)YesThe test: its numeric id or its public tst_… id from the app.tst_7k2m9q4xh3vd

Example request

curl --fail-with-body -sS "https://optisway.com/api/v1/tests/tst_7k2m9q4xh3vd" \
  -H "Authorization: Bearer $OPTISWAY_API_KEY"
// Node.js 18+: save as optisway.mjs and run `node optisway.mjs`
const url = "https://optisway.com/api/v1/tests/tst_7k2m9q4xh3vd";
const response = await fetch(url, {
  headers: {
    Authorization: `Bearer ${process.env.OPTISWAY_API_KEY}`,
  },
});
if (!response.ok) {
  const { error, message } = await response.json();
  console.error(`${response.status} ${error}: ${message}`);
  process.exit(1);
}
const body = await response.json();
console.log(`ID: ${body.id}`);
console.log(`Name: ${body.name}`);
# pip install requests
import os
import sys

import requests

api_key = os.environ["OPTISWAY_API_KEY"]
response = requests.get(
    "https://optisway.com/api/v1/tests/tst_7k2m9q4xh3vd",
    headers={"Authorization": f"Bearer {api_key}"},
    timeout=30,
)
if not response.ok:
    envelope = response.json()
    print(f"{response.status_code} {envelope['error']}: {envelope['message']}", file=sys.stderr)
    sys.exit(1)
body = response.json()
print("ID:", body["id"])
print("Name:", body["name"])
require "json"
require "net/http"
require "uri"

uri = URI("https://optisway.com/api/v1/tests/tst_7k2m9q4xh3vd")
request = Net::HTTP::Get.new(uri)
request["Authorization"] = "Bearer #{ENV.fetch("OPTISWAY_API_KEY")}"
response = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(request) }
unless response.is_a?(Net::HTTPSuccess)
  envelope = JSON.parse(response.body)
  warn "#{response.code} #{envelope["error"]}: #{envelope["message"]}"
  exit 1
end
body = JSON.parse(response.body)
puts "ID: #{body["id"]}"
puts "Name: #{body["name"]}"
<?php
$curl = curl_init("https://optisway.com/api/v1/tests/tst_7k2m9q4xh3vd");
curl_setopt_array($curl, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer " . getenv("OPTISWAY_API_KEY"),
  ],
]);
$body = curl_exec($curl);
if ($body === false) {
  fwrite(STDERR, curl_error($curl) . "\n");
  exit(1);
}
$status = curl_getinfo($curl, CURLINFO_RESPONSE_CODE);
if ($status < 200 || $status >= 300) {
  $envelope = json_decode($body, true);
  fwrite(STDERR, "$status {$envelope['error']}: {$envelope['message']}\n");
  exit(1);
}
$data = json_decode($body, true);
echo "ID: {$data['id']}\n";
echo "Name: {$data['name']}\n";
// 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 class Main {
  public static void main(String[] args) throws Exception {
    String url = "https://optisway.com/api/v1/tests/tst_7k2m9q4xh3vd";
    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);
    }
    String body = response.body();
    System.out.println("ID: " + field(body, "id"));
    System.out.println("Name: " + field(body, "name"));
  }

  /** 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/tests/tst_7k2m9q4xh3vd"
	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]any
	if err := json.NewDecoder(resp.Body).Decode(&body); err != nil {
		panic(err)
	}
	fmt.Println("ID:", body["id"])
	fmt.Println("Name:", body["name"])
}
// .NET 8: `dotnet new console`, replace Program.cs with this file, then `dotnet run`
using System.Net.Http.Headers;
using System.Net.Http.Json;
using System.Text.Json;

using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization =
  new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("OPTISWAY_API_KEY"));
var url = "https://optisway.com/api/v1/tests/tst_7k2m9q4xh3vd";
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($"ID: {body.GetProperty("id")}");
Console.WriteLine($"Name: {body.GetProperty("name")}");

Example response

Returns: A Test object.

Status: 200 OK

Headers: Content-Type: application/json; charset=utf-8 Cache-Control: no-store

Response body: Read a testJSON
{
  "id": "318",
  "customId": "tst_7k2m9q4xh3vd",
  "projectId": "42",
  "name": "Checkout page",
  "kind": "availability",
  "url": "https://shop.example.com/",
  "description": "Checks that the checkout answers quickly and without errors.",
  "scheduleMinutes": 1440,
  "enabled": true,
  "nextRunAt": "2026-10-20T09:12:00.000Z",
  "lastRun": {
    "id": "4821",
    "status": "failed",
    "trigger": "api",
    "startedAt": "2026-10-19T09:12:01.000Z",
    "finishedAt": "2026-10-19T09:12:03.140Z",
    "durationMs": 2140,
    "summary": "503 Service Unavailable in 184 ms"
  },
  "stats": {
    "runs": 30,
    "passed": 28,
    "failed": 2,
    "passRate": 93
  },
  "notificationRouting": {
    "scope": "all",
    "channelIds": []
  },
  "createdAt": "2026-09-02T14:05:00.000Z",
  "updatedAt": "2026-10-12T08:41:00.000Z",
  "links": {
    "self": "/api/v1/tests/318",
    "runs": "/api/v1/tests/318/runs",
    "project": "/api/v1/projects/42"
  }
}

Errors you can get

  • not_found 404 The resource does not exist or is outside the key’s scope.
  • unauthorized 401 The key is missing, malformed, unknown, revoked or expired, or its creator is no longer a member.
  • rate_limited 429 The key sent too many requests; wait the seconds in Retry-After.
  • unavailable 503 A temporary problem on our side; try again later.

Create a test POST /projects/{id}/tests

Creates a test in the project with a name, a kind, an address and, optionally, a description, a schedule and a paused state. Needs a key with manage access; the API creates availability, links, SEO, Core Web Vitals, visual and accessibility tests with their default settings, while journeys, scripted journeys and API tests need configuration you add in the app. The example adds an hourly check of the pricing page to project 42.

Needs a key with access: Manage

Parameters

Parameters: POST /projects/{id}/tests
NameInTypeRequiredDescriptionExample
idPathstring (numeric project id)YesThe numeric id of the project, as returned in Project.id.42
Request body: POST /projects/{id}/tests
NameTypeRequiredDescriptionExample
namestring, 1–100 charactersYesThe test's name as shown in the app: 1–100 characters without line breaks."Pricing page"
kind"availability" | "links" | "seo" | "vitals" | "visual" | "a11y"YesWhat the test checks; the API creates these kinds with their default settings, and journeys, scripted journeys and API tests are created in the app."availability"
urlstring (public http:// or https:// URL)YesThe page or address the test checks: a complete, public http:// or https:// URL."https://shop.example.com/pricing"
descriptionstring, ≤ 500 characters | nullNoA note of up to 500 characters; null or an empty string leaves it empty."Checks that the pricing page answers quickly."
scheduleMinutes15 | 60 | 180 | 360 | 720 | 960 | 1440 | nullNoMinutes between two scheduled runs (60 = hourly, 1440 = daily), or null for runs on demand only; the organisation's plan decides which schedules it offers.60
enabledboolean, default trueNofalse pauses the test, so it gets no scheduled runs; a new test is enabled when you leave it out.true

Example request

Request body: Create a testJSON
{
  "name": "Pricing page",
  "kind": "availability",
  "url": "https://shop.example.com/pricing",
  "description": "Checks that the pricing page answers quickly.",
  "scheduleMinutes": 60,
  "enabled": true
}
curl --fail-with-body -sS -X POST -i "https://optisway.com/api/v1/projects/42/tests" \
  -H "Authorization: Bearer $OPTISWAY_API_KEY" \
  -H "Content-Type: application/json" -d '{
  "name": "Pricing page",
  "kind": "availability",
  "url": "https://shop.example.com/pricing",
  "description": "Checks that the pricing page answers quickly.",
  "scheduleMinutes": 60,
  "enabled": true
}'
// Node.js 18+: save as optisway.mjs and run `node optisway.mjs`
const url = "https://optisway.com/api/v1/projects/42/tests";
const response = await fetch(url, {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.OPTISWAY_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "name": "Pricing page",
    "kind": "availability",
    "url": "https://shop.example.com/pricing",
    "description": "Checks that the pricing page answers quickly.",
    "scheduleMinutes": 60,
    "enabled": true
  }),
});
if (!response.ok) {
  const { error, message } = await response.json();
  console.error(`${response.status} ${error}: ${message}`);
  process.exit(1);
}
const test = await response.json();
const location = response.headers.get("location");
console.log(`Created test ${test.customId} (${test.id}): ${location}`);
# pip install requests
import os
import sys

import requests

api_key = os.environ["OPTISWAY_API_KEY"]
payload = {
    "name": "Pricing page",
    "kind": "availability",
    "url": "https://shop.example.com/pricing",
    "description": "Checks that the pricing page answers quickly.",
    "scheduleMinutes": 60,
    "enabled": True,
}
response = requests.post(
    "https://optisway.com/api/v1/projects/42/tests",
    headers={"Authorization": f"Bearer {api_key}"},
    json=payload,  # sent as Content-Type: application/json
    timeout=30,
)
if not response.ok:
    envelope = response.json()
    print(f"{response.status_code} {envelope['error']}: {envelope['message']}", file=sys.stderr)
    sys.exit(1)
test = response.json()
print(f"Created test {test['customId']} ({test['id']}): {response.headers['Location']}")
require "json"
require "net/http"
require "uri"

uri = URI("https://optisway.com/api/v1/projects/42/tests")
request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer #{ENV.fetch("OPTISWAY_API_KEY")}"
request["Content-Type"] = "application/json"
request.body = JSON.generate({
  "name" => 'Pricing page',
  "kind" => 'availability',
  "url" => 'https://shop.example.com/pricing',
  "description" => 'Checks that the pricing page answers quickly.',
  "scheduleMinutes" => 60,
  "enabled" => true,
})
response = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(request) }
unless response.is_a?(Net::HTTPSuccess)
  envelope = JSON.parse(response.body)
  warn "#{response.code} #{envelope["error"]}: #{envelope["message"]}"
  exit 1
end
test = JSON.parse(response.body)
puts "Created test #{test["customId"]} (#{test["id"]}): #{response["Location"]}"
<?php
$location = null;
$curl = curl_init("https://optisway.com/api/v1/projects/42/tests");
curl_setopt_array($curl, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer " . getenv("OPTISWAY_API_KEY"),
    "Content-Type: application/json",
  ],
  CURLOPT_POST => true,
  CURLOPT_POSTFIELDS => json_encode([
    'name' => 'Pricing page',
    'kind' => 'availability',
    'url' => 'https://shop.example.com/pricing',
    'description' => 'Checks that the pricing page answers quickly.',
    'scheduleMinutes' => 60,
    'enabled' => true,
  ]),
  CURLOPT_HEADERFUNCTION => function ($curl, $line) use (&$location) {
    if (stripos($line, "location:") === 0) $location = trim(substr($line, 9));
    return strlen($line);
  },
]);
$body = curl_exec($curl);
if ($body === false) {
  fwrite(STDERR, curl_error($curl) . "\n");
  exit(1);
}
$status = curl_getinfo($curl, CURLINFO_RESPONSE_CODE);
if ($status < 200 || $status >= 300) {
  $envelope = json_decode($body, true);
  fwrite(STDERR, "$status {$envelope['error']}: {$envelope['message']}\n");
  exit(1);
}
$test = json_decode($body, true);
echo "Created test {$test['customId']} ({$test['id']}): $location\n";
// 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 class Main {
  public static void main(String[] args) throws Exception {
    String url = "https://optisway.com/api/v1/projects/42/tests";
    String json = String.join("\n",
        "{",
        "  \"name\": \"Pricing page\",",
        "  \"kind\": \"availability\",",
        "  \"url\": \"https://shop.example.com/pricing\",",
        "  \"description\": \"Checks that the pricing page answers quickly.\",",
        "  \"scheduleMinutes\": 60,",
        "  \"enabled\": true",
        "}");
    HttpRequest request = HttpRequest.newBuilder(URI.create(url))
        .header("Authorization", "Bearer " + System.getenv("OPTISWAY_API_KEY"))
        .header("Content-Type", "application/json")
        .POST(HttpRequest.BodyPublishers.ofString(json))
        .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);
    }
    String body = response.body();
    String location = response.headers().firstValue("Location").orElse("");
    System.out.println("Created test " + field(body, "customId") + " (" + field(body, "id") + "): "
        + location);
  }

  /** 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"
	"strings"
)

func main() {
	url := "https://optisway.com/api/v1/projects/42/tests"
	payload := `{
	"name": "Pricing page",
	"kind": "availability",
	"url": "https://shop.example.com/pricing",
	"description": "Checks that the pricing page answers quickly.",
	"scheduleMinutes": 60,
	"enabled": true
}`
	req, err := http.NewRequest(http.MethodPost, url, strings.NewReader(payload))
	if err != nil {
		panic(err)
	}
	req.Header.Set("Authorization", "Bearer "+os.Getenv("OPTISWAY_API_KEY"))
	req.Header.Set("Content-Type", "application/json")
	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]any
	if err := json.NewDecoder(resp.Body).Decode(&body); err != nil {
		panic(err)
	}
	location := resp.Header.Get("Location")
	fmt.Printf("Created test %v (%v): %s\n", body["customId"], body["id"], location)
}
// .NET 8: `dotnet new console`, replace Program.cs with this file, then `dotnet run`
using System.Net.Http.Headers;
using System.Net.Http.Json;
using System.Text;
using System.Text.Json;

using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization =
  new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("OPTISWAY_API_KEY"));
var url = "https://optisway.com/api/v1/projects/42/tests";
var json = """
  {
    "name": "Pricing page",
    "kind": "availability",
    "url": "https://shop.example.com/pricing",
    "description": "Checks that the pricing page answers quickly.",
    "scheduleMinutes": 60,
    "enabled": true
  }
  """;
using var response = await client.PostAsync(url,
  new StringContent(json, Encoding.UTF8, "application/json"));
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 test = await response.Content.ReadFromJsonAsync<JsonElement>();
var customId = test.GetProperty("customId");
var id = test.GetProperty("id");
Console.WriteLine($"Created test {customId} ({id}): {response.Headers.Location}");

Example response

Returns: The new Test object, with 201 Created and a Location header that points at it.

Status: 201 Created

Headers: Content-Type: application/json; charset=utf-8 Cache-Control: no-store Location: /api/v1/tests/319

The test is saved: use its customId, the tst_… id, in scripts and CI. With a schedule, its first run is due one interval from now.

Response body: Create a testJSON
{
  "id": "319",
  "customId": "tst_9w4n2r8c5t1p",
  "projectId": "42",
  "name": "Pricing page",
  "kind": "availability",
  "url": "https://shop.example.com/pricing",
  "description": "Checks that the pricing page answers quickly.",
  "scheduleMinutes": 60,
  "enabled": true,
  "nextRunAt": "2026-10-20T10:30:00.000Z",
  "lastRun": null,
  "stats": {
    "runs": 0,
    "passed": 0,
    "failed": 0,
    "passRate": null
  },
  "notificationRouting": {
    "scope": "all",
    "channelIds": []
  },
  "createdAt": "2026-10-20T09:30:00.000Z",
  "updatedAt": "2026-10-20T09:30:00.000Z",
  "links": {
    "self": "/api/v1/tests/319",
    "runs": "/api/v1/tests/319/runs",
    "project": "/api/v1/projects/42"
  }
}

Errors you can get

  • forbidden 403 The key’s access level is too low: a read key tried to start a run, or a key without manage tried to change tests. Also when the key’s creator may not delete tests.
  • invalid_request 400 A path, filter or limit is invalid, or a JSON body is unreadable, too large or invalid.
  • not_found 404 The resource does not exist or is outside the key’s scope.
  • plan_limit_reached 422 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.
  • unauthorized 401 The key is missing, malformed, unknown, revoked or expired, or its creator is no longer a member.
  • rate_limited 429 The key sent too many requests; wait the seconds in Retry-After.
  • unavailable 503 A temporary problem on our side; try again later.

Update a test PATCH /tests/{id}

Changes the fields you send and keeps the others; null clears description or the schedule, and kind and the configuration never change here. Needs a key with manage access; a new schedule or enabled value restarts the interval from now, and selecting notification channels needs a plan that includes them. The example renames test tst_7k2m9q4xh3vd, makes it run every hour and sends its notifications only to the checkout team's Slack channel.

Needs a key with access: Manage

Parameters

Parameters: PATCH /tests/{id}
NameInTypeRequiredDescriptionExample
idPathstring (numeric id or tst_… id)YesThe test: its numeric id or its public tst_… id from the app.tst_7k2m9q4xh3vd
Request body: PATCH /tests/{id}
NameTypeRequiredDescriptionExample
namestring, 1–100 charactersNoThe test's name as shown in the app: 1–100 characters without line breaks."Checkout page (EU)"
urlstring (public http:// or https:// URL)NoThe page or address the test checks: a complete, public http:// or https:// URL.null
descriptionstring, ≤ 500 characters | nullNoA note of up to 500 characters; null or an empty string leaves it empty.null
scheduleMinutes15 | 60 | 180 | 360 | 720 | 960 | 1440 | nullNoMinutes between two scheduled runs (60 = hourly, 1440 = daily), or null for runs on demand only; the organisation's plan decides which schedules it offers.60
enabledbooleanNofalse pauses the test, so it gets no scheduled runs; a new test is enabled when you leave it out.null
notificationRoutingNotificationRoutingNoWhich notification channels the test notifies, with the ids from the channel list; selecting channels needs a plan that includes notification channels, while every channel is always allowed.{"scope":"selected","channelIds":["12"]}

Example request

Request body: Update a testJSON
{
  "name": "Checkout page (EU)",
  "scheduleMinutes": 60,
  "notificationRouting": {
    "scope": "selected",
    "channelIds": [
      "12"
    ]
  }
}
curl --fail-with-body -sS -X PATCH "https://optisway.com/api/v1/tests/tst_7k2m9q4xh3vd" \
  -H "Authorization: Bearer $OPTISWAY_API_KEY" \
  -H "Content-Type: application/json" -d '{
  "name": "Checkout page (EU)",
  "scheduleMinutes": 60,
  "notificationRouting": {
    "scope": "selected",
    "channelIds": [
      "12"
    ]
  }
}'
// Node.js 18+: save as optisway.mjs and run `node optisway.mjs`
const url = "https://optisway.com/api/v1/tests/tst_7k2m9q4xh3vd";
const response = await fetch(url, {
  method: "PATCH",
  headers: {
    Authorization: `Bearer ${process.env.OPTISWAY_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "name": "Checkout page (EU)",
    "scheduleMinutes": 60,
    "notificationRouting": {
      "scope": "selected",
      "channelIds": [
        "12"
      ]
    }
  }),
});
if (!response.ok) {
  const { error, message } = await response.json();
  console.error(`${response.status} ${error}: ${message}`);
  process.exit(1);
}
const body = await response.json();
console.log(`Name: ${body.name}`);
console.log(`Next run: ${body.nextRunAt}`);
# pip install requests
import os
import sys

import requests

api_key = os.environ["OPTISWAY_API_KEY"]
payload = {
    "name": "Checkout page (EU)",
    "scheduleMinutes": 60,
    "notificationRouting": {
        "scope": "selected",
        "channelIds": ["12"],
    },
}
response = requests.patch(
    "https://optisway.com/api/v1/tests/tst_7k2m9q4xh3vd",
    headers={"Authorization": f"Bearer {api_key}"},
    json=payload,  # sent as Content-Type: application/json
    timeout=30,
)
if not response.ok:
    envelope = response.json()
    print(f"{response.status_code} {envelope['error']}: {envelope['message']}", file=sys.stderr)
    sys.exit(1)
body = response.json()
print("Name:", body["name"])
print("Next run:", body["nextRunAt"])
require "json"
require "net/http"
require "uri"

uri = URI("https://optisway.com/api/v1/tests/tst_7k2m9q4xh3vd")
request = Net::HTTP::Patch.new(uri)
request["Authorization"] = "Bearer #{ENV.fetch("OPTISWAY_API_KEY")}"
request["Content-Type"] = "application/json"
request.body = JSON.generate({
  "name" => 'Checkout page (EU)',
  "scheduleMinutes" => 60,
  "notificationRouting" => {
    "scope" => 'selected',
    "channelIds" => ['12'],
  },
})
response = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(request) }
unless response.is_a?(Net::HTTPSuccess)
  envelope = JSON.parse(response.body)
  warn "#{response.code} #{envelope["error"]}: #{envelope["message"]}"
  exit 1
end
body = JSON.parse(response.body)
puts "Name: #{body["name"]}"
puts "Next run: #{body["nextRunAt"]}"
<?php
$curl = curl_init("https://optisway.com/api/v1/tests/tst_7k2m9q4xh3vd");
curl_setopt_array($curl, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer " . getenv("OPTISWAY_API_KEY"),
    "Content-Type: application/json",
  ],
  CURLOPT_CUSTOMREQUEST => "PATCH",
  CURLOPT_POSTFIELDS => json_encode([
    'name' => 'Checkout page (EU)',
    'scheduleMinutes' => 60,
    'notificationRouting' => [
      'scope' => 'selected',
      'channelIds' => ['12'],
    ],
  ]),
]);
$body = curl_exec($curl);
if ($body === false) {
  fwrite(STDERR, curl_error($curl) . "\n");
  exit(1);
}
$status = curl_getinfo($curl, CURLINFO_RESPONSE_CODE);
if ($status < 200 || $status >= 300) {
  $envelope = json_decode($body, true);
  fwrite(STDERR, "$status {$envelope['error']}: {$envelope['message']}\n");
  exit(1);
}
$data = json_decode($body, true);
echo "Name: {$data['name']}\n";
echo "Next run: {$data['nextRunAt']}\n";
// 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 class Main {
  public static void main(String[] args) throws Exception {
    String url = "https://optisway.com/api/v1/tests/tst_7k2m9q4xh3vd";
    String json = String.join("\n",
        "{",
        "  \"name\": \"Checkout page (EU)\",",
        "  \"scheduleMinutes\": 60,",
        "  \"notificationRouting\": {",
        "    \"scope\": \"selected\",",
        "    \"channelIds\": [",
        "      \"12\"",
        "    ]",
        "  }",
        "}");
    HttpRequest request = HttpRequest.newBuilder(URI.create(url))
        .header("Authorization", "Bearer " + System.getenv("OPTISWAY_API_KEY"))
        .header("Content-Type", "application/json")
        .method("PATCH", HttpRequest.BodyPublishers.ofString(json))
        .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);
    }
    String body = response.body();
    System.out.println("Name: " + field(body, "name"));
    System.out.println("Next run: " + field(body, "nextRunAt"));
  }

  /** 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"
	"strings"
)

func main() {
	url := "https://optisway.com/api/v1/tests/tst_7k2m9q4xh3vd"
	payload := `{
	"name": "Checkout page (EU)",
	"scheduleMinutes": 60,
	"notificationRouting": {
		"scope": "selected",
		"channelIds": [
			"12"
		]
	}
}`
	req, err := http.NewRequest(http.MethodPatch, url, strings.NewReader(payload))
	if err != nil {
		panic(err)
	}
	req.Header.Set("Authorization", "Bearer "+os.Getenv("OPTISWAY_API_KEY"))
	req.Header.Set("Content-Type", "application/json")
	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]any
	if err := json.NewDecoder(resp.Body).Decode(&body); err != nil {
		panic(err)
	}
	fmt.Println("Name:", body["name"])
	fmt.Println("Next run:", body["nextRunAt"])
}
// .NET 8: `dotnet new console`, replace Program.cs with this file, then `dotnet run`
using System.Net.Http.Headers;
using System.Net.Http.Json;
using System.Text;
using System.Text.Json;

using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization =
  new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("OPTISWAY_API_KEY"));
var url = "https://optisway.com/api/v1/tests/tst_7k2m9q4xh3vd";
var json = """
  {
    "name": "Checkout page (EU)",
    "scheduleMinutes": 60,
    "notificationRouting": {
      "scope": "selected",
      "channelIds": [
        "12"
      ]
    }
  }
  """;
using var response = await client.PatchAsync(url,
  new StringContent(json, Encoding.UTF8, "application/json"));
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($"Name: {body.GetProperty("name")}");
Console.WriteLine($"Next run: {body.GetProperty("nextRunAt")}");

Example response

Returns: The updated Test object.

Status: 200 OK

Headers: Content-Type: application/json; charset=utf-8 Cache-Control: no-store

Response body: Update a testJSON
{
  "id": "318",
  "customId": "tst_7k2m9q4xh3vd",
  "projectId": "42",
  "name": "Checkout page (EU)",
  "kind": "availability",
  "url": "https://shop.example.com/",
  "description": "Checks that the checkout answers quickly and without errors.",
  "scheduleMinutes": 60,
  "enabled": true,
  "nextRunAt": "2026-10-20T10:45:00.000Z",
  "lastRun": {
    "id": "4821",
    "status": "failed",
    "trigger": "api",
    "startedAt": "2026-10-19T09:12:01.000Z",
    "finishedAt": "2026-10-19T09:12:03.140Z",
    "durationMs": 2140,
    "summary": "503 Service Unavailable in 184 ms"
  },
  "stats": {
    "runs": 30,
    "passed": 28,
    "failed": 2,
    "passRate": 93
  },
  "notificationRouting": {
    "scope": "selected",
    "channelIds": [
      "12"
    ]
  },
  "createdAt": "2026-09-02T14:05:00.000Z",
  "updatedAt": "2026-10-20T09:45:00.000Z",
  "links": {
    "self": "/api/v1/tests/318",
    "runs": "/api/v1/tests/318/runs",
    "project": "/api/v1/projects/42"
  }
}

Errors you can get

  • forbidden 403 The key’s access level is too low: a read key tried to start a run, or a key without manage tried to change tests. Also when the key’s creator may not delete tests.
  • invalid_request 400 A path, filter or limit is invalid, or a JSON body is unreadable, too large or invalid.
  • not_found 404 The resource does not exist or is outside the key’s scope.
  • plan_limit_reached 422 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.
  • unauthorized 401 The key is missing, malformed, unknown, revoked or expired, or its creator is no longer a member.
  • rate_limited 429 The key sent too many requests; wait the seconds in Retry-After.
  • unavailable 503 A temporary problem on our side; try again later.

Delete a test DELETE /tests/{id}

Deletes the test and its run history; this cannot be undone. Needs a key with manage access whose creator is an owner or admin, and while the test has a queued or running run the API answers 409 run_in_progress and deletes nothing. The example deletes test tst_7k2m9q4xh3vd.

Needs a key with access: Manage

Parameters

Parameters: DELETE /tests/{id}
NameInTypeRequiredDescriptionExample
idPathstring (numeric id or tst_… id)YesThe test: its numeric id or its public tst_… id from the app.tst_7k2m9q4xh3vd

Example request

curl --fail-with-body -sS -X DELETE "https://optisway.com/api/v1/tests/tst_7k2m9q4xh3vd" \
  -H "Authorization: Bearer $OPTISWAY_API_KEY" \
  -w "HTTP %{http_code}\n"
// Node.js 18+: save as optisway.mjs and run `node optisway.mjs`
const url = "https://optisway.com/api/v1/tests/tst_7k2m9q4xh3vd";
const response = await fetch(url, {
  method: "DELETE",
  headers: {
    Authorization: `Bearer ${process.env.OPTISWAY_API_KEY}`,
  },
});
if (!response.ok) {
  const { error, message } = await response.json();
  console.error(`${response.status} ${error}: ${message}`);
  process.exit(1);
}
console.log(`Deleted (HTTP ${response.status})`);
# pip install requests
import os
import sys

import requests

api_key = os.environ["OPTISWAY_API_KEY"]
response = requests.delete(
    "https://optisway.com/api/v1/tests/tst_7k2m9q4xh3vd",
    headers={"Authorization": f"Bearer {api_key}"},
    timeout=30,
)
if not response.ok:
    envelope = response.json()
    print(f"{response.status_code} {envelope['error']}: {envelope['message']}", file=sys.stderr)
    sys.exit(1)
print(f"Deleted (HTTP {response.status_code})")
require "json"
require "net/http"
require "uri"

uri = URI("https://optisway.com/api/v1/tests/tst_7k2m9q4xh3vd")
request = Net::HTTP::Delete.new(uri)
request["Authorization"] = "Bearer #{ENV.fetch("OPTISWAY_API_KEY")}"
response = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(request) }
unless response.is_a?(Net::HTTPSuccess)
  envelope = JSON.parse(response.body)
  warn "#{response.code} #{envelope["error"]}: #{envelope["message"]}"
  exit 1
end
puts "Deleted (HTTP #{response.code})"
<?php
$curl = curl_init("https://optisway.com/api/v1/tests/tst_7k2m9q4xh3vd");
curl_setopt_array($curl, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer " . getenv("OPTISWAY_API_KEY"),
  ],
  CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$body = curl_exec($curl);
if ($body === false) {
  fwrite(STDERR, curl_error($curl) . "\n");
  exit(1);
}
$status = curl_getinfo($curl, CURLINFO_RESPONSE_CODE);
if ($status < 200 || $status >= 300) {
  $envelope = json_decode($body, true);
  fwrite(STDERR, "$status {$envelope['error']}: {$envelope['message']}\n");
  exit(1);
}
echo "Deleted (HTTP $status)\n";
// 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 class Main {
  public static void main(String[] args) throws Exception {
    String url = "https://optisway.com/api/v1/tests/tst_7k2m9q4xh3vd";
    HttpRequest request = HttpRequest.newBuilder(URI.create(url))
        .header("Authorization", "Bearer " + System.getenv("OPTISWAY_API_KEY"))
        .DELETE()
        .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);
    }
    System.out.println("Deleted (HTTP " + response.statusCode() + ")");
  }

  /** 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/tests/tst_7k2m9q4xh3vd"
	req, err := http.NewRequest(http.MethodDelete, 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)
	}
	fmt.Printf("Deleted (HTTP %d)\n", resp.StatusCode)
}
// .NET 8: `dotnet new console`, replace Program.cs with this file, then `dotnet run`
using System.Net.Http.Headers;
using System.Net.Http.Json;
using System.Text.Json;

using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization =
  new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("OPTISWAY_API_KEY"));
var url = "https://optisway.com/api/v1/tests/tst_7k2m9q4xh3vd";
using var response = await client.DeleteAsync(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);
}
Console.WriteLine($"Deleted (HTTP {(int)response.StatusCode})");

Example response

Returns: No body: the status is 204 No Content.

Status: 204 No Content

Headers: Cache-Control: no-store

There is no body. The test and its runs are gone, and its ids now answer 404 not_found.

Errors you can get

  • forbidden 403 The key’s access level is too low: a read key tried to start a run, or a key without manage tried to change tests. Also when the key’s creator may not delete tests.
  • not_found 404 The resource does not exist or is outside the key’s scope.
  • run_in_progress 409 The test already has a run in progress.
  • unauthorized 401 The key is missing, malformed, unknown, revoked or expired, or its creator is no longer a member.
  • rate_limited 429 The key sent too many requests; wait the seconds in Retry-After.
  • unavailable 503 A temporary problem on our side; try again later.

List the runs of a test GET /tests/{id}/runs

Lists the runs of one test, newest first, one page at a time. Needs read access. The example asks for two runs per page; because the page is full, next holds the path of the following page.

Needs a key with access: Read

Parameters

Parameters: GET /tests/{id}/runs
NameInTypeRequiredDescriptionExample
idPathstring (numeric id or tst_… id)YesThe test: its numeric id or its public tst_… id from the app.tst_7k2m9q4xh3vd
limitQuery stringinteger, 1–50, default 20NoHow many runs one page holds: a whole number from 1 to 50; without it, a page holds 20.2
beforeQuery stringstring (run id)NoReturns only runs older than this run id; you normally follow next instead of setting it yourself.4790

Example request

curl --fail-with-body -sS "https://optisway.com/api/v1/tests/tst_7k2m9q4xh3vd/runs?limit=2" \
  -H "Authorization: Bearer $OPTISWAY_API_KEY"
// Node.js 18+: save as optisway.mjs and run `node optisway.mjs`
const url = "https://optisway.com/api/v1/tests/tst_7k2m9q4xh3vd/runs?limit=2";
const response = await fetch(url, {
  headers: {
    Authorization: `Bearer ${process.env.OPTISWAY_API_KEY}`,
  },
});
if (!response.ok) {
  const { error, message } = await response.json();
  console.error(`${response.status} ${error}: ${message}`);
  process.exit(1);
}
const { items } = await response.json();
for (const item of items) console.log(item.id, item.status, item.summary);
# pip install requests
import os
import sys

import requests

api_key = os.environ["OPTISWAY_API_KEY"]
response = requests.get(
    "https://optisway.com/api/v1/tests/tst_7k2m9q4xh3vd/runs?limit=2",
    headers={"Authorization": f"Bearer {api_key}"},
    timeout=30,
)
if not response.ok:
    envelope = response.json()
    print(f"{response.status_code} {envelope['error']}: {envelope['message']}", file=sys.stderr)
    sys.exit(1)
for item in response.json()["items"]:
    print(item["id"], item["status"], item["summary"])
require "json"
require "net/http"
require "uri"

uri = URI("https://optisway.com/api/v1/tests/tst_7k2m9q4xh3vd/runs?limit=2")
request = Net::HTTP::Get.new(uri)
request["Authorization"] = "Bearer #{ENV.fetch("OPTISWAY_API_KEY")}"
response = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(request) }
unless response.is_a?(Net::HTTPSuccess)
  envelope = JSON.parse(response.body)
  warn "#{response.code} #{envelope["error"]}: #{envelope["message"]}"
  exit 1
end
JSON.parse(response.body)["items"].each do |item|
  puts [item["id"], item["status"], item["summary"]].join("  ")
end
<?php
$curl = curl_init("https://optisway.com/api/v1/tests/tst_7k2m9q4xh3vd/runs?limit=2");
curl_setopt_array($curl, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer " . getenv("OPTISWAY_API_KEY"),
  ],
]);
$body = curl_exec($curl);
if ($body === false) {
  fwrite(STDERR, curl_error($curl) . "\n");
  exit(1);
}
$status = curl_getinfo($curl, CURLINFO_RESPONSE_CODE);
if ($status < 200 || $status >= 300) {
  $envelope = json_decode($body, true);
  fwrite(STDERR, "$status {$envelope['error']}: {$envelope['message']}\n");
  exit(1);
}
foreach (json_decode($body, true)["items"] as $item) {
  echo $item["id"], "  ", $item["status"], "  ", $item["summary"], "\n";
}
// 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 class Main {
  public static void main(String[] args) throws Exception {
    String url = "https://optisway.com/api/v1/tests/tst_7k2m9q4xh3vd/runs?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/tests/tst_7k2m9q4xh3vd/runs?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]any
	if 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`
using System.Net.Http.Headers;
using System.Net.Http.Json;
using System.Text.Json;

using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization =
  new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("OPTISWAY_API_KEY"));
var url = "https://optisway.com/api/v1/tests/tst_7k2m9q4xh3vd/runs?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).

Status: 200 OK

Headers: Content-Type: application/json; charset=utf-8 Cache-Control: no-store

Response body: List the runs of a testJSON
{
  "items": [
    {
      "id": "4821",
      "testId": "318",
      "testName": "Checkout page",
      "testKind": "availability",
      "projectId": "42",
      "projectName": "Acme Shop",
      "status": "failed",
      "trigger": "api",
      "startedAt": "2026-10-19T09:12:01.000Z",
      "finishedAt": "2026-10-19T09:12:03.140Z",
      "durationMs": 2140,
      "summary": "503 Service Unavailable in 184 ms",
      "checks": {
        "total": 3,
        "passed": 2,
        "failed": 1
      },
      "findings": [
        {
          "severity": "fail",
          "code": "status",
          "message": "503 Service Unavailable",
          "target": "https://shop.example.com/",
          "value": 503,
          "unit": "status",
          "ruleId": null
        },
        {
          "severity": "pass",
          "code": "redirect-chain",
          "message": "No redirects",
          "target": "https://shop.example.com/",
          "value": 0,
          "unit": "count",
          "ruleId": null
        },
        {
          "severity": "pass",
          "code": "response-time",
          "message": "184 ms",
          "target": "https://shop.example.com/",
          "value": 184,
          "unit": "ms",
          "ruleId": null
        }
      ],
      "artifacts": {
        "bytes": 48213,
        "video": false,
        "url": "/api/v1/runs/4821/artifacts",
        "filesUrl": "/api/v1/runs/4821/files"
      },
      "artifactError": null,
      "createdAt": "2026-10-19T09:12:00.000Z",
      "links": {
        "self": "/api/v1/runs/4821",
        "test": "/api/v1/tests/318"
      }
    },
    {
      "id": "4790",
      "testId": "318",
      "testName": "Checkout page",
      "testKind": "availability",
      "projectId": "42",
      "projectName": "Acme Shop",
      "status": "failed",
      "trigger": "schedule",
      "startedAt": "2026-10-18T09:12:02.000Z",
      "finishedAt": "2026-10-18T09:12:12.310Z",
      "durationMs": 10310,
      "summary": "The page could not be loaded: No response within 10 s.",
      "checks": {
        "total": 1,
        "passed": 0,
        "failed": 1
      },
      "findings": [
        {
          "severity": "fail",
          "code": "fetch-error",
          "message": "No response within 10 s.",
          "target": "https://shop.example.com/",
          "value": null,
          "unit": null,
          "ruleId": null
        }
      ],
      "artifacts": {
        "bytes": 41877,
        "video": false,
        "url": "/api/v1/runs/4790/artifacts",
        "filesUrl": "/api/v1/runs/4790/files"
      },
      "artifactError": null,
      "createdAt": "2026-10-18T09:12:00.000Z",
      "links": {
        "self": "/api/v1/runs/4790",
        "test": "/api/v1/tests/318"
      }
    }
  ],
  "next": "/api/v1/tests/tst_7k2m9q4xh3vd/runs?limit=2&before=4790"
}

Errors you can get

  • invalid_request 400 A path, filter or limit is invalid, or a JSON body is unreadable, too large or invalid.
  • not_found 404 The resource does not exist or is outside the key’s scope.
  • unauthorized 401 The key is missing, malformed, unknown, revoked or expired, or its creator is no longer a member.
  • rate_limited 429 The key sent too many requests; wait the seconds in Retry-After.
  • unavailable 503 A temporary problem on our side; try again later.

Start a run POST /tests/{id}/runs

Queues a run of the test with trigger api and answers 202 Accepted at once, without waiting for the result; it counts against the organisation's 30 manual and API runs per hour. Needs a key with run access; send no body (a JSON body of up to 16 KiB is accepted and ignored). The example queues run 4821, and the Location header points at it.

Needs a key with access: Run

Parameters

Parameters: POST /tests/{id}/runs
NameInTypeRequiredDescriptionExample
idPathstring (numeric id or tst_… id)YesThe test: its numeric id or its public tst_… id from the app.tst_7k2m9q4xh3vd

Example request

curl --fail-with-body -sS -X POST -i "https://optisway.com/api/v1/tests/tst_7k2m9q4xh3vd/runs" \
  -H "Authorization: Bearer $OPTISWAY_API_KEY"
// Node.js 18+: save as optisway.mjs and run `node optisway.mjs`
const url = "https://optisway.com/api/v1/tests/tst_7k2m9q4xh3vd/runs";
const response = await fetch(url, {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.OPTISWAY_API_KEY}`,
  },
});
if (!response.ok) {
  const { error, message } = await response.json();
  console.error(`${response.status} ${error}: ${message}`);
  process.exit(1);
}
const run = await response.json();
console.log(`Run ${run.id} is ${run.status}: ${response.headers.get("location")}`);
console.log("Poll GET /runs/{id} every 10 seconds until status is passed, failed or error.");
# pip install requests
import os
import sys

import requests

api_key = os.environ["OPTISWAY_API_KEY"]
response = requests.post(
    "https://optisway.com/api/v1/tests/tst_7k2m9q4xh3vd/runs",
    headers={"Authorization": f"Bearer {api_key}"},
    timeout=30,
)
if not response.ok:
    envelope = response.json()
    print(f"{response.status_code} {envelope['error']}: {envelope['message']}", file=sys.stderr)
    sys.exit(1)
run = response.json()
print(f"Run {run['id']} is {run['status']}: {response.headers['Location']}")
print("Poll GET /runs/{id} every 10 seconds until status is passed, failed or error.")
require "json"
require "net/http"
require "uri"

uri = URI("https://optisway.com/api/v1/tests/tst_7k2m9q4xh3vd/runs")
request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer #{ENV.fetch("OPTISWAY_API_KEY")}"
response = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(request) }
unless response.is_a?(Net::HTTPSuccess)
  envelope = JSON.parse(response.body)
  warn "#{response.code} #{envelope["error"]}: #{envelope["message"]}"
  exit 1
end
run = JSON.parse(response.body)
puts "Run #{run["id"]} is #{run["status"]}: #{response["Location"]}"
puts "Poll GET /runs/{id} every 10 seconds until status is passed, failed or error."
<?php
$location = null;
$curl = curl_init("https://optisway.com/api/v1/tests/tst_7k2m9q4xh3vd/runs");
curl_setopt_array($curl, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer " . getenv("OPTISWAY_API_KEY"),
  ],
  CURLOPT_POST => true,
  CURLOPT_POSTFIELDS => "",
  CURLOPT_HEADERFUNCTION => function ($curl, $line) use (&$location) {
    if (stripos($line, "location:") === 0) $location = trim(substr($line, 9));
    return strlen($line);
  },
]);
$body = curl_exec($curl);
if ($body === false) {
  fwrite(STDERR, curl_error($curl) . "\n");
  exit(1);
}
$status = curl_getinfo($curl, CURLINFO_RESPONSE_CODE);
if ($status < 200 || $status >= 300) {
  $envelope = json_decode($body, true);
  fwrite(STDERR, "$status {$envelope['error']}: {$envelope['message']}\n");
  exit(1);
}
$run = json_decode($body, true);
echo "Run {$run['id']} is {$run['status']}: $location\n";
echo "Poll GET /runs/{id} every 10 seconds until status is passed, failed or error.", "\n";
// 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 class Main {
  public static void main(String[] args) throws Exception {
    String url = "https://optisway.com/api/v1/tests/tst_7k2m9q4xh3vd/runs";
    HttpRequest request = HttpRequest.newBuilder(URI.create(url))
        .header("Authorization", "Bearer " + System.getenv("OPTISWAY_API_KEY"))
        .POST(HttpRequest.BodyPublishers.noBody())
        .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);
    }
    String body = response.body();
    String location = response.headers().firstValue("Location").orElse("");
    System.out.println("Run " + field(body, "id") + " is " + field(body, "status") + ": " + location);
    System.out.println("Poll GET /runs/{id} every 10 seconds until status is passed, failed or error.");
  }

  /** 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/tests/tst_7k2m9q4xh3vd/runs"
	req, err := http.NewRequest(http.MethodPost, 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]any
	if err := json.NewDecoder(resp.Body).Decode(&body); err != nil {
		panic(err)
	}
	fmt.Printf("Run %v is %v: %s\n", body["id"], body["status"], resp.Header.Get("Location"))
	fmt.Println("Poll GET /runs/{id} every 10 seconds until status is passed, failed or error.")
}
// .NET 8: `dotnet new console`, replace Program.cs with this file, then `dotnet run`
using System.Net.Http.Headers;
using System.Net.Http.Json;
using System.Text.Json;

using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization =
  new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("OPTISWAY_API_KEY"));
var url = "https://optisway.com/api/v1/tests/tst_7k2m9q4xh3vd/runs";
using var response = await client.PostAsync(url, null);
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 run = await response.Content.ReadFromJsonAsync<JsonElement>();
var id = run.GetProperty("id");
var status = run.GetProperty("status");
Console.WriteLine($"Run {id} is {status}: {response.Headers.Location}");
Console.WriteLine("Poll GET /runs/{id} every 10 seconds until status is passed, failed or error.");

Example response

Returns: The queued Run object (status is queued).

Status: 202 Accepted

Headers: Content-Type: application/json; charset=utf-8 Cache-Control: no-store Location: /api/v1/runs/4821

The run is queued, not finished: read GET /runs/{id} (the Location header) every 10 seconds until status is passed, failed or error.

Response body: Start a runJSON
{
  "id": "4821",
  "testId": "318",
  "testName": "Checkout page",
  "testKind": "availability",
  "projectId": "42",
  "projectName": "Acme Shop",
  "status": "queued",
  "trigger": "api",
  "startedAt": null,
  "finishedAt": null,
  "durationMs": null,
  "summary": "",
  "checks": {
    "total": 0,
    "passed": 0,
    "failed": 0
  },
  "findings": [],
  "artifacts": null,
  "artifactError": null,
  "createdAt": "2026-10-19T09:12:00.000Z",
  "links": {
    "self": "/api/v1/runs/4821",
    "test": "/api/v1/tests/318"
  }
}

Errors you can get

  • forbidden 403 The key’s access level is too low: a read key tried to start a run, or a key without manage tried to change tests. Also when the key’s creator may not delete tests.
  • not_found 404 The resource does not exist or is outside the key’s scope.
  • run_in_progress 409 The test already has a run in progress.
  • run_limit_reached 429 The organisation has used its hourly run budget or its plan’s daily or monthly run quota; Retry-After says when to try again.
  • kind_unsupported 422 This server cannot run the test’s kind right now.
  • plan_limit_reached 422 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.
  • invalid_request 400 A path, filter or limit is invalid, or a JSON body is unreadable, too large or invalid.
  • unauthorized 401 The key is missing, malformed, unknown, revoked or expired, or its creator is no longer a member.
  • rate_limited 429 The key sent too many requests; wait the seconds in Retry-After.
  • unavailable 503 A temporary problem on our side; try again later.