← Cookie Policy Generator
Your token

Cookie Policy Generator API

Writing the policy, the cookie table, the banner verdict, finding tools in page source and every export run free in the browser and need no API. The API is for the one metered step: send a description of a website and get back, as JSON, which platform, tools, features and visitor regions it mentions, each backed by a quote from the description. The page checks each quote, ticks the ones it finds and rebuilds the cookie table.

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

taskWhat it doesReply
tailorReads the description and picks the platform (wordpress, woocommerce, shopify, wix, squarespace), the tools (ga4, clarity, hotjar, hubspot, plausible, fathom, google_ads, adsense, meta_pixel, ms_ads, linkedin, tiktok, pinterest, reddit, intercom, crisp, zendesk, stripe, youtube, vimeo, cloudflare, recaptcha), the site features (accounts, cart, language, theme, consent) and visitor regions (eu, us) it mentions, each with a verbatim quote; lists other services it names that may set cookies, and up to three open questions. It never writes cookie names or legal text.One JSON object

Input fields

FieldTypeMeaning
taskstring"tailor"
descriptionstringThe site owner's words, a developer's notes, a plugin list or part of the page source. The page sends at most 6,000 characters: longer text keeps its first and last lines and loses the middle, with a marker line.
currentstringJSON text of the current choices: name, platform, tools, features, eu, us. Send "{}" if you have none.
clipped_notestringEmpty, or a sentence saying the middle of the description was cut.

The reply

job.output.output is text holding one JSON object (sometimes inside a ```json fence): platform ({id, quote} or null), tools and features (lists of {id, quote}), regions (a list of {id, value, quote}), other_tools (a list of {name, quote}) and questions (0 to 3 strings). Before applying a suggestion, check that its quote is in your description: the page ignores any it cannot find, and never unticks anything. 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": "tailor",
  "description": "Saltmarsh Candles is our small Shopify store selling hand-poured soy candles. We run Facebook and Instagram ads with the Meta pixel and started testing TikTok ads this autumn. Google Analytics 4 is connected through the Shopify app. Customers can create an account to see past orders. We use Klaviyo pop-ups for the newsletter and Judge.me for product reviews. We ship across Europe and the UK, and our cookie banner is Shopify's own Customer Privacy banner.",
  "current": "{\"name\":\"Saltmarsh Candles\",\"platform\":\"custom\",\"tools\":[],\"features\":[],\"eu\":true,\"us\":true}",
  "clipped_note": ""
}

Reply:

{"platform":{"id":"shopify","quote":"our small Shopify store"},"tools":[{"id":"meta_pixel","quote":"with the Meta pixel"},{"id":"tiktok","quote":"testing TikTok ads"},{"id":"ga4","quote":"Google Analytics 4"}],"features":[{"id":"accounts","quote":"Customers can create an account"},{"id":"consent","quote":"our cookie banner is Shopify's own Customer Privacy banner"}],"regions":[{"id":"eu","value":true,"quote":"We ship across Europe and the UK"}],"other_tools":[{"name":"Klaviyo","quote":"Klaviyo pop-ups"},{"name":"Judge.me","quote":"Judge.me for product reviews"}],"questions":["Do the Meta and TikTok pixels load only after visitors accept marketing cookies in the Customer Privacy banner?"]}

On the page, this reply ticks Shopify, the Meta and TikTok pixels, Google Analytics, customer accounts, the cookie banner and EU visitors, and lists Klaviyo and Judge.me as services to add by hand: the cookie table grows to 12 cookies and the verdict becomes a consent banner.

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://cookie-policy-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":"cookie-policy-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": "tailor", "description": "...", "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="cookie-policy-generator:tailor:$(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: platform, tools, features, ...
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: cookie-policy-generator:tailor:$(shasum -a 256 input.json | cut -c1-16):a1" --data @input.json