← Floating Label Generator
Your token

Floating Label Generator API

Reading your field list or pasted form, previewing the fields, checking them and writing the HTML, CSS, JavaScript and React code all run free in the browser and need no API. The API is for the one metered step: send a description of what a form is for and what it should ask, with the current field list, and get back, as JSON, the fields and any motion settings to change. The page builds this input for you and re-checks every field and setting in the reply.

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": "form".

taskWhat it doesReply
formReads a description of a web form and the current field list, and returns the complete field list (or none, to keep the current fields) plus motion settings. Choices are listed only when the description names them. An empty description fixes the current form's flagged problems.One JSON object

Input fields

Every field is a string; page_check holds JSON text. Only task is required.

FieldMeaning
task"form"
descriptionWhat the form is for, what it should ask and how it should feel (at most 1,500 characters). May be empty.
currentOne line per field: N. label | type | required or optional | help: text or (none), plus | options: a / b for a choice; at most 3,000 characters.
page_check{fields, types, required, style, easing, float_ms, focus_ms, shake, shake_px, shake_ms, success_check, validate_on, font_px, label_contrast, border_contrast, submit_label, verdict, notes} from the page.
clipped_noteEmpty, or a sentence saying the description or the list was cut.

The reply

job.output.output is text holding one JSON object: summary, name, fields ([{label, type, required, help, options?}], the complete list, or [] to keep the current fields) and notes, plus any settings it chose: submit_label, style (outlined, filled or underline), easing (standard, settle or out), float_ms, focus_ms, shake, shake_px, success_check, validate_on (blur or submit). type is one of text, email, password, tel, url, number, date, textarea or select. A missing setting means keep the current one. 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): a yoga studio booking form described in a sentence, sent over the sign-up example's fields:

{
  "task": "form",
  "description": "Booking form for my yoga studio. Name, email, phone if they want, which class (Morning flow or Evening yin), and anything we should know. Calm and friendly.",
  "current": "1. Full name | text | required | help: (none)\n2. Email | email | required | help: We never share it\n3. Password | password | required | help: (none)\n4. Phone | tel | optional | help: Only for delivery updates",
  "page_check": "{\"fields\":4,\"types\":\"text,email,password,tel\",\"required\":3,\"style\":\"outlined\",\"easing\":\"standard\",\"float_ms\":180,\"focus_ms\":130,\"shake\":true,\"shake_px\":5,\"shake_ms\":300,\"success_check\":true,\"validate_on\":\"blur\",\"font_px\":16,\"label_contrast\":7.55,\"border_contrast\":4.83,\"submit_label\":\"Create account\",\"verdict\":\"good\",\"notes\":[]}",
  "clipped_note": ""
}

Reply:

{
  "summary": "A booking form for a yoga studio that asks for a name, email, an optional phone number, the class and any notes. It uses soft filled boxes and gentle motion to feel calm and friendly.",
  "name": "Yoga class booking form",
  "submit_label": "Book my place",
  "style": "filled",
  "easing": "standard",
  "float_ms": 180,
  "focus_ms": 130,
  "shake": true,
  "shake_px": 4,
  "success_check": true,
  "validate_on": "blur",
  "fields": [
    { "label": "Full name", "type": "text", "required": true, "help": "" },
    { "label": "Email", "type": "email", "required": true, "help": "We send your booking here" },
    { "label": "Phone", "type": "tel", "required": false, "help": "Only if you want us to call" },
    { "label": "Which class?", "type": "select", "required": true, "help": "", "options": ["Morning flow", "Evening yin"] },
    { "label": "Anything we should know", "type": "textarea", "required": false, "help": "" }
  ],
  "notes": ["Check the class names match your timetable", "The old password field is gone because a booking does not need one"]
}

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 task 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://floating-label-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":"floating-label-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": "form", "description": "Booking form for my yoga studio: name, email, which class (Morning flow or Evening yin)", "current": "1. Email | email | required | help: (none)", "page_check": "{}", "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="floating-label-generator:form:$(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: summary, name, submit_label, style, fields, notes
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: floating-label-generator:form:$(shasum -a 256 input.json | cut -c1-16):a1" --data @input.json