← Loading Spinner Generator
Your token

Loading Spinner Generator API

The loaders, the preview, the check against the timing rules and every copy and download run free in the browser and need no API. The API is for the one metered step: send the current loader's settings and a description of what is loading, and get back, as JSON, advice for that screen: keep or change, one loader from the page's list of eleven, its cycle time, stagger, easing, size, stroke, a screen-reader label, where it goes, the animation principles at work and what to avoid. The page builds this input for you, checks the reply against the rules and draws the loader.

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.

The task field

This app has one task. Always send "task": "advise".

taskWhat it doesReply
adviseReads one loader's settings, the page's check and your description of what is loading, and returns keep or change, one loader id (ring, arc, dual, segments, orbit, bounce, fade, bars, ripple, skeleton, progress), its indicator type, timing, size, stroke, a screen-reader label, placement, principles and things to avoid.One JSON object

Input fields

Every field is a string; page_check holds JSON text. task, kind and description are required.

FieldMeaning
task"advise"
kindThe current loader: ring, arc, dual, segments, orbit, bounce, fade, bars, ripple, skeleton or progress.
color, backgroundHex colours, e.g. "#4f46e5". The advice keeps them.
size_pxSize in px (the width for skeleton and progress).
thickness_pxStroke in px (bar height for progress); empty for loaders without a stroke.
duration_msOne cycle (one turn, bounce, pulse or shimmer), or one update for progress.
stagger_msOffset between parts for bounce, fade and bars; empty otherwise.
easinglinear, ease-in-out, ease or ease-out.
labelWhat screen readers hear now.
page_check{family, rule, usual_range_ms, stagger_range_ms, contrast, verdict, notes}, from the page.
descriptionWhat is loading, how long it takes, whether progress is known, where it appears and the brand's character (at most 1,200 characters).
clipped_noteEmpty, or a sentence saying the description was cut.

The reply

job.output.output is text holding one JSON object: verdict (keep or change), indicator (spinner, dots, pulse, skeleton or progress), kind, summary, timing ({duration_ms, stagger_ms, easing, why}), size_px, thickness_px, label, placement, principles ([{name, how}], names from the 12 principles of animation) and avoid. Before using it, check that kind is one of the eleven ids, that indicator matches it, and that the timing is inside the rule for that kind (spinner 800-1200 ms, bounce 500-800 ms, pulse 1000-2000 ms, skeleton 1500-2500 ms, progress updates 200 ms, stagger 100-150 ms), as the page does. If the balance ran low, truncated is true and the object may stop early; the page keeps every part that arrived whole.

Worked example

Input (input.json), from the page's "Indigo ring" example:

{
  "task": "advise",
  "kind": "ring",
  "color": "#4f46e5",
  "background": "#ffffff",
  "size_px": "40",
  "thickness_px": "4",
  "duration_ms": "1000",
  "stagger_ms": "",
  "easing": "linear",
  "label": "Saving your changes",
  "page_check": "{\"family\":\"rotation\",\"rule\":\"Spinner full rotation\",\"usual_range_ms\":[800,1200],\"stagger_range_ms\":null,\"contrast\":6.29,\"verdict\":\"good\",\"notes\":[\"good timing: Spinner full rotation 1000 ms is inside the skill's 800-1200 ms.\",\"good easing: Linear turning reads as continuous motion, as the skill recommends for a spinner.\",\"good contrast: Colour #4f46e5 on #ffffff is 6.29:1, above the 3:1 that interface parts need.\",\"good label: Screen readers hear \\\"Saving your changes\\\" (role=status).\"]}",
  "description": "Save button in a project-management web app. After pressing Save the button shows a small loader while the request runs, usually under a second, sometimes 3 seconds. Calm, professional brand.",
  "clipped_note": ""
}

Reply:

{"verdict":"keep","indicator":"spinner","kind":"ring","summary":"Keep the ring: a calm, professional save button needs a subtle spinner, and the 1000 ms linear turn already fits. Shrink it to 20 px so it sits inside the button instead of swelling it, with a 2 px stroke that stays crisp at that size.","timing":{"duration_ms":1000,"stagger_ms":null,"easing":"linear","why":"One steady turn per second reads as continuous work for a save that usually ends within a second and sometimes runs to three."},"size_px":20,"thickness_px":2,"label":"Saving your changes","placement":"Inside the Save button, in place of or beside its text, with the button disabled so it cannot be pressed twice; the rest of the project page stays usable while it runs.","principles":[{"name":"Timing","how":"A one-second rotation is quick enough to feel responsive on short saves without looking frantic on the slower three-second ones."},{"name":"Exaggeration","how":"A plain ring with no bounce keeps the motion subtle, matching the calm, professional brand."},{"name":"Solid Drawing","how":"A 2 px stroke on a 20 px ring stays well under a quarter of the size, so the circle stays open and even."}],"avoid":["Do not keep the 40 px size; it is too big for a button","Do not block the whole page with an overlay for a button save","Do not add bounce or elastic motion to this calm brand"]}

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, or a required field is missing.
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://loading-spinner-generator.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":"loading-spinner-generator"}' | 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 - {"task": "advise", "kind": "ring", "color": "#4f46e5", "background": "#ffffff", "size_px": "40", "thickness_px": "4", "duration_ms": "1000", "stagger_ms": "", "easing": "linear", "label": "Saving your changes", "page_check": "{...}", "description": "Save button in a web app, under a second", "clipped_note": ""}
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="loading-spinner-generator:advise:$(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: verdict, indicator, kind, summary, timing, size_px, label, ...
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: loading-spinner-generator:advise:$(shasum -a 256 input.json | cut -c1-16):a1" --data @input.json