← Brand Story Builder
Your token

Brand Story Builder API

Reading the copy, finding the seven story parts, the you-against-we count, the checklist, the story sheet, the one-liner and every download run free in the browser and need no API. The API is for the one metered step: send the copy as numbered sentences with the page's measurements, and get back, as JSON, the seven parts, a one-liner and a website header. The page builds this input for you and checks every line of the reply against the copy.

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

taskWhat it doesReply
storyWrites the seven story parts, a one-liner and a website headline and subhead from the copy, without adding facts.One JSON object

Input fields

Every field is a string; copy and page_facts hold JSON text. task, copy and page_facts are required.

FieldMeaning
task"story"
copyJSON list of {id, text}: the page's sentences and lines in order (s1, s2 ...), at most 120 and about 14,000 characters; a longer page sends its first 90 and last 30.
brandThe business name, or empty.
page_facts{parts_found, parts_missing, you_words, we_words, headline_id, plan_ids, proof_ids, promise_ids, numbers_in_copy}.
clipped_noteEmpty, or a sentence saying the middle of a long page was left out.

The reply

job.output.output is text holding one JSON object with the keys character, problem {villain, external, internal, philosophical}, guide {empathy, authority, authority_from}, plan (3 or 4 steps), agreement, cta {direct, transitional}, failure, success, transformation {from, to}, one_liner, header {headline, subhead} and gaps (ids from no_proof, no_guarantee, unclear_customer, unclear_offer, no_plan). Before using it, check it as the page does: every number is in numbers_in_copy, the proof cites sentences from proof_ids, no names the copy never mentions, plan steps start with a verb, and the buttons are real calls to action. If the balance ran low, truncated is true and the object may stop early; the page keeps every section that arrived whole.

Worked example

Input (input.json), from the page's "Corporate homepage" example:

{
  "task": "story",
  "copy": "[{\"id\":\"s1\",\"text\":\"Welcome to Northgate Business Solutions\"},{\"id\":\"s2\",\"text\":\"Delivering innovative solutions since 1987.\"},{\"id\":\"s3\",\"text\":\"Northgate is a leading provider of enterprise-grade document management systems.\"},{\"id\":\"s4\",\"text\":\"Our mission is to leverage cutting-edge technology to empower organizations worldwide.\"},{\"id\":\"s5\",\"text\":\"Our award-winning platform integrates seamlessly with your existing infrastructure.\"},{\"id\":\"s6\",\"text\":\"We pride ourselves on our world-class support team and our commitment to excellence.\"},{\"id\":\"s7\",\"text\":\"Our services\"},{\"id\":\"s8\",\"text\":\"Document capture\"},{\"id\":\"s9\",\"text\":\"Workflow automation\"},{\"id\":\"s10\",\"text\":\"Secure archiving\"},{\"id\":\"s11\",\"text\":\"We are a trusted partner to over 400 companies in 12 countries.\"},{\"id\":\"s12\",\"text\":\"Learn more\"}]",
  "brand": "Northgate",
  "page_facts": "{\"parts_found\":[\"guide\"],\"parts_missing\":[\"character\",\"problem\",\"plan\",\"cta\",\"failure\",\"success\"],\"you_words\":1,\"we_words\":10,\"headline_id\":\"s1\",\"plan_ids\":[],\"proof_ids\":[\"s5\",\"s11\"],\"promise_ids\":[],\"numbers_in_copy\":[\"1987\",\"400\",\"12\"]}",
  "clipped_note": ""
}

Reply:

{"character":"An organization that wants its documents under control.","problem":{"villain":"Documents that are hard to manage","external":"Your documents pile up and are hard to capture, route and store.","internal":"You feel stuck when your documents slow your team down.","philosophical":"You shouldn't have to fight your own documents to get work done."},"guide":{"empathy":"We know how frustrating it is when your documents get in the way of your work.","authority":"Northgate works with over 400 companies in 12 countries.","authority_from":["s11"]},"plan":["Capture your documents.","Automate the workflow around them.","Archive them securely."],"agreement":[],"cta":{"direct":"Get started","transitional":"See how it works"},"failure":"If nothing changes, your documents keep slowing your team down.","success":"Your documents are captured, moved along by workflow automation and archived securely, so your team can focus on its work.","transformation":{"from":"overwhelmed by documents","to":"in control of documents"},"one_liner":"Documents are hard to manage. Northgate provides document management systems for organizations like yours. You capture, automate and archive your documents securely.","header":{"headline":"Keep your documents under control","subhead":"Document capture, workflow automation and secure archiving for your organization."},"gaps":["no_guarantee","no_plan"]}

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://brand-story-builder.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":"brand-story-builder"}' | 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": "story", "copy": "[{\"id\":\"s1\",\"text\":\"Welcome to Northgate Business Solutions\"},{\"id\":\"s2\",\"text\":\"Delivering innovative solutions since 1987.\"},{\"id\":\"s3\",\"text\":\"Northgate is a leading provider of enterprise-grade document management systems.\"},{\"id\":\"s4\",\"text\":\"Our mission is to leverage cutting-edge technology to empower organizations worldwide.\"},{\"id\":\"s5\",\"text\":\"Our award-winning platform integrates seamlessly with your existing infrastructure.\"},{\"id\":\"s6\",\"text\":\"We pride ourselves on our world-class support team and our commitment to excellence.\"},{\"id\":\"s7\",\"text\":\"Our services\"},{\"id\":\"s8\",\"text\":\"Document capture\"},{\"id\":\"s9\",\"text\":\"Workflow automation\"},{\"id\":\"s10\",\"text\":\"Secure archiving\"},{\"id\":\"s11\",\"text\":\"We are a trusted partner to over 400 companies in 12 countries.\"},{\"id\":\"s12\",\"text\":\"Learn more\"}]", "brand": "Northgate", "page_facts": "{...}", "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="brand-story-builder:story:$(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: the story
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: brand-story-builder:story:$(shasum -a 256 input.json | cut -c1-16):a1" --data @input.json