← CTA Button Generator
Your token

CTA Button Generator API

Reading your notes or HTML, checking them and writing the button HTML, the CSS, the loading script, the wordings and the checklist all run free in the browser and need no API. The API is for the one metered step: send your product, what it does, the action, the offer, where the button sits and your current button words and get back, as JSON, the main button text, the line under it, a clearer second button, up to three more wordings to A/B test and up to three placement tips. The page checks every line and refuses any that adds a number, a name, a promise or a deadline your notes do not make; do the same if you call the API yourself.

Base URL: https://api.skillsafe.ai/v1/app-api. Every response is an envelope {"data": ..., "error": null} or {"data": null, "error": {"code", "message"}}.

The task field

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

taskWhat it doesReply
refineWrites the main button text and the line under it, a clearer second button, up to three more wordings and up to three placement tips, from the fields you send.One JSON object

Input fields

All values are strings. task is required; send "" for anything you do not have.

FieldMeaning
task"refine"
productThe product, shop or organisation name, or "".
aboutWhat it is or does, or "". Long text: keep both ends and mark the cut with [...].
actionWhat pressing the button should do, in your words ("start a free trial").
action_kindtrial, account, buy, demo, book, download, subscribe, waitlist, contact, quote, donate, read, event or other.
offerThe offer: trial length, discount, code, shipping, or "".
whereWhere the button sits (hero, pricing, product page, form, end of article), or "".
stageawareness, consideration, decision, or "".
audienceWho presses it, or "".
buttonYour current button words, or "".
button_issue"", generic, long, mismatch, style or missing.
secondaryYour second button words, or "" when there is no second action.
noteYour own line under the button, or "".
trustTrust lines separated by ; , or "".
deadlineWhen the offer really ends, or "".
items_noteEmpty, or a sentence saying what was left out.

The reply

job.output.output is text holding one JSON object (sometimes inside a ```json fence) with four keys: primary, {text, note}; secondary, {text}; variants, a list of {text, angle}; and placement, a list of strings. Before using it, check that no line adds a number, a name, a promise (free, no card, cancel any time, free shipping) or urgency your input does not hold, that every button is 2 to 5 words and at most 30 characters, starts with a verb, is not Submit or Click here and asks for the same action, that secondary.text is empty when you sent no second button, and that there are at most three variants and three tips.

Worked example

Input (input.json), the free trial sample on the page:

{
  "task": "refine",
  "product": "Quillrun",
  "about": "A writing app that turns your voice notes into tidy first drafts",
  "action": "start a free trial",
  "action_kind": "trial",
  "offer": "14-day free trial, no card needed, cancel any time",
  "where": "homepage hero",
  "stage": "",
  "audience": "",
  "button": "Submit",
  "button_issue": "generic",
  "secondary": "See pricing",
  "note": "",
  "trust": "Rated 4.7 by 1,900 writers",
  "deadline": "",
  "items_note": ""
}

Reply:

{
  "primary": {
    "text": "Start my free trial",
    "note": "No card needed. Cancel any time."
  },
  "secondary": { "text": "See pricing" },
  "variants": [
    { "text": "Start free trial", "angle": "plain" },
    { "text": "Start your 14-day free trial", "angle": "value" },
    { "text": "Try Quillrun free", "angle": "plain" }
  ],
  "placement": [
    "Keep it right under the headline so it shows without scrolling on a phone.",
    "Put the rating line just below the button, where the last doubt comes up.",
    "Make See pricing a quieter outline button beside it so the trial stays the main choice."
  ]
}

On the page, the Submit button becomes “Start my free trial”, the line under it reads “No card needed. Cancel any time.”, the three wordings join the list of options and the tips join the check.

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://cta-button-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":"cta-button-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": "refine", "product": "Quillrun", "about": "A writing app that turns your voice notes into tidy first drafts", "action": "start a free trial", "action_kind": "trial", "offer": "14-day free trial, no card needed, cancel any time", "where": "homepage hero", "stage": "", "audience": "", "button": "Submit", "button_issue": "generic", "secondary": "See pricing", "note": "", "trust": "Rated 4.7 by 1,900 writers", "deadline": "", "items_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="cta-button-generator:refine:$(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: primary, secondary, variants, placement
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: cta-button-generator:refine:$(shasum -a 256 input.json | cut -c1-16):a1" --data @input.json