← Text to Mind Map
Your token

Text to Mind Map API

The drawing and every export run free in the browser and need no API. The API is for the one metered step: send notes, get back the outline of a mind map in PlantUML @startmindmap syntax, which any PlantUML renderer (or this page) draws.

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

taskWhat it doesReply
mapGroups notes, minutes or an article into a mind map: 3 to 8 branches, at most 4 levels below the centre, at most 80 lines, labels in the notes' language. Details come from the notes; branch headings may be the model's own words.One ```plantuml block

Input fields

FieldTypeMeaning
taskstring"map"
textstringThe notes. The page sends at most 12,000 characters: longer notes keep their first and last lines and lose the middle, with a marker line.
focusstringOptional, up to 200 characters: what the map is for, or which topic is the centre.
factsstringJSON text of what the page read from the notes: format, lines, nodes, depth, centre, branches. Send "{}" if you have nothing.
clipped_notestringEmpty, or a sentence saying the middle of the notes was cut.

The reply

job.output.output is text: one fenced block, @startmindmap first, @endmindmap last, one * per level (* centre, ** branch, *** detail), no colours or layout. If the balance ran low, truncated is true and the block may stop early; everything before the cut is still a valid map.

Worked example

Input (input.json):

{
  "task": "map",
  "text": "bakery site relaunch - call w/ Dana, Luis, Priya  (tue)\n\nso the old site is really slow on phones, Priya measured 9 sec to load the menu page\nDana wants online preorders for cakes before Christmas, deadline Dec 10 for that\nLuis: photos are outdated, he'll reshoot the pastry case next week\nwe keep the current domain, no rebrand this year\nbudget is $4,000 total, Priya thinks hosting + preorder plugin is about $600 of that\nopen question - do we take deposits on custom cakes or full payment?\nneed allergen info on every product page (legal asked)\nPriya to compare Square vs Shopify for preorders by Friday\nnewsletter signup on homepage? Dana not sure, maybe later\nnext call Dec 2",
  "focus": "",
  "facts": "{\"format\":\"outline\",\"lines\":11,\"nodes\":12,\"depth\":2,\"centre\":\"\",\"branches\":[\"bakery site relaunch - call w/ Dana, Luis, Priya (tue)\",\"so the old site is really slow on phones, Priya measured 9 sec to load the menu \",\"Dana wants online preorders for cakes before Christmas, deadline Dec 10 for that\",\"Luis: photos are outdated, he'll reshoot the pastry case next week\",\"we keep the current domain, no rebrand this year\",\"budget is $4,000 total, Priya thinks hosting + preorder plugin is about $600 of \",\"open question - do we take deposits on custom cakes or full payment?\",\"need allergen info on every product page (legal asked)\",\"Priya to compare Square vs Shopify for preorders by Friday\",\"newsletter signup on homepage? Dana not sure, maybe later\",\"next call Dec 2\"]}",
  "clipped_note": ""
}

Reply:

```plantuml
@startmindmap
* Bakery site relaunch
** Old site problems
*** Slow on phones
**** Priya measured 9 sec to load menu page
*** Photos are outdated
** Online preorders
*** Dana wants cake preorders before Christmas
*** Deadline Dec 10
** Budget
*** $4,000 total
*** Hosting + preorder plugin about $600 (Priya)
** Decisions
*** Keep current domain
*** No rebrand this year
*** Allergen info on every product page (legal asked)
** Open questions
*** Deposits or full payment on custom cakes
*** Newsletter signup on homepage, Dana not sure, maybe later
** Next steps
*** Luis reshoots pastry case next week
*** Priya compares Square vs Shopify by Friday
*** Next call Dec 2
@endmindmap
```

Paste the reply into the page to draw it, check it against the notes and download it.

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://text-to-mind-map.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":"text-to-mind-map"}' | 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": "map", "text": "...", "focus": "", "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="text-to-mind-map:map:$(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.txt   # one ```plantuml block: @startmindmap ... @endmindmap
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: text-to-mind-map:map:$(shasum -a 256 input.json | cut -c1-16):a1" --data @input.json