← Share Button Generator
Your token

Share Button Generator API

The share links, the buttons, the checks and every export run free in the browser and need no API. The API is for the one metered step: send a page's address, its title and some text about it, and get back, as JSON, the share text for each network. The page checks each text (length, no link inside, no figure or @handle that was not in the input) and fills the form with the ones that pass.

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

taskWhat it doesReply
writeWrites the texts that the share links carry: share_text (WhatsApp, Telegram, Bluesky, Threads, device share), a shorter x_text, up to two hashtags, an email_subject and email_body, and a pin_text for Pinterest, plus up to two notes. It never writes a link into a text and never adds a figure or @handle that is not in the input.One JSON object

Input fields

FieldTypeMeaning
taskstring"write"
urlstringThe page being shared.
titlestringThe page's title.
aboutstringOptional text about the page: its first paragraph, a summary or notes. May be empty. The page sends at most 4,000 characters: longer text keeps its start and end and loses the middle, with a marker line.
currentstringJSON text with networks (x, facebook, linkedin, whatsapp, reddit, email, telegram, pinterest, bluesky, threads, hackernews), title_source, text, x_text, hashtags and via. Send "{}" if you have none.
clipped_notestringEmpty, or a sentence saying the middle of about was cut.

The reply

job.output.output is text holding one JSON object: share_text (at most 160 characters), x_text (at most 180, because X adds the link as 23 characters, the hashtags and "via @handle"), hashtags (0 to 2, without #), email_subject (at most 80), email_body (at most 400, the link goes after it), pin_text (at most 300) and notes (0 to 2 strings). Build the links yourself, or paste the texts into the page. If the balance ran low, truncated is true and the object may stop early; the page keeps every part that arrived whole.

Worked example

Input (input.json):

{
  "task": "write",
  "url": "https://ledgerly.app/blog/ledgerly-2-launch",
  "title": "Ledgerly 2.0: invoices that chase themselves",
  "about": "Today we are launching Ledgerly 2.0. The big change: Ledgerly now sends up to 3 polite payment reminders for every overdue invoice, on a schedule you choose, and stops the moment the client pays. Plans start at $12 a month and every account gets a 30-day free trial. Freelancers in our beta cut the time they spent chasing payments roughly in half. Ledgerly 2.0 also adds recurring invoices and a client portal where your clients can pay by card or bank transfer.",
  "current": "{\"networks\":[\"x\",\"facebook\",\"linkedin\",\"reddit\",\"email\",\"bluesky\"],\"title_source\":\"typed\",\"text\":\"\",\"x_text\":\"\",\"hashtags\":[],\"via\":\"ledgerlyapp\"}",
  "clipped_note": ""
}

Reply:

{"share_text":"Ledgerly 2.0 sends up to 3 polite reminders for each overdue invoice and stops when the client pays. Plans start at $12 a month, with a 30-day free trial.","x_text":"Ledgerly 2.0 sends up to 3 polite payment reminders per overdue invoice and stops when the client pays. 30-day free trial.","hashtags":["invoicing","freelance"],"email_subject":"Ledgerly 2.0 launches with automatic payment reminders","email_body":"Ledgerly 2.0 is out. It sends up to 3 polite payment reminders for every overdue invoice, on a schedule you choose, and stops once the client pays. Plans start at $12 a month, and there is a 30-day free trial.","pin_text":"Ledgerly 2.0 launch post: how invoices chase themselves with up to 3 polite reminders, plus recurring invoices and a client portal. Save it if you freelance.","notes":[]}

On the page, this reply fills the share text, the text for X, two hashtags, the email and the Pinterest description, and every one passes the page's 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://share-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":"share-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": "write", "url": "https://example.com/post", "title": "...", "about": "...", "current": "{}", "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="share-button-generator:write:$(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: share_text, x_text, hashtags, ...
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: share-button-generator:write:$(shasum -a 256 input.json | cut -c1-16):a1" --data @input.json