← Flip Card Generator
Your token

Flip Card Generator API

The card, 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 card's settings and a description of where it sits, and get back, as JSON, advice for that place: keep or change, a summary, how the card turns (trigger, direction, time, curve, depth), how it lifts (height, time), 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 card.

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 flip card's settings, the page's check and your description of where the card sits, and returns keep or change, a summary, the turn (trigger, direction, time, curve, depth), the lift (height, time), principles and things to avoid.One JSON object

Input fields

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

FieldMeaning
task"advise"
front, backThe text on each side, e.g. "Pro plan". The advice keeps them.
color, back_color, backgroundHex colours of the front, the back and the page, e.g. "#0f766e". The advice keeps them.
width_px, height_px, radius_px, title_pxCard size, corner radius and title size in px.
triggerhover (hover or focus; a tap on a phone focuses it) or click (a button: click, tap, Enter or Space).
axisy (sideways) or x (up and over).
flip_msHow long the turn takes.
easingease-in-out, smooth, ease-out, linear or spring.
perspective_pxThe depth of the 3D view.
lift_px, lift_msHow far the card rises while in use ("0" = no lift) and how long the rise takes.
page_check{flip_range_ms, lift_range_px, lift_range_ms, depth_ratio, depth_ratio_range, front_contrast, back_contrast, front_fits, back_fits, verdict, notes}, from the page.
descriptionWhere the card sits, what it shows, how people use it 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), summary, flip ({trigger, axis, ms, easing, perspective, why}), lift ({px, ms, why}), principles ([{name, how}], names from the 12 principles of animation) and avoid. Before using it, check the values as the page does: a turn in 300-400 ms on ease-in-out, smooth or ease-out (never linear), a depth of 2-6 times the card's width, and a lift of 8-12 px in 200-250 ms. 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 "Team member" example:

{
  "task": "advise",
  "front": "Sam Okafor, head baker",
  "back": "Bakes the rye and the sourdough. Starts at 4 am and still loves the smell of the first loaf.",
  "color": "#b45309",
  "back_color": "#fff7ed",
  "background": "#ffffff",
  "width_px": "280",
  "height_px": "200",
  "radius_px": "16",
  "title_px": "22",
  "trigger": "hover",
  "axis": "y",
  "flip_ms": "400",
  "easing": "ease-in-out",
  "perspective_px": "1000",
  "lift_px": "8",
  "lift_ms": "250",
  "page_check": "{\"flip_range_ms\":[300,400],\"lift_range_px\":[8,12],\"lift_range_ms\":[200,250],\"depth_ratio\":3.57,\"depth_ratio_range\":[2,6],\"front_contrast\":5.02,\"back_contrast\":16.71,\"front_fits\":true,\"back_fits\":true,\"verdict\":\"good\",\"notes\":[]}",
  "description": "Team member card on a small bakery's About page, one card per baker in a grid of six, read on phones and laptops. Visitors turn a few cards out of curiosity to read about the people. Warm, friendly brand.",
  "clipped_note": ""
}

Reply:

{"verdict":"keep","summary":"Keep the sideways turn on hover for these six baker cards: visitors browse a few at a time out of curiosity, and a tap on a phone focuses the card to turn it. A 400 ms ease-in-out turn with a gentle 8 px lift reads as warm and unhurried, which suits a friendly bakery.","flip":{"trigger":"hover","axis":"y","ms":400,"easing":"ease-in-out","perspective":1000,"why":"Cards are turned once to read a short bio, so the full 400 ms lets the turn feel calm, and a depth of about 3.6 times the width bends the card just enough to feel physical."},"lift":{"px":8,"ms":250,"why":"A small, soft lift keeps a grid of six cards calm while still raising the card in use above its neighbours."},"principles":[{"name":"Timing","how":"The unhurried 400 ms turn gives people time to follow the card over to Sam's short bio instead of snapping past it."},{"name":"Ease In & Ease Out","how":"The turn starts and settles softly, like a loaf of bread being set down, matching the warm, friendly character."},{"name":"Staging","how":"The hovered baker card rises 8 px above the rest of the grid so attention goes to the person being read."},{"name":"Appeal","how":"A rounded card with visible depth and a deepening shadow feels like a real card picked up from a table."}],"avoid":["Do not shorten the turn below 300 ms or the bio side will feel abrupt.","Do not raise the lift past 12 px, which would feel too bouncy for a calm six-card grid.","Do not use a bouncy overshoot curve; it fights the warm, steady feel."]}

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://flip-card-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":"flip-card-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", "front": "Sam Okafor, head baker", "back": "Bakes the rye and the sourdough.", "color": "#b45309", "back_color": "#fff7ed", "background": "#ffffff", "width_px": "280", "height_px": "200", "radius_px": "16", "title_px": "22", "trigger": "hover", "axis": "y", "flip_ms": "400", "easing": "ease-in-out", "perspective_px": "1000", "lift_px": "8", "lift_ms": "250", "page_check": "{...}", "description": "Team member card on a small bakery About page, read on phones and laptops", "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="flip-card-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, summary, flip, lift, principles, avoid
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: flip-card-generator:advise:$(shasum -a 256 input.json | cut -c1-16):a1" --data @input.json