← Pinterest Pin Maker
Your token

Pinterest Pin Maker API

Opening the photo, drawing the 1000 x 1500 pin, the preview, the downloads and the title and description checks run free in the browser and need no API; the photo never leaves it. The API is for the one metered step: send notes about a pin, and get back, as JSON, a search phrase, title, description, board and alt text. The page builds this input for you and checks the reply before it fills the fields.

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

taskWhat it doesReply
pin_textReads the notes, the link and the words on the pin, picks one search phrase and writes the pin's title, description, board and alt text.One JSON object

Input fields

Every field is a string; page_facts holds JSON text. task, notes and page_facts are required; link may be empty.

FieldMeaning
task"pin_text"
notesYour own words, up to 800 characters: what the pin is for, and what the photo shows.
linkThe address the pin links to, or "". With no link the call to action stays on Pinterest (save the pin).
page_facts{headline, sub, footer}: the words printed on the pin image, and the brand or website at its bottom.

The reply

job.output.output is text holding one JSON object: content_type (product, recipe, tutorial, inspiration or other), goal (traffic, sales, signups or other), keyword, related (2 or 3 phrases), title (up to 100 characters, keyword in the first 40), description (180 to 280 characters, ending with the call to action), cta, board and alt_text (up to 500 characters, including the headline). Before using it, check it as the page does: every number, claim word (best, easiest, perfect ...) and colour word must appear in your notes or on the pin, the keyword is built only from your words, and the description contains the keyword and every related phrase. If the balance ran low, truncated is true and the object may stop early.

Worked example

Input (input.json), from the page's "Recipe pin" example:

{
  "task": "pin_text",
  "notes": "Honey walnut pancakes recipe on my food blog Sunday Stack, ready in 20 minutes with one bowl. Photo: a tall stack of pancakes with honey poured over walnuts.",
  "link": "https://sundaystack.example/honey-walnut-pancakes",
  "page_facts": "{\"headline\":\"Honey Walnut Pancakes\",\"sub\":\"Ready in 20 minutes\",\"footer\":\"Sunday Stack\"}"
}

Reply:

{"content_type": "recipe", "goal": "traffic", "keyword": "honey walnut pancakes", "related": ["pancake recipe", "one bowl breakfast"], "title": "Honey Walnut Pancakes Recipe Ready in 20 Minutes", "description": "Make honey walnut pancakes from Sunday Stack, a tall stack with honey poured over walnuts. This pancake recipe is ready in 20 minutes and uses just one bowl, so it is a simple one bowl breakfast. Get the full recipe on the blog.", "cta": "Get the full recipe on the blog.", "board": "Pancake Recipes", "alt_text": "A tall stack of pancakes with honey poured over walnuts, with the text \"Honey Walnut Pancakes\" and \"Ready in 20 minutes\"."}

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://pinterest-pin-maker.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":"pinterest-pin-maker"}' | 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": "pin_text", "notes": "Honey walnut pancakes recipe on my food blog Sunday Stack, ready in 20 minutes with one bowl. Photo: a tall stack of pancakes with honey poured over walnuts.", "link": "https://sundaystack.example/honey-walnut-pancakes", "page_facts": "{...}"}
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="pinterest-pin-maker:pin_text:$(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: content_type, goal, keyword, related, title, description, cta, board, alt_text
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: pinterest-pin-maker:pin_text:$(shasum -a 256 input.json | cut -c1-16):a1" --data @input.json