← Notification Badge Generator
Your token

Notification Badge Generator API

The badge, 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 badge's settings and a description of where it sits, and get back, as JSON, advice for that place: keep or change, the badge type (count, dot or status), the icon (bell, cart, mail, chat or avatar), how the badge arrives, whether the icon rings, whether the badge pulses, where the count caps, the name screen readers hear, 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 badge.

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 notification badge's settings, the page's check and your description of where the badge sits, and returns keep or change, the type (count, dot, status), the icon (bell, cart, mail, chat, avatar), the motion (entrance, ring, pulse and their times), the cap, the screen-reader name, placement, principles and things to avoid.One JSON object

Input fields

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

FieldMeaning
task"advise"
typecount (a number), dot (something new) or status (a presence dot).
iconbell, cart, mail, chat or avatar.
countThe number on a count badge now, e.g. "3".
cap"9", "99" or "999": above it the badge shows e.g. 99+.
statusFor a status dot: online, away, busy or offline. The advice keeps it.
color, background, icon_colorHex colours, e.g. "#dc2626". The advice keeps them.
size_pxIcon size in px.
positiontop-right, top-left or bottom-right.
entrancebounce, squash, fade or none.
entrance_msHow long the badge takes to arrive.
ring, pulse, hover"yes" or "no": the icon rings when the badge arrives, the badge pulses, hover and press feedback.
ring_ms, pulse_msHow long one ring lasts; how long one pulse lasts.
labelThe name screen readers hear, without the count, e.g. "Notifications".
page_check{entrance_range_ms, ring_range_ms, pulse_range_ms, badge_contrast, shown, aria_label, verdict, notes}, from the page.
descriptionWhere the badge sits, what it counts, how often it changes 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), type, icon, summary, motion ({entrance, entrance_ms, ring, ring_ms, pulse, pulse_ms, why}, with ring and pulse booleans), cap (9, 99 or 999), label, placement, principles ([{name, how}], names from the 12 principles of animation) and avoid. Before using it, check the values as the page does: the badge arrives in 300-400 ms, a ring lasts 400-600 ms, a pulse 1500-2500 ms, a status dot never rings, a count never pulses and an offline dot never pulses, and the name has no digits (add the count yourself, e.g. "Notifications, 3 unread"). 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 "3 notifications" example:

{
  "task": "advise",
  "type": "count",
  "icon": "bell",
  "count": "3",
  "cap": "99",
  "status": "online",
  "color": "#dc2626",
  "background": "#ffffff",
  "icon_color": "#1f2937",
  "size_px": "28",
  "position": "top-right",
  "entrance": "bounce",
  "entrance_ms": "400",
  "ring": "yes",
  "ring_ms": "500",
  "pulse": "no",
  "pulse_ms": "2000",
  "hover": "yes",
  "label": "Notifications",
  "page_check": "{\"entrance_range_ms\":[300,400],\"ring_range_ms\":[400,600],\"pulse_range_ms\":[1500,2500],\"badge_contrast\":4.83,\"shown\":\"3\",\"aria_label\":\"Notifications, 3 unread\",\"verdict\":\"good\",\"notes\":[]}",
  "description": "Notification bell in the top bar of a project management web app. New comments and mentions arrive a few times an hour; people should notice them but not feel nagged. Clean, professional brand.",
  "clipped_note": ""
}

Reply:

{"verdict":"keep","type":"count","icon":"bell","summary":"Keep the red count on the bell in the top bar. Comments and mentions arrive only a few times an hour, so each one is worth a number the person can read, and the badge is calm enough not to nag. A short bounce plus one ring announces new items without a constant pulse.","motion":{"entrance":"bounce","entrance_ms":350,"ring":true,"ring_ms":500,"pulse":false,"pulse_ms":0,"why":"New comments and mentions are rare enough that a single bounce and one ring get noticed without feeling pushy in a professional tool."},"cap":99,"label":"Notifications","placement":"Top-right corner of the bell icon in the project management top bar. The person clicks the bell to open the list of new comments and mentions.","principles":[{"name":"Timing","how":"A 350 ms bounce and a 500 ms ring are quick enough to feel professional yet long enough to catch the eye when a mention lands."},{"name":"Arcs","how":"The bell swings from its hook for one short ring, so the motion reads as a real bell rather than a nervous shake."},{"name":"Staging","how":"The red count on a white top bar contrasts clearly, so the number stands out without any extra effect."},{"name":"Solid Drawing","how":"A cap of 99 keeps the number short and legible on a 28 px bell, and a few items an hour will rarely come close to it."}],"avoid":["Do not pulse the count, since it would nag people forever.","Do not ring repeatedly for each arrival in a burst.","Do not switch to a bare dot, because the number of new mentions matters here."]}

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 or empty.
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://notification-badge-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":"notification-badge-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", "type": "count", "icon": "bell", "count": "3", "cap": "99", "status": "online", "color": "#dc2626", "background": "#ffffff", "icon_color": "#1f2937", "size_px": "28", "position": "top-right", "entrance": "bounce", "entrance_ms": "400", "ring": "yes", "ring_ms": "500", "pulse": "no", "pulse_ms": "2000", "hover": "yes", "label": "Notifications", "page_check": "{...}", "description": "Bell in the top bar of a web app; new comments arrive a few times an hour", "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="notification-badge-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, type, icon, summary, motion, cap, 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: notification-badge-generator:advise:$(shasum -a 256 input.json | cut -c1-16):a1" --data @input.json