← Contact Form Generator
Your token

Contact Form Generator API

Reading the field list, checking it and writing the form's HTML, CSS and script all run free in the browser and need no API. The API is for the one metered step: send the form's fields by id with its heading, intro, button and reply line, and get back, as JSON, clearer labels, hints where people need them, an error message per field, a heading, an intro, a button and the message shown after sending. The model only rewords; the page keeps every field, type, option and required mark, and refuses wording that adds a fact or promises a reply time you did not give.

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

taskWhat it doesReply
copyRewrites a contact form's wording: labels, hints, error messages, heading, intro, button and thank-you line. It never adds, removes or reorders fields.One JSON object

Input fields

All values are strings. task and form are required.

FieldMeaning
task"copy"
purpose"contact", "sales", "support" or "quote".
aboutEmpty, or one line about the business (at most 300 characters). Used only to pick fitting words.
formJSON text: {title, intro, button, reply, fields}, where fields is a list of {id, label, type, required, hint?, options?} in order, ids like f3. Types: text, email, tel, url, number, date, textarea, select, radio, checkbox, file. At most 30 fields.
form_noteEmpty, or a sentence saying what was cut.

The reply

job.output.output is text holding one JSON object (sometimes inside a ```json fence) with five keys: title, intro, button, success (strings) and fields, one {id, label, hint, error} per field in input order. Before using it, check that every id is one you sent and that no new wording adds a number or name your form lacks or promises a reply time you did not write; the page does this and lists what it refused. If the balance ran low, truncated is true and the object may stop early; the page keeps every entry that arrived whole.

Worked example

Input (input.json), the cafe sample on the page (4 fields):

{
  "task": "copy",
  "purpose": "contact",
  "about": "Neighbourhood cafe and bakery that also caters small office events.",
  "form": "{\"title\":\"Get in touch\",\"intro\":\"\",\"button\":\"Submit\",\"reply\":\"\",\"fields\":[{\"id\":\"f1\",\"label\":\"Name\",\"type\":\"text\",\"required\":true},{\"id\":\"f2\",\"label\":\"Email ID\",\"type\":\"email\",\"required\":true},{\"id\":\"f3\",\"label\":\"Mobile No.\",\"type\":\"tel\",\"required\":false},{\"id\":\"f4\",\"label\":\"Message\",\"type\":\"textarea\",\"required\":true}]}",
  "form_note": ""
}

Reply:

{"title":"Get in touch","intro":"Questions, or planning an office event? Send us a message.","fields":[{"id":"f1","label":"Your name","hint":"","error":"Enter your name"},{"id":"f2","label":"Email address","hint":"","error":"Enter your email address"},{"id":"f3","label":"Phone number","hint":"Only add this if you would like us to use it.","error":"Enter a valid phone number"},{"id":"f4","label":"Your message","hint":"","error":"Write your message"}],"button":"Send message","success":"Thanks, your message has arrived."}

On the page, "Email ID" becomes "Email address", "Mobile No." becomes "Phone number", the "Submit" button becomes "Send message", and each field gets its own error message.

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://contact-form-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":"contact-form-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": "copy", "purpose": "contact", "about": "", "form": "{...}", "form_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="contact-form-generator:copy:$(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: title, intro, fields, button, success
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: contact-form-generator:copy:$(shasum -a 256 input.json | cut -c1-16):a1" --data @input.json