← Testimonial Widget
Your token

Testimonial Widget API

Reading the reviews, checking them and writing the testimonials section as HTML and CSS all run free in the browser and need no API. The API is for the one metered step: send the reviews and get back which ones to show, in what order, each cut to its strongest words.

Base URL: https://api.skillsafe.ai/v1/app-api. Every response is {"data": ...} or {"error": {"code", "message"}}; read error.code and error.message rather than the HTTP status alone.

Input fields

The app has one job, so there is no task field. Send these four fields; every value is a string.

FieldTypeMeaning
reviewsstringJSON text: a list of {id, quote, name, role, words, rating} in the order you want them read. id is your name for the review ("t1", "t2"...). name and role may be empty; rating (0-5) is optional. The page sends up to 60 reviews, each up to 1,500 characters. Required.
limitstringHow many reviews to pick, "1" to "12".
topicstringOptional: what you sell or who the page is for, at most 200 characters. May be empty.
factsstringJSON text: reviews_total, reviews_sent, with_rating, average_rating, with_number (ids whose quote has a number), flags (long, generic, no_name, low_rating id lists), layout. Background only; may be "{}".

The reply

job.output.output is JSON text:

{"picks":[{"id","pull","highlight","why"}],"skip":[{"id","why"}],"heading","summary"}

picks are in display order, strongest first; why is one of result, specific, objection, audience, credible. pull is an excerpt of that review's own words with ... where words were left out; highlight is a phrase from the excerpt to set in bold. skip lists the rest with why one of generic, duplicate, off_topic, unclear, weaker.

Check every excerpt before you publish it. The page rebuilds each pull from the review's characters and refuses one that contains a word not in the review or puts pieces in a different order; it then shows the whole review. It also ignores unknown or repeated ids and picks beyond limit. If the balance ran low, truncated is true and the object may stop early; the picks that arrived whole are kept.

Worked example

Five quotes about accounting software, pick 4

Input (input.json):

{
  "reviews": "[{\"id\":\"t1\",\"quote\":\"Honestly, I put off switching for a year because I assumed it would be painful. We cut our month-end close from 9 days to 4. The reconciliation screen alone saves my team a full day, and our auditors stopped asking for the same spreadsheets twice.\",\"name\":\"Dana Whitfield\",\"role\":\"Controller, Northpine Logistics\",\"words\":45},{\"id\":\"t2\",\"quote\":\"I was worried about moving 12 years of invoices over. Support did the import with us on a call and nothing went missing.\",\"name\":\"Marcus Hale\",\"role\":\"Office Manager, Hale & Sons Plumbing\",\"words\":23},{\"id\":\"t3\",\"quote\":\"Easy to use.\",\"name\":\"Ellie R.\",\"role\":\"\",\"words\":3},{\"id\":\"t4\",\"quote\":\"Approvals used to live in email threads and someone was always chasing a receipt. Now our 40 field managers approve expenses from their phones, usually the same day. I'd recommend it to any care provider with staff on the road.\",\"name\":\"Ravi Menon\",\"role\":\"Finance Director, Brightside Care\",\"words\":40},{\"id\":\"t5\",\"quote\":\"Setup took an afternoon, not the three weeks our last tool needed.\",\"name\":\"Sofia Marquez\",\"role\":\"Founder, Tidewater Studio\",\"words\":12}]",
  "limit": "4",
  "topic": "accounting software for small businesses",
  "facts": "{\"reviews_total\":5,\"reviews_sent\":5,\"with_rating\":0,\"average_rating\":null,\"with_number\":[\"t1\",\"t2\",\"t4\"],\"flags\":{\"generic\":[\"t3\"]},\"layout\":\"spotlight\"}"
}

Reply:

{
  "picks": [
    {
      "id": "t1",
      "pull": "We cut our month-end close from 9 days to 4. The reconciliation screen alone saves my team a full day, and our auditors stopped asking for the same spreadsheets twice.",
      "highlight": "from 9 days to 4",
      "why": "result"
    },
    {
      "id": "t4",
      "pull": "Approvals used to live in email threads and someone was always chasing a receipt. Now our 40 field managers approve expenses from their phones, usually the same day.",
      "highlight": "usually the same day",
      "why": "result"
    },
    {
      "id": "t2",
      "pull": "I was worried about moving 12 years of invoices over. Support did the import with us on a call and nothing went missing.",
      "highlight": "nothing went missing",
      "why": "objection"
    },
    {
      "id": "t5",
      "pull": "Setup took an afternoon, not the three weeks our last tool needed.",
      "highlight": "Setup took an afternoon",
      "why": "objection"
    }
  ],
  "skip": [
    {
      "id": "t3",
      "why": "generic"
    }
  ],
  "heading": "Faster closes, painless switching, approvals on the go",
  "summary": "Leads with the faster month-end close, then same-day approvals, a safe data import and quick setup."
}

On the page, the picks replace the full list in the section, in this order, with the bold phrase marked; untick “Show only the AI picks” to show every review again.

Errors

HTTPWhat to do
401The token is missing, expired or a guest token on a run. Get a personal token on the token page.
402The balance is below what the run reserves. Top up at skillsafe.ai/account/billing.
400The body is not a JSON object of the fields above.
429Wait and retry with the same Idempotency-Key.

Step 1 — a tiny client helper

One function that sends JSON and unwraps the {data, error} envelope.

BASE="https://api.skillsafe.ai/v1/app-api"
TOKEN="paste-your-token-here"   # from https://testimonial-widget.skillsafe.ai/tokens.html
api() { # api METHOD PATH [JSON-BODY]
  curl -s -X "$1" "$BASE$2" -H "Content-Type: application/json" \
    ${TOKEN:+-H "Authorization: Bearer $TOKEN"} ${3:+--data "$3"}
}

Step 2 — a token

A guest token is enough for /me and /estimate. A run is metered, so it needs your personal token: sign in on the token page and copy it.

# a guest token (enough for /me and /estimate); a run needs your personal token from /tokens.html
TOKEN=$(curl -s -X POST "$BASE/guest" -H "Content-Type: application/json" -d '{"slug":"testimonial-widget"}' | jq -r '.data.token')

Step 3 — who am I, and my balance

subject_type is guest or user; credits is the balance (1 credit = $0.0001).

api GET /me | jq '.data | {subject_type, credits}' 

Step 4 — price a run for free

/estimate charges nothing and starts no job. hold_credits is the amount reserved while a run is in flight, not the price; the run is charged what it uses.

# input.json: the run input object - {"reviews": "[...]", "limit": "6", "topic": "", "facts": "{...}"}
api POST /estimate "$(cat input.json)" | jq '.data | {hold_credits, min_credits, model, model_alias, markup_bps, warnings}' 

Step 5 — run it and wait for the job

Send an Idempotency-Key derived from the input: a retry with the same key is never billed twice.

KEY="testimonial-widget:pick:$(shasum -a 256 input.json | cut -c1-16):a1"
JOB=$(curl -s -X POST "$BASE/run" -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN" \
  -H "Idempotency-Key: $KEY" --data @input.json | jq -r '.data.job_id')
while :; do
  J=$(api GET "/jobs/$JOB"); S=$(echo "$J" | jq -r '.data.status')
  case "$S" in succeeded|failed|cancelled) break;; esac; sleep 2
done
echo "$J" | jq -r '.data.output.output' > reply.json   # one JSON object: picks, skip, heading, summary
echo "$J" | jq '.data | {charged_credits, truncated}' 

Step 6 — or stream it

/run-stream sends Server-Sent Events while the job runs and the finished job at the end.

# Server-Sent Events: tick/delta events while the job runs, then a final event with the job
curl -N -s -X POST "$BASE/run-stream" -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN" \
  -H "Idempotency-Key: testimonial-widget:pick:$(shasum -a 256 input.json | cut -c1-16):a1" --data @input.json