← PAA Answer Writer / API
Get a token

Drive PAA Answer Writer from your own code

Everything the web app does goes through one public surface. Base URL:

https://api.skillsafe.ai/v1/app-api

Every request carries Authorization: Bearer <token> and Content-Type: application/json. Every response is a JSON envelope: {"ok":true,"data":{…}} on success and {"ok":false,"error":{"code":"…","message":"…"}} on failure. Read error.code, not only the HTTP status.

Errors

CodeMeaningWhat to do
UNAUTHORIZEDMissing, expired or wrong-app token.Mint a guest token or sign in again.
INSUFFICIENT_CREDITSBalance below min_credits.Top up. /estimate is free and tells you the hold.
VALIDATION_ERRORThe input object failed validation.Check error.details. The body is the input object itself — never wrap it in {"input": …}.
RATE_LIMITEDToo many requests.Back off and retry.
JOB_FAILEDThe run started and did not complete.Retry with the same Idempotency-Key.

The input: one lane, task: "answer"

Every input carries task: "answer" (the app has one lane). Send pasted questions in questions, or leave it out and set count to get suggested questions. Fields are scalars; facts travels as a JSON string.

FieldTypeMeaning
taskstring, requiredAlways "answer".
keywordstring, requiredThe topic or search keyword, up to 160 characters.
questionsstringThe questions to answer, one per line, up to 10. The web app sends them after cleanup.
countnumber3–10: how many questions to suggest when questions is empty. Default 6.
audiencestringWho reads the answers.
contextstringFacts about your business the answers may use (prices, location, policies). The web app sends at most 3,000 characters, cut at a line break.
tonestring"plain", "expert" or "friendly".
spellingstring"en-US" or "en-GB".
factsstring (JSON)The free in-browser cleanup: {"questions":[{"question","intent","format"}]}. Optional.
retry_notestringSent only on the one automatic reformat retry.

The output contract

The output (output.output) is one JSON object: task, status (ok · off_topic · refused), message, keyword, search_intent, items[], related[] (follow-up questions, suggestions) and notes.

Each item: question, origin (pasted or suggested), intent (definition · how_to · comparison · cost · yes_no · list · reason · time · other), format (paragraph · list · steps), snippet (40–60 words, plain text, answer first), list_items[], expanded (paragraphs separated by a blank line) and verify[] (claims to check before publishing).

The web app counts each snippet's words and builds the FAQPage JSON-LD in the browser. If you call the API directly, do your own count: the model aims for 40–60 words but is not guaranteed to hit it.

1. Get a token

A guest token is enough for /me and /estimate. Writing answers is metered and needs a personal token from signing in. The tokens page shows yours and copies it. Replace YOUR_TOKEN below with it.

2. Check the session and the balance

/me returns subject_type, subject_id and credits. Signed in means subject_type === "user".

3. Price it before you run it

/estimate is free and starts no job. hold_credits is a reservation priced against the longest possible answer, not the price. Pasted questions:

Keyword only, with suggested questions:

4. Run and poll

/run returns a job. Always send an Idempotency-Key — the same key is the same run, so a retry cannot bill twice. The web app derives it from the lane and a hash of the input.

5. Stream it

/run-stream answers with server-sent events and ends with a done frame carrying the whole output, charged_credits and truncated. If truncated is true the balance ran low mid-answer: parse what arrived and top up for the rest.