Audit a marketing page for conversion from your own scripts
Send a page — raw HTML straight off the server, or just the copy pasted out of the
CMS — and get back one JSON object: an honest verdict, a scorecard across five
conversion areas, the quick wins worth shipping today, the high-impact bets worth
prioritizing, testable hypotheses, and ready-to-paste copy alternatives for the weakest
elements. Everything this app does goes through the SkillSafe App API — plain JSON over
HTTPS — so you can wire the audit into a CMS publish hook, a landing-page build
pipeline, or a nightly sweep that flags every page still shipping a
Submit button.
Every code step below is shown in cURL, Python, JavaScript, Go, Java, Ruby, PHP and C#;
pick a language once and the whole page follows.
Basics
Base URL: https://api.skillsafe.ai/v1/app-api, app slug
cro-audit. Every request sends
Authorization: Bearer <token> and JSON bodies with
Content-Type: application/json. Responses are wrapped in an envelope:
{"data": …} on success, {"error": {"code", "message"}} on failure.
The audit itself is produced by the gpt-terra model. Estimates are free;
runs are metered against your credit balance. There is a single run task — one paste
in, one audit out, no follow-up calls and no session state to carry.
| Status | Meaning |
|---|---|
401 | Missing or expired token — create a new session. |
402 | Not enough credits — top up at skillsafe.ai/account/credits. |
403 | The token isn't allowed to do this (e.g. a guest auditing a very large paste). |
404 | Unknown job or record id. |
5xx | Transient platform error — retry with backoff. |
Browsers enforce CORS for this API, so run these examples from a server, script or terminal — not from another website's frontend.
Step 0 — A tiny client
Every task below is a single HTTP call, so start with a short helper that adds the auth
header, sends JSON and unwraps the data envelope. The later steps reuse it.
export API="https://api.skillsafe.ai/v1/app-api"
export TOKEN="YOUR_TOKEN" # see step 1
# every call looks like:
# curl -s "$API/..." -H "Authorization: Bearer $TOKEN" [-d '{json}']
# jq is used below to pull fields out of the {"data": ...} envelope
import json, requests
API = "https://api.skillsafe.ai/v1/app-api"
TOKEN = "YOUR_TOKEN" # see step 1 — read it from your shell environment in real code
def api(method, path, body=None, **headers):
res = requests.request(method, API + path, json=body,
headers={"Authorization": f"Bearer {TOKEN}", **headers})
payload = res.json()
if not res.ok:
raise RuntimeError(payload.get("error", {}).get("message", res.reason))
return payload["data"]
// Node 18+ (built-in fetch)
const API = "https://api.skillsafe.ai/v1/app-api";
const TOKEN = "YOUR_TOKEN"; // see step 1 — read it from your shell environment in real code
async function api(method, path, body, extraHeaders = {}) {
const res = await fetch(API + path, {
method,
headers: { Authorization: `Bearer ${TOKEN}`, "Content-Type": "application/json", ...extraHeaders },
body: body === undefined ? undefined : JSON.stringify(body),
});
const json = await res.json();
if (!res.ok) throw new Error(json.error?.message ?? res.statusText);
return json.data;
}
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"os"
)
const API = "https://api.skillsafe.ai/v1/app-api"
var token = os.Getenv("SKILLSAFE_TOKEN") // see step 1
func call(method, path string, body, out any) error {
var buf bytes.Buffer
if body != nil {
json.NewEncoder(&buf).Encode(body)
}
req, _ := http.NewRequest(method, API+path, &buf)
req.Header.Set("Authorization", "Bearer "+token)
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
return err
}
defer res.Body.Close()
var env struct {
Data json.RawMessage `json:"data"`
Error *struct{ Message string `json:"message"` } `json:"error"`
}
json.NewDecoder(res.Body).Decode(&env)
if res.StatusCode >= 400 {
return fmt.Errorf("api %s %s: %s", method, path, env.Error.Message)
}
if out == nil {
return nil
}
return json.Unmarshal(env.Data, out)
}
// Java 17+, no dependencies. Pair with your JSON library (Jackson, Gson…)
// to read fields out of the returned envelope.
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class SkillSafe {
static final String API = "https://api.skillsafe.ai/v1/app-api";
static final String TOKEN = System.getenv("SKILLSAFE_TOKEN"); // see step 1
static final HttpClient HTTP = HttpClient.newHttpClient();
static String api(String method, String path, String jsonBody) throws Exception {
var req = HttpRequest.newBuilder(URI.create(API + path))
.header("Authorization", "Bearer " + TOKEN)
.header("Content-Type", "application/json")
.method(method, jsonBody == null
? HttpRequest.BodyPublishers.noBody()
: HttpRequest.BodyPublishers.ofString(jsonBody))
.build();
var res = HTTP.send(req, HttpResponse.BodyHandlers.ofString());
if (res.statusCode() >= 400) throw new RuntimeException(res.body());
return res.body(); // envelope: {"data": …}
}
}
require "net/http"
require "json"
API = "https://api.skillsafe.ai/v1/app-api"
TOKEN = ENV.fetch("SKILLSAFE_TOKEN") # see step 1
def api(method, path, body = nil)
uri = URI(API + path)
req = Net::HTTP.const_get(method.capitalize).new(uri)
req["Authorization"] = "Bearer #{TOKEN}"
req["Content-Type"] = "application/json"
req.body = body.to_json if body
res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |h| h.request(req) }
payload = JSON.parse(res.body)
raise (payload.dig("error", "message") || res.message) unless res.is_a?(Net::HTTPSuccess)
payload["data"]
end
<?php
const API = "https://api.skillsafe.ai/v1/app-api";
$TOKEN = getenv("SKILLSAFE_TOKEN"); // see step 1
function api(string $method, string $path, ?array $body = null): mixed {
global $TOKEN;
$ch = curl_init(API . $path);
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => $method,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer $TOKEN",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => $body === null ? null : json_encode($body),
]);
$payload = json_decode(curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
curl_close($ch);
if ($status >= 400) {
throw new Exception($payload["error"]["message"] ?? "HTTP $status");
}
return $payload["data"];
}
// .NET 8+
using System.Net.Http.Json;
using System.Text.Json;
static class SkillSafe
{
const string Api = "https://api.skillsafe.ai/v1/app-api";
static readonly HttpClient Http = new();
static SkillSafe() =>
Http.DefaultRequestHeaders.Authorization =
new("Bearer", Environment.GetEnvironmentVariable("SKILLSAFE_TOKEN")); // see step 1
public static async Task<JsonElement> ApiAsync(HttpMethod method, string path, object? body = null)
{
var req = new HttpRequestMessage(method, Api + path);
if (body != null) req.Content = JsonContent.Create(body);
var res = await Http.SendAsync(req);
var json = await res.Content.ReadFromJsonAsync<JsonElement>();
if (!res.IsSuccessStatusCode)
throw new Exception(json.GetProperty("error").GetProperty("message").GetString());
return json.GetProperty("data");
}
}
Step 1 — Get a token
A guest token lets you check balances and estimate costs for free. For metered audit runs
billed to your own account, use your personal token: open the
token page, sign in with SkillSafe, and press
Copy shell export — it puts export SKILLSAFE_TOKEN="…" on your
clipboard, which every example below reads. Treat the token like a password: it can spend
your credits. For fully headless scripts, POST /guest mints a guest token with
no browser involved.
curl -s -X POST "$API/guest" \
-H "Content-Type: application/json" \
-d '{"slug":"cro-audit"}' | jq -r '.data.token'
token = api("POST", "/guest", {"slug": "cro-audit"})["token"]
const { token } = await api("POST", "/guest", { slug: "cro-audit" });
var guest struct{ Token string `json:"token"` }
err := call("POST", "/guest", map[string]string{"slug": "cro-audit"}, &guest)
String envelope = api("POST", "/guest", """
{"slug":"cro-audit"}""");
// token is at data.token in the returned JSON
token = api("POST", "/guest", { slug: "cro-audit" })["token"]
$token = api("POST", "/guest", ["slug" => "cro-audit"])["token"];
var guest = await SkillSafe.ApiAsync(HttpMethod.Post, "/guest",
new { slug = "cro-audit" });
var token = guest.GetProperty("token").GetString();
The app stores this browser's token under the localStorage key
skillsafe_app_token:cro-audit, on the app's own origin. The
token page reads and manages it for you — you never need
to open developer tools.
Step 2 — Check who you are and your balance
Returns subject_type ("user" or "guest"),
subject_id and your credits balance. Check this before auditing
a large paste.
curl -s "$API/me" -H "Authorization: Bearer $TOKEN" | jq '.data'
me = api("GET", "/me")
print(me["subject_type"], me["credits"])
const me = await api("GET", "/me");
console.log(me.subject_type, me.credits);
var me struct {
SubjectType string `json:"subject_type"`
Credits int64 `json:"credits"`
}
err := call("GET", "/me", nil, &me)
String envelope = api("GET", "/me", null);
// data.subject_type, data.credits
me = api("GET", "/me")
puts "#{me["subject_type"]}: #{me["credits"]} credits"
$me = api("GET", "/me");
echo "{$me['subject_type']}: {$me['credits']} credits\n";
var me = await SkillSafe.ApiAsync(HttpMethod.Get, "/me");
Console.WriteLine($"{me.GetProperty("subject_type")}: {me.GetProperty("credits")} credits");
Step 3 — Estimate the cost
Send exactly the input you would send to /run; the response's
hold_credits is the worst-case cost. Nothing is charged and no job is created,
so estimating is free — useful when you are feeding in every landing page in the site
map and want a ceiling before spending credits.
| Input field | Type | Notes |
|---|---|---|
page | string, required | The page itself: raw HTML as served, or the plain copy pasted out of the CMS. Very long pastes may be clipped middle-out, with a [... clipped ...] marker showing where. |
page_type | string | landing | homepage | pricing | feature | blog | other — selects the page-type framework the audit applies. A landing page is judged on message match and a single CTA; a homepage on positioning for cold visitors; a pricing page on plan-comparison clarity. |
goal | string | signup | demo | purchase | subscribe | download | contact — the primary conversion you want. Every finding is weighed against this one action, so a page with three competing CTAs is judged by which of them serves the goal. |
traffic | string, optional | Where visitors come from, in your own words, e.g. "Google Ads on 'team scheduling software'". Used for message match: whether the headline answers the promise the ad or link made. |
notes | string, optional | Extra context: the current conversion rate, the audience, what you already tried, constraints on what can change. |
prescan_facts | object, optional | What a client-side prescan mechanically detected in the paste: {"issues": [], "elements": [], "signals": []}. Each entry is {id, label} — pattern-matched red flags (issue:weak-cta, issue:no-h1, issue:long-form), elements it located in the markup (el:headline, el:primary-cta, el:form) and page-level signals (sig:html, sig:testimonials, sig:pricing-table). Every id you send comes back in coverage_check. The web UI fills this from its own scan; API callers may omit the field or send the three empty arrays. |
retry_note | string, optional | Only set by the app's automatic reformat retry when a first reply was not valid JSON. Leave it out. |
cat > page.html <<'HTML'
<section class="hero">
<h1>Welcome to Flowdesk</h1>
<p>The all-in-one solution for modern teams.</p>
<form action="/signup">
<input name="email" placeholder="Work email">
<input name="company" placeholder="Company">
<input name="phone" placeholder="Phone">
<button type="submit">Submit</button>
</form>
</section>
HTML
jq -n --rawfile p page.html \
'{page: $p, page_type: "landing", goal: "signup",
traffic: "Google Ads on the phrase team scheduling software",
notes: "About 1.8% of visitors sign up; the audience is ops managers at 20-200 person companies.",
prescan_facts: {issues: [], elements: [], signals: []}}' > input.json
curl -s -X POST "$API/estimate" \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d @input.json | jq '.data.hold_credits'
PAGE = """<section class="hero">
<h1>Welcome to Flowdesk</h1>
<p>The all-in-one solution for modern teams.</p>
<form action="/signup">
<input name="email" placeholder="Work email">
<input name="company" placeholder="Company">
<input name="phone" placeholder="Phone">
<button type="submit">Submit</button>
</form>
</section>"""
payload = {
"page": PAGE,
"page_type": "landing",
"goal": "signup",
"traffic": "Google Ads on the phrase 'team scheduling software'",
"notes": "About 1.8% of visitors sign up; the audience is ops managers at 20-200 person companies.",
"prescan_facts": {"issues": [], "elements": [], "signals": []},
}
est = api("POST", "/estimate", payload)
print("worst case:", est.get("hold_credits", est.get("credits")), "credits")
const page = `<section class="hero">
<h1>Welcome to Flowdesk</h1>
<p>The all-in-one solution for modern teams.</p>
<form action="/signup">
<input name="email" placeholder="Work email">
<input name="company" placeholder="Company">
<input name="phone" placeholder="Phone">
<button type="submit">Submit</button>
</form>
</section>`;
const payload = {
page,
page_type: "landing",
goal: "signup",
traffic: "Google Ads on the phrase 'team scheduling software'",
notes: "About 1.8% of visitors sign up; the audience is ops managers at 20-200 person companies.",
prescan_facts: { issues: [], elements: [], signals: [] },
};
const est = await api("POST", "/estimate", payload);
console.log("worst case:", est.hold_credits ?? est.credits, "credits");
const page = `<section class="hero">
<h1>Welcome to Flowdesk</h1>
<p>The all-in-one solution for modern teams.</p>
<form action="/signup">
<input name="email" placeholder="Work email">
<input name="company" placeholder="Company">
<input name="phone" placeholder="Phone">
<button type="submit">Submit</button>
</form>
</section>`
payload := map[string]any{
"page": page,
"page_type": "landing",
"goal": "signup",
"traffic": "Google Ads on the phrase 'team scheduling software'",
"notes": "About 1.8% of visitors sign up; the audience is ops managers at 20-200 person companies.",
"prescan_facts": map[string]any{
"issues": []any{}, "elements": []any{}, "signals": []any{},
},
}
var est struct{ HoldCredits int64 `json:"hold_credits"` }
err := call("POST", "/estimate", payload, &est)
String page = """
<section class="hero">
<h1>Welcome to Flowdesk</h1>
<p>The all-in-one solution for modern teams.</p>
<form action="/signup">
<input name="email" placeholder="Work email">
<input name="company" placeholder="Company">
<input name="phone" placeholder="Phone">
<button type="submit">Submit</button>
</form>
</section>""";
String jsonPayload = """
{"page": %s, "page_type": "landing", "goal": "signup",
"traffic": "Google Ads on the phrase 'team scheduling software'",
"notes": "About 1.8%% of visitors sign up; the audience is ops managers.",
"prescan_facts": {"issues": [], "elements": [], "signals": []}}
""".formatted(toJsonString(page));
String envelope = api("POST", "/estimate", jsonPayload);
// worst-case cost is at data.hold_credits
PAGE_TEXT = <<~HTML
<section class="hero">
<h1>Welcome to Flowdesk</h1>
<p>The all-in-one solution for modern teams.</p>
<form action="/signup">
<input name="email" placeholder="Work email">
<input name="company" placeholder="Company">
<input name="phone" placeholder="Phone">
<button type="submit">Submit</button>
</form>
</section>
HTML
payload = { page: PAGE_TEXT, page_type: "landing", goal: "signup",
traffic: "Google Ads on the phrase 'team scheduling software'",
notes: "About 1.8% of visitors sign up; the audience is ops managers.",
prescan_facts: { issues: [], elements: [], signals: [] } }
est = api("POST", "/estimate", payload)
puts "worst case: #{est["hold_credits"] || est["credits"]} credits"
$page = <<<'HTML'
<section class="hero">
<h1>Welcome to Flowdesk</h1>
<p>The all-in-one solution for modern teams.</p>
<form action="/signup">
<input name="email" placeholder="Work email">
<input name="company" placeholder="Company">
<input name="phone" placeholder="Phone">
<button type="submit">Submit</button>
</form>
</section>
HTML;
$payload = [
"page" => $page,
"page_type" => "landing",
"goal" => "signup",
"traffic" => "Google Ads on the phrase 'team scheduling software'",
"notes" => "About 1.8% of visitors sign up; the audience is ops managers.",
"prescan_facts" => ["issues" => [], "elements" => [], "signals" => []],
];
$est = api("POST", "/estimate", $payload);
echo "worst case: " . ($est["hold_credits"] ?? $est["credits"]) . " credits\n";
var page = """
<section class="hero">
<h1>Welcome to Flowdesk</h1>
<p>The all-in-one solution for modern teams.</p>
<form action="/signup">
<input name="email" placeholder="Work email">
<input name="company" placeholder="Company">
<input name="phone" placeholder="Phone">
<button type="submit">Submit</button>
</form>
</section>
""";
var payload = new {
page,
page_type = "landing",
goal = "signup",
traffic = "Google Ads on the phrase 'team scheduling software'",
notes = "About 1.8% of visitors sign up; the audience is ops managers.",
prescan_facts = new {
issues = Array.Empty<object>(), elements = Array.Empty<object>(),
signals = Array.Empty<object>(),
},
};
var est = await SkillSafe.ApiAsync(HttpMethod.Post, "/estimate", payload);
Console.WriteLine($"worst case: {est.GetProperty("hold_credits")} credits");
prescan_facts is how you make the audit answer for things you already know
about. Send {"issues": [{"id": "issue:weak-cta", "label": "CTA copy is 'Submit'"}],
"elements": [{"id": "el:headline", "label": "Welcome to Flowdesk"}], "signals": [{"id":
"sig:html", "label": "raw HTML paste"}]} and every one of those ids comes back in
coverage_check — addressed, or explained away as a false positive.
Nothing you flag is silently dropped.
Step 4 — Run the audit and wait for the result
/run takes the same input as /estimate, places a credit hold and
returns a job_id. Poll /jobs/{job_id} every 1–2 seconds
until status is succeeded or failed (a run typically
takes 30–90 s, since the copy alternatives are written out in full). Always send an
Idempotency-Key header so a network retry can't start a second,
double-charged run. The audit is in output — usually nested as
output.output, and as a JSON string, so parse defensively. The samples
below print the audit name and verdict, the five score areas, the quick wins and the
high-impact bets, then the rewritten copy for each weak element.
JOB_ID=$(curl -s -X POST "$API/run" \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-H "Idempotency-Key: audit-$(date +%s)" \
-d @input.json | jq -r '.data.job_id')
while :; do
JOB=$(curl -s "$API/jobs/$JOB_ID" -H "Authorization: Bearer $TOKEN")
STATUS=$(echo "$JOB" | jq -r '.data.status')
[ "$STATUS" = "succeeded" ] || [ "$STATUS" = "failed" ] && break
sleep 2
done
# unwrap the audit once, then read it
echo "$JOB" | jq -r '.data.output.output' > audit.json
jq -r '
"\(.audit_name): \(.verdict)",
"",
"SCORES",
(.scores[] | " [\(.status)] \(.area) - \(.note)"),
"",
"QUICK WINS",
(.quick_wins[] | " \(.change) -- \(.impact)"),
"",
"HIGH IMPACT",
(.high_impact[] | " (\(.effort)) \(.title): \(.detail)"),
"",
"COPY",
(.copy_alternatives[] | " \(.element): \(.current)",
(.options[] | " -> \(.text) (\(.rationale))"))' audit.json
import time
job_id = api("POST", "/run", payload,
**{"Idempotency-Key": "audit-001"})["job_id"]
while True:
job = api("GET", f"/jobs/{job_id}")
if job["status"] in ("succeeded", "failed"):
break
time.sleep(1.5)
if job["status"] == "failed":
raise RuntimeError(job.get("error", "run failed"))
raw = job["output"]
if isinstance(raw, dict) and "output" in raw:
raw = raw["output"]
audit = json.loads(raw) if isinstance(raw, str) else raw
print(f'{audit["audit_name"]}: {audit["verdict"]}')
for area in audit["scores"]:
print(f' [{area["status"]:>4}] {area["area"]:<22} {area["note"]}')
for w in audit["quick_wins"]:
print(f' {w["change"]} -- {w["impact"]}')
for h in audit["high_impact"]:
print(f' ({h["effort"]}) {h["title"]}: {h["detail"]}')
for t in audit["test_ideas"]:
print(f' test: {t["hypothesis"]} -> {t["variant"]} [{t["metric"]}]')
for c in audit["copy_alternatives"]:
print(f' {c["element"]}: {c["current"]}')
for o in c["options"]:
print(f' -> {o["text"]} ({o["rationale"]})')
for c in audit["coverage_check"]:
print(f' {c["id"]}: {"ok" if c["addressed"] else "SET ASIDE"} - {c["note"]}')
const { job_id } = await api("POST", "/run", payload,
{ "Idempotency-Key": crypto.randomUUID() });
let job;
do {
await new Promise((r) => setTimeout(r, 1500));
job = await api("GET", `/jobs/${job_id}`);
} while (job.status !== "succeeded" && job.status !== "failed");
if (job.status === "failed") throw new Error(job.error ?? "run failed");
const raw = job.output?.output ?? job.output;
const audit = typeof raw === "string" ? JSON.parse(raw) : raw;
console.log(`${audit.audit_name}: ${audit.verdict}`);
for (const area of audit.scores) {
console.log(` [${area.status}] ${area.area}: ${area.note}`);
}
for (const w of audit.quick_wins) console.log(` ${w.change} -- ${w.impact}`);
for (const h of audit.high_impact) {
console.log(` (${h.effort}) ${h.title}: ${h.detail}`);
}
for (const t of audit.test_ideas) {
console.log(` test: ${t.hypothesis} -> ${t.variant} [${t.metric}]`);
}
for (const c of audit.copy_alternatives) {
console.log(` ${c.element}: ${c.current}`);
for (const o of c.options) console.log(` -> ${o.text} (${o.rationale})`);
}
for (const c of audit.coverage_check) {
console.log(` ${c.id}: ${c.addressed ? "ok" : "SET ASIDE"} - ${c.note}`);
}
var started struct{ JobID string `json:"job_id"` }
if err := call("POST", "/run", payload, &started); err != nil {
log.Fatal(err)
}
var job struct {
Status string `json:"status"`
Error string `json:"error"`
Output json.RawMessage `json:"output"`
}
for {
if err := call("GET", "/jobs/"+started.JobID, nil, &job); err != nil {
log.Fatal(err)
}
if job.Status == "succeeded" || job.Status == "failed" {
break
}
time.Sleep(1500 * time.Millisecond)
}
// job.Output is {"output": "<json string>"} — unwrap, unquote, then unmarshal:
type Audit struct {
AuditName string `json:"audit_name"`
Verdict string `json:"verdict"`
Scores []struct {
Area, Status, Note string
} `json:"scores"`
QuickWins []struct {
Change, Impact string
} `json:"quick_wins"`
HighImpact []struct {
Title, Detail, Effort string
} `json:"high_impact"`
TestIdeas []struct {
Hypothesis, Variant, Metric string
} `json:"test_ideas"`
CopyAlternatives []struct {
Element, Current string
Options []struct {
Text, Rationale string
} `json:"options"`
} `json:"copy_alternatives"`
}
var wrapper struct{ Output string `json:"output"` }
json.Unmarshal(job.Output, &wrapper)
var audit Audit
json.Unmarshal([]byte(wrapper.Output), &audit)
fmt.Printf("%s: %s\n", audit.AuditName, audit.Verdict)
for _, a := range audit.Scores {
fmt.Printf(" [%s] %s: %s\n", a.Status, a.Area, a.Note)
}
for _, w := range audit.QuickWins {
fmt.Printf(" %s -- %s\n", w.Change, w.Impact)
}
for _, h := range audit.HighImpact {
fmt.Printf(" (%s) %s: %s\n", h.Effort, h.Title, h.Detail)
}
for _, c := range audit.CopyAlternatives {
fmt.Printf(" %s: %s\n", c.Element, c.Current)
for _, o := range c.Options {
fmt.Printf(" -> %s (%s)\n", o.Text, o.Rationale)
}
}
String envelope = api("POST", "/run", jsonPayload);
String jobId = /* data.job_id via your JSON library */;
while (true) {
String job = api("GET", "/jobs/" + jobId, null);
String status = /* data.status */;
if (status.equals("succeeded") || status.equals("failed")) break;
Thread.sleep(1500);
}
// The audit is at data.output.output as a JSON string — parse it again, then read
// audit_name, verdict, overview, scores[] (five areas with area/status/note),
// quick_wins[] (change/impact), high_impact[] (title/detail/effort),
// test_ideas[] (hypothesis/variant/metric),
// copy_alternatives[] (element/current/options[] with text/rationale),
// coverage_check[] (id/addressed/note), next_steps[] and summary.
// Feed copy_alternatives straight into your CMS diff:
// for (var opt : element.options()) System.out.println(opt.text());
started = api("POST", "/run", payload)
job = nil
loop do
job = api("GET", "/jobs/#{started["job_id"]}")
break if %w[succeeded failed].include?(job["status"])
sleep 1.5
end
raise (job["error"] || "run failed") if job["status"] == "failed"
raw = job["output"].is_a?(Hash) ? job["output"].fetch("output", job["output"]) : job["output"]
audit = raw.is_a?(String) ? JSON.parse(raw) : raw
puts "#{audit["audit_name"]}: #{audit["verdict"]}"
audit["scores"].each { |a| puts " [#{a["status"]}] #{a["area"]}: #{a["note"]}" }
audit["quick_wins"].each { |w| puts " #{w["change"]} -- #{w["impact"]}" }
audit["high_impact"].each { |h| puts " (#{h["effort"]}) #{h["title"]}: #{h["detail"]}" }
audit["test_ideas"].each { |t| puts " test: #{t["hypothesis"]} -> #{t["variant"]}" }
audit["copy_alternatives"].each do |c|
puts " #{c["element"]}: #{c["current"]}"
c["options"].each { |o| puts " -> #{o["text"]} (#{o["rationale"]})" }
end
audit["coverage_check"].each { |c| puts " #{c["id"]}: #{c["addressed"] ? "ok" : "SET ASIDE"}" }
$started = api("POST", "/run", $payload);
do {
sleep(2);
$job = api("GET", "/jobs/" . $started["job_id"]);
} while (!in_array($job["status"], ["succeeded", "failed"]));
if ($job["status"] === "failed") {
throw new Exception($job["error"] ?? "run failed");
}
$raw = is_array($job["output"]) ? ($job["output"]["output"] ?? $job["output"]) : $job["output"];
$audit = is_string($raw) ? json_decode($raw, true) : $raw;
echo "{$audit['audit_name']}: {$audit['verdict']}\n";
foreach ($audit["scores"] as $a) {
echo " [{$a['status']}] {$a['area']}: {$a['note']}\n";
}
foreach ($audit["quick_wins"] as $w) {
echo " {$w['change']} -- {$w['impact']}\n";
}
foreach ($audit["high_impact"] as $h) {
echo " ({$h['effort']}) {$h['title']}: {$h['detail']}\n";
}
foreach ($audit["copy_alternatives"] as $c) {
echo " {$c['element']}: {$c['current']}\n";
foreach ($c["options"] as $o) { echo " -> {$o['text']} ({$o['rationale']})\n"; }
}
foreach ($audit["coverage_check"] as $c) {
echo " {$c['id']}: " . ($c["addressed"] ? "ok" : "SET ASIDE") . "\n";
}
var started = await SkillSafe.ApiAsync(HttpMethod.Post, "/run", payload);
var jobId = started.GetProperty("job_id").GetString();
JsonElement job;
while (true)
{
job = await SkillSafe.ApiAsync(HttpMethod.Get, $"/jobs/{jobId}");
var status = job.GetProperty("status").GetString();
if (status is "succeeded" or "failed") break;
await Task.Delay(1500);
}
var rawText = job.GetProperty("output").GetProperty("output").GetString();
using var doc = JsonDocument.Parse(rawText!);
var audit = doc.RootElement;
Console.WriteLine($"{audit.GetProperty("audit_name")}: {audit.GetProperty("verdict")}");
foreach (var a in audit.GetProperty("scores").EnumerateArray())
{
Console.WriteLine($" [{a.GetProperty("status")}] {a.GetProperty("area")}: {a.GetProperty("note")}");
}
foreach (var w in audit.GetProperty("quick_wins").EnumerateArray())
{
Console.WriteLine($" {w.GetProperty("change")} -- {w.GetProperty("impact")}");
}
foreach (var h in audit.GetProperty("high_impact").EnumerateArray())
{
Console.WriteLine($" ({h.GetProperty("effort")}) {h.GetProperty("title")}: " +
$"{h.GetProperty("detail")}");
}
foreach (var c in audit.GetProperty("copy_alternatives").EnumerateArray())
{
Console.WriteLine($" {c.GetProperty("element")}: {c.GetProperty("current")}");
foreach (var o in c.GetProperty("options").EnumerateArray())
Console.WriteLine($" -> {o.GetProperty("text")} ({o.GetProperty("rationale")})");
}
The model is asked for one JSON object and nothing else, but a stray code fence or preamble
is always possible. Strip a leading ```json fence, take the text between the
first { and the last }, and only then parse — that is what
the app does before it falls back to a retry_note reformat run.
The audit object — output schema
One JSON object, always the same shape. Every array is present (quick_wins,
high_impact and copy_alternatives are empty only if genuinely
nothing qualifies — a genuinely strong page gets empty lists rather than padded
findings); scores always has exactly the five areas. If the paste was too thin
to audit responsibly, you still get this object: what is there gets judged, the
verdict says the paste is thin, and what you would need to show lands in
next_steps. If the paste is not a marketing page at all, you still get the
object — the verdict says what arrived, every score area sits at risk,
and next_steps says what to paste instead.
| Field | Type | Meaning |
|---|---|---|
audit_name | string | A short name for the audit, taken from the page's own product naming and the goal, e.g. "Flowdesk landing page — signup goal". |
verdict | string | One or two sentences: the honest overall posture and the single change worth making first. |
overview | string | Two to four short paragraphs separated by blank lines: what this page is trying to do, what works, and where conversions are leaking — all grounded in the paste. |
scores | array of 5 | {area, status, note} — the five areas listed below, each exactly once. status is good (nothing material), risk (works, with caveats) or bad (something is actively costing conversions). Each note references something concrete in the pasted page; an area the paste gives no evidence for is called out as such, never an invented risk. |
quick_wins | array | {change, impact} — only changes shippable in under a day, ordered by impact-per-effort. Each change names the page's own element or copy; impact says what conversion effect it buys and why. Empty array if nothing qualifies. |
high_impact | array | {title, detail, effort} — the bigger bets. detail is what to do and why, grounded in the paste; effort is an honest low | medium | high. |
test_ideas | array | {hypothesis, variant, metric} — things to A/B test rather than assume. variant is the concrete B to build, metric is the number that decides it. These do not duplicate the quick wins. |
copy_alternatives | array | {element, current, options} — at most four weak key elements (headline, primary CTA, subhead…). current is the verbatim copy from the page; options holds 2–3 {text, rationale} rewrites, each usable as-is in the page's own voice. Empty array when every key element is already strong. |
coverage_check | array | {id, addressed, note} — one entry per distinct prescan_facts id you sent (issue:weak-cta, el:headline, …), saying where the audit covers it or why it was set aside (a pattern hit can be a false positive; the note says so). Nothing you flagged is silently dropped. |
next_steps | string[] | Ordered and concrete: implement, then measure, then test — ship the CTA copy, instrument the form, run the headline test for two weeks, and so on. |
summary | string | 2–3 sentences a founder could paste into a task tracker. |
The five score areas, in order, spelled exactly like this:
| area | What its note covers |
|---|---|
Value proposition | Whether a cold visitor can tell what this is and why they should care within five seconds; benefit-focused versus feature-focused; customer language versus company jargon. |
Headline & hero | Whether the headline carries the value proposition and is specific enough to mean something; message match against the stated traffic source; the subhead and hero copy that support it. |
CTA & hierarchy | One clear primary action, visible without scrolling; button copy that communicates value (Start free trial) rather than mere action (Submit); primary/secondary structure and repetition at decision points; scannability of the heading order. |
Trust & social proof | Logos, attributed testimonials, numbers, reviews and guarantees — present, specific, and placed near the CTAs; objection handling through FAQ, guarantee or comparison content. |
Friction | Form length and required fields that should not be required, unclear next steps, navigation leaks on a landing page, anything between the visitor and the stated goal. |
A small, realistic result for the Flowdesk paste above, trimmed for length:
{
"audit_name": "Flowdesk landing page — signup goal",
"verdict": "The hero says nothing a competitor's hero could not say and the form asks for
three fields to reach a Submit button; fix the CTA and the field count first.",
"overview": "A short paid-traffic landing page whose single job is a free signup. The form
is right in the hero, which is the correct instinct, and the flow is short
enough that nothing distracts from it.
What leaks: the headline is a greeting rather than a claim, the subhead is
category filler, and the visitor arriving from a 'team scheduling software'
ad never sees the word scheduling. Three required fields and a 'Submit'
button add friction at exactly the wrong moment.",
"scores": [
{ "area": "Value proposition", "status": "bad",
"note": "'The all-in-one solution for modern teams' names no outcome and no audience." },
{ "area": "Headline & hero", "status": "bad",
"note": "'Welcome to Flowdesk' is a greeting, and it never matches the scheduling ad." },
{ "area": "CTA & hierarchy", "status": "risk",
"note": "One primary CTA and no competing links, but its copy is the generic 'Submit'." },
{ "area": "Trust & social proof", "status": "bad",
"note": "No logos, testimonials, numbers or guarantee appear anywhere in the paste." },
{ "area": "Friction", "status": "risk",
"note": "Company and phone are asked for before the product has been demonstrated." }
],
"quick_wins": [
{ "change": "Replace the 'Submit' button copy with 'Start scheduling free'.",
"impact": "Value-carrying CTA copy typically lifts form completion; it also restates
the offer at the moment of decision." },
{ "change": "Drop the phone field and make company optional.",
"impact": "Cuts required fields from three to one; phone is the single biggest
deterrent on a free signup form." }
],
"high_impact": [
{ "title": "Rewrite the hero for message match with the ad",
"detail": "The ad promises team scheduling software; the hero says 'Welcome to
Flowdesk'. Lead with the scheduling outcome so the promise carries through.",
"effort": "low" },
{ "title": "Add trust to the form area",
"detail": "Nothing in the paste tells a visitor anyone else uses this. Put two
attributed customer quotes or a customer count directly under the form.",
"effort": "medium" }
],
"test_ideas": [
{ "hypothesis": "The generic headline, not the form, is what loses paid traffic.",
"variant": "Outcome headline: 'Fill every shift in minutes, not spreadsheets.'",
"metric": "Signup rate for the Google Ads source over two weeks." }
],
"copy_alternatives": [
{ "element": "Headline", "current": "Welcome to Flowdesk",
"options": [
{ "text": "Fill every shift in minutes, not spreadsheets.",
"rationale": "States the outcome and names the pain the ad audience already has." },
{ "text": "Team scheduling that stops the group-chat shuffle.",
"rationale": "Matches the ad phrase verbatim and contrasts with today's workaround." }
] },
{ "element": "Primary CTA", "current": "Submit",
"options": [
{ "text": "Start scheduling free",
"rationale": "Names the action, the product value and the price in three words." },
{ "text": "Build my first schedule",
"rationale": "First person and concrete; describes what happens next, not a form post." }
] }
],
"coverage_check": [
{ "id": "issue:weak-cta", "addressed": true,
"note": "Confirmed — 'Submit' is a quick win and has two copy alternatives." },
{ "id": "el:headline", "addressed": true,
"note": "The headline is the first copy alternative and drives the test idea." }
],
"next_steps": [
"Ship the CTA copy and the field removal today — neither needs design.",
"Instrument form starts and completions separately so friction shows up as a number.",
"Run the headline test on paid traffic only, for two weeks or 300 conversions."
],
"summary": "Message match and CTA copy are the two cheap fixes. …"
}
The copy alternatives are a starting point, not a publish: they are written to be usable as-is and grounded in what you pasted, but they are AI-generated and the audit cannot see your rendered layout, images or load times. Read them in your own voice, check the claims are true of your product, and measure before and after.
Step 5 — Stream the audit as it is written
/run-stream takes exactly the same body as /run but answers with
server-sent events, so you can show progress instead of a spinner — useful here
because the copy alternatives make for a long reply. This app's own progress panel is this
endpoint. Events are separated by a blank line; each has an event: line and a
data: line carrying JSON.
| Event | Payload | Meaning |
|---|---|---|
job | {job_id, status} | Sent once, when the job is accepted — show "starting". |
delta | {text} | A chunk of the reply, in order. Append it; the accumulated length is your only progress signal (the total is not known in advance). |
done | {job_id, status, charged_credits, output} | The final, authoritative result — read the audit from output.output rather than trusting concatenated deltas, and the settled price from charged_credits. |
error | {code, message} | Replaces done when the run fails. |
# -N disables buffering so events print as they arrive
curl -N -s -X POST "$API/run-stream" \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-H "Idempotency-Key: audit-$(date +%s)" \
-d @input.json
# event: job
# data: {"job_id":"job_...","status":"running"}
#
# event: delta
# data: {"text":"{\"audit_name\":\"Flowdesk"}
# ...
# event: done
# data: {"job_id":"job_...","status":"succeeded","charged_credits":540,"output":{"output":"{...}"}}
import json, requests
result = None
with requests.post(
API + "/run-stream",
headers={"Authorization": f"Bearer {TOKEN}",
"Idempotency-Key": "audit-001"},
json=payload,
stream=True,
) as r:
r.raise_for_status()
event = None
for line in r.iter_lines(decode_unicode=True):
if not line:
continue
if line.startswith("event:"):
event = line[len("event:"):].strip()
elif line.startswith("data:"):
data = json.loads(line[len("data:"):].strip())
if event == "delta":
print(".", end="", flush=True) # live progress
elif event == "done":
result = data
elif event == "error":
raise RuntimeError(data.get("message", "run failed"))
audit = json.loads(result["output"]["output"]) # authoritative
print("charged:", result["charged_credits"], "-", audit["audit_name"])
for area in audit["scores"]:
print(f' [{area["status"]}] {area["area"]}')
for c in audit["copy_alternatives"]:
print(f' {c["element"]}: {c["options"][0]["text"]}')
const res = await fetch(API + "/run-stream", {
method: "POST",
headers: {
Authorization: `Bearer ${TOKEN}`,
"Content-Type": "application/json",
"Idempotency-Key": crypto.randomUUID(),
},
body: JSON.stringify(payload),
});
const reader = res.body.getReader();
const decoder = new TextDecoder();
let buf = "", done = null, deltas = 0;
for (;;) {
const chunk = await reader.read();
if (chunk.done) break;
buf += decoder.decode(chunk.value, { stream: true });
const frames = buf.split("\n\n");
buf = frames.pop();
for (const frame of frames) {
const name = /^event:\s*(.+)$/m.exec(frame)?.[1];
const body = /^data:\s*(.+)$/m.exec(frame)?.[1];
if (!name || !body) continue;
const data = JSON.parse(body);
if (name === "delta") deltas += 1; // live progress
if (name === "done") done = data;
if (name === "error") throw new Error(data.message ?? "run failed");
}
}
const audit = JSON.parse(done.output.output);
console.log(`${deltas} chunks, ${done.charged_credits} credits - ${audit.audit_name}`);
for (const area of audit.scores) console.log(` [${area.status}] ${area.area}`);
for (const c of audit.copy_alternatives) {
console.log(` ${c.element}: ${c.options[0].text}`);
}
body, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", API+"/run-stream", bytes.NewReader(body))
req.Header.Set("Authorization", "Bearer "+token)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Idempotency-Key", "audit-001")
res, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer res.Body.Close()
var event string
var final map[string]any
sc := bufio.NewScanner(res.Body)
sc.Buffer(make([]byte, 0, 64*1024), 4*1024*1024)
for sc.Scan() {
line := sc.Text()
switch {
case strings.HasPrefix(line, "event:"):
event = strings.TrimSpace(strings.TrimPrefix(line, "event:"))
case strings.HasPrefix(line, "data:"):
var data map[string]any
json.Unmarshal([]byte(strings.TrimPrefix(line, "data:")), &data)
switch event {
case "delta":
fmt.Print(".") // live progress
case "done":
final = data
case "error":
log.Fatal(data["message"])
}
}
}
// final["output"].(map[string]any)["output"].(string) is the audit JSON —
// unmarshal it into the Audit struct from step 4, then print audit.CopyAlternatives.
// Java 17+ — read the stream line by line instead of buffering the body.
var req = HttpRequest.newBuilder(URI.create(API + "/run-stream"))
.header("Authorization", "Bearer " + TOKEN)
.header("Content-Type", "application/json")
.header("Idempotency-Key", "audit-001")
.POST(HttpRequest.BodyPublishers.ofString(jsonPayload))
.build();
var res = HTTP.send(req, HttpResponse.BodyHandlers.ofLines());
String event = null, done = null;
for (String line : (Iterable<String>) res.body()::iterator) {
if (line.startsWith("event:")) {
event = line.substring(6).trim();
} else if (line.startsWith("data:")) {
String data = line.substring(5).trim();
if ("delta".equals(event)) System.out.print("."); // live progress
else if ("done".equals(event)) done = data;
else if ("error".equals(event)) throw new RuntimeException(data);
}
}
// parse `done`, then parse data.output.output again — it is a JSON string holding
// audit_name, scores[], quick_wins[], high_impact[], test_ideas[],
// copy_alternatives[] and the rest.
require "net/http"
require "json"
uri = URI(API + "/run-stream")
req = Net::HTTP::Post.new(uri)
req["Authorization"] = "Bearer #{TOKEN}"
req["Content-Type"] = "application/json"
req["Idempotency-Key"] = "audit-001"
req.body = payload.to_json
event = nil
done = nil
Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
http.request(req) do |res|
res.read_body do |chunk|
chunk.each_line do |line|
line = line.strip
if line.start_with?("event:")
event = line.delete_prefix("event:").strip
elsif line.start_with?("data:")
data = JSON.parse(line.delete_prefix("data:").strip)
case event
when "delta" then print "." # live progress
when "done" then done = data
when "error" then raise (data["message"] || "run failed")
end
end
end
end
end
end
audit = JSON.parse(done["output"]["output"])
puts "\n#{done["charged_credits"]} credits - #{audit["audit_name"]}"
audit["scores"].each { |a| puts " [#{a["status"]}] #{a["area"]}" }
audit["copy_alternatives"].each { |c| puts " #{c["element"]}: #{c["options"][0]["text"]}" }
$event = null;
$done = null;
$ch = curl_init(API . "/run-stream");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer $TOKEN",
"Content-Type: application/json",
"Idempotency-Key: audit-001",
],
CURLOPT_POSTFIELDS => json_encode($payload),
CURLOPT_WRITEFUNCTION => function ($ch, $chunk) use (&$event, &$done) {
foreach (explode("\n", $chunk) as $line) {
$line = trim($line);
if (str_starts_with($line, "event:")) {
$event = trim(substr($line, 6));
} elseif (str_starts_with($line, "data:")) {
$data = json_decode(trim(substr($line, 5)), true);
if ($event === "delta") { echo "."; } // live progress
elseif ($event === "done") { $done = $data; }
elseif ($event === "error") { throw new Exception($data["message"] ?? "run failed"); }
}
}
return strlen($chunk);
},
]);
curl_exec($ch);
curl_close($ch);
$audit = json_decode($done["output"]["output"], true);
echo "\n{$done['charged_credits']} credits - {$audit['audit_name']}\n";
foreach ($audit["scores"] as $a) { echo " [{$a['status']}] {$a['area']}\n"; }
foreach ($audit["copy_alternatives"] as $c) {
echo " {$c['element']}: {$c['options'][0]['text']}\n";
}
var req = new HttpRequestMessage(HttpMethod.Post, Api + "/run-stream") {
Content = JsonContent.Create(payload),
};
req.Headers.Add("Idempotency-Key", "audit-001");
using var res = await Http.SendAsync(req, HttpCompletionOption.ResponseHeadersRead);
using var reader = new StreamReader(await res.Content.ReadAsStreamAsync());
string? evt = null, done = null;
while (await reader.ReadLineAsync() is { } line)
{
if (line.StartsWith("event:")) evt = line[6..].Trim();
else if (line.StartsWith("data:"))
{
var data = line[5..].Trim();
if (evt == "delta") Console.Write("."); // live progress
else if (evt == "done") done = data;
else if (evt == "error") throw new Exception(data);
}
}
using var final = JsonDocument.Parse(done!);
var text = final.RootElement.GetProperty("output").GetProperty("output").GetString();
using var auditDoc = JsonDocument.Parse(text!);
var audit = auditDoc.RootElement;
Console.WriteLine(audit.GetProperty("audit_name"));
foreach (var a in audit.GetProperty("scores").EnumerateArray())
Console.WriteLine($" [{a.GetProperty("status")}] {a.GetProperty("area")}");
foreach (var c in audit.GetProperty("copy_alternatives").EnumerateArray())
Console.WriteLine($" {c.GetProperty("element")}: " +
$"{c.GetProperty("options")[0].GetProperty("text")}");
In a browser, the native EventSource only speaks GET, and this endpoint is a
POST — read the fetch response body incrementally, as the JavaScript
sample above does. On an idempotent replay the server may answer with a plain JSON
envelope instead of an event stream; check the Content-Type before you start
parsing frames.