XML Sitemap Generator API
Reading your list, cleaning it, checking it and writing sitemap.xml, the sitemap index and its parts, the robots.txt line, the CSV, the Next.js sitemap.ts and the checklist all run free in the browser and need no API. The API is for the one metered step: send your site address, your page paths with their type, how many pages each section holds, what was left out and what the check found, and get back, as JSON, the listed pages that should not be in the sitemap, sections to split a large sitemap by, and up to three tips. The page checks every line and refuses a page that is not in your list, the home page, a group of more than half of your pages and a tip that adds a number, a name or a ranking promise; do the same if you call the API yourself.
Base URL: https://api.skillsafe.ai/v1/app-api. Every response is an envelope {"data": ..., "error": null} or {"data": null, "error": {"code", "message"}}.
The task field
This app has one task. Always send "task": "review".
| task | What it does | Reply |
|---|---|---|
review | Names listed pages to leave out of the sitemap, sections to split a sitemap of 1,000 or more pages by, and up to three tips, from the fields you send. | One JSON object |
Input fields
All values are strings. task is required; send "" for anything you do not have.
| Field | Meaning |
|---|---|
task | "review" |
site | The site address, such as https://www.example.com, or "". |
total | How many pages are in the sitemap, as digits. |
sections | One per line as prefix | count, largest first. Past 40, the 30 largest and the 10 smallest. |
pages | One per line as path | type; type is home, locale, hub, key, content, archive or legal. Past 300 the page sends the first 200 and the last 100; a path over 160 characters keeps both ends with [...] between. |
left_out | One per line as reason | count | example path, or "". |
problems | Check codes separated by , (for example out.status, host.www, lastmod.same), or "". |
items_note | Empty, or a sentence saying what was left out of a long list. |
The reply
job.output.output is text holding one JSON object (sometimes inside a ```json fence) with three keys: exclude, a list of {"path", "why"} (a path may hold one * to name a group such as /blog/tag/*); sections, a list of {"name", "prefix"}; and tips, a list of strings. Empty lists mean "nothing to change". Before using it, check that every path is one you sent (or a group that matches some of them and not more than half), that the home page is not named, that each reason is 10 to 140 characters, that sections are given only for 1,000 pages or more with a prefix that starts and ends with / and holds pages, and that there are at most three tips of 20 to 160 characters with no number or name your input does not have.
Worked examples
The three samples on the page, each with the exact input the page sends and a model reply.
A blog's page list (typed URLs)
Input:
{
"task": "review",
"site": "https://www.saltmarsh-kitchen.example",
"total": "21",
"sections": "/recipes/ | 10\n/guides/ | 2\n/tag/ | 2\n/ | 1\n/about | 1\n/contact | 1\n/guides | 1\n/privacy | 1\n/recipes | 1\n/thank-you | 1",
"pages": "/ | home\n/recipes | hub\n/recipes/sourdough-starter-in-seven-days | content\n/recipes/brown-butter-oat-cookies | content\n/recipes/one-pan-lemon-chicken | content\n/recipes/miso-glazed-aubergine | content\n/recipes/weeknight-dal | content\n/recipes/rhubarb-crumble | content\n/recipes/Fish-Pie | content\n/guides | hub\n/guides/how-to-feed-a-starter | content\n/guides/knife-skills-for-beginners | content\n/tag/vegetarian | archive\n/tag/baking | archive\n/recipes/page/2 | archive\n/about | key\n/contact | key\n/privacy | legal\n/thank-you | content\n/recipes/spring-pea-risotto | content\n/recipes/hot-cross-buns | content",
"left_out": "variant | 1 | /recipes/weeknight-dal/\ndup | 2 | /recipes/rhubarb-crumble\nsearch | 1 | /?s=lemon\nprivate | 1 | /wp-admin/\nasset | 2 | /wp-content/uploads/2025/11/starter-day-3.jpg\nhost | 1 | https://saltmarsh-kitchen.example/recipes/fish-pie\nscheme | 1 | mailto:hello@saltmarsh-kitchen.example",
"problems": "out.scheme, out.host, out.asset, out.private, out.search, out.dup, out.variant, host.www, proto.http, query.tracking, lastmod.future",
"items_note": ""
}
Reply:
{
"exclude": [
{
"path": "/thank-you",
"why": "A thank-you page after a form; visitors should not land on it from search."
},
{
"path": "/recipes/page/2",
"why": "A numbered list page that repeats the recipes list; the recipes themselves are listed."
},
{
"path": "/tag/*",
"why": "Tag archives only repeat recipes the recipes list already links to; list the recipes instead."
}
],
"sections": [],
"tips": [
"Redirect the bare host to www so only one form of each address exists.",
"Fix the lastmod dates set in the future so each one is the page's real last-changed date.",
"Use one letter case in recipe addresses, such as /recipes/Fish-Pie, so links and the sitemap match."
]
}
On the page, the thank-you page, the numbered recipes page and both tag pages move to Left out with the AI's reason, and the tips join the check.
A shop's crawl export (CSV, 1,283 pages)
Input:
{
"task": "review",
"site": "https://www.fernhollow-ceramics.example",
"total": "1283",
"sections": "/products/ | 960\n/blog/ | 266\n/collections/ | 32\n/blog | 13\n/ | 1\n/about | 1\n/care-guide | 1\n/collections | 1\n/contact | 1\n/faq | 1\n/gift-cards | 1\n/privacy | 1\n/shipping-policy | 1\n/stockists | 1\n/terms | 1\n/wholesale | 1",
"pages": "/ | home\n/about | key\n/contact | key\n/shipping-policy | legal\n/privacy | legal\n/terms | legal\n/faq | key\n/stockists | content\n/wholesale | content\n/care-guide | content\n/gift-cards | content\n/collections | hub\n/blog | hub\n/collections/mugs | content\n/collections/mugs?page=2 | archive\n/collections/bowls | content\n/collections/bowls?page=2 | archive\n/collections/plates | content\n/collections/plates?page=2 | archive\n/collections/vases | content\n/collections/vases?page=2 | archive\n/collections/jugs | content\n/collections/jugs?page=2 | archive\n/collections/planters | content\n/collections/planters?page=2 | archive\n/collections/teapots | content\n/collections/teapots?page=2 | archive\n/collections/cups | content\n/collections/cups?page=2 | archive\n/collections/platters | content\n/collections/platters?page=2 | archive\n/collections/dishes | content\n/collections/dishes?page=2 | archive\n/collections/tumblers | content\n/collections/tumblers?page=2 | archive\n/collections/pitchers | content\n/collections/pitchers?page=2 | archive\n/collections/gift-sets | content\n/collections/gift-sets?page=2 | archive\n/collections/seconds | content\n/collections/seconds?page=2 | archive\n/collections/new-in | content\n/collections/new-in?page=2 | archive\n/collections/bestsellers | content\n/collections/bestsellers?page=2 | archive\n/products/speckled-mug | content\n/products/speckled-mug-small | content\n/products/speckled-mug-large | content\n/products/speckled-mug-set-of-2 | content\n/products/speckled-mug-set-of-4 | content\n/products/speckled-bowl | content\n/products/speckled-bowl-small | content\n/products/speckled-bowl-large | content\n/products/speckled-bowl-set-of-2 | content\n/products/speckled-bowl-set-of-4 | content\n/products/speckled-plate | content\n/products/speckled-plate-small | content\n/products/speckled-plate-large | content\n/products/speckled-plate-set-of-2 | content\n/products/speckled-plate-set-of-4 | content\n/products/speckled-vase | content\n/products/speckled-vase-small | content\n/products/speckled-vase-large | content\n/products/speckled-vase-set-of-2 | content\n/products/speckled-vase-set-of-4 | content\n/products/speckled-jug | content\n/products/speckled-jug-small | content\n/products/speckled-jug-large | content\n/products/speckled-jug-set-of-2 | content\n/products/speckled-jug-set-of-4 | content\n/products/speckled-planter | content\n/products/speckled-planter-small | content\n/products/speckled-planter-large | content\n/products/speckled-planter-set-of-2 | content\n/products/speckled-planter-set-of-4 | content\n/products/speckled-teapot | content\n/products/speckled-teapot-small | content\n/products/speckled-teapot-large | content\n/products/speckled-teapot-set-of-2 | content\n/products/speckled-teapot-set-of-4 | content\n/products/speckled-cup | content\n/products/speckled-cup-small | content\n/products/speckled-cup-large | content\n/products/speckled-cup-set-of-2 | content\n/products/speckled-cup-set-of-4 | content\n/products/speckled-platter | content\n/products/speckled-platter-small | content\n/products/speckled-platter-large | content\n/products/speckled-platter-set-of-2 | content\n/products/speckled-platter-set-of-4 | content\n/products/speckled-dish | content\n/products/speckled-dish-small | content\n/products/speckled-dish-large | content\n/products/speckled-dish-set-of-2 | content\n/products/speckled-dish-set-of-4 | content\n/products/speckled-tumbler | content\n/products/speckled-tumbler-small | content\n/products/speckled-tumbler-large | content\n/products/speckled-tumbler-set-of-2 | content\n/products/speckled-tumbler-set-of-4 | content\n/products/speckled-pitcher | content\n/products/speckled-pitcher-small | content\n/products/speckled-pitcher-large | content\n/products/speckled-pitcher-set-of-2 | content\n/products/speckled-pitcher-set-of-4 | content\n/products/matte-mug | content\n/products/matte-mug-small | content\n/products/matte-mug-large | content\n/products/matte-mug-set-of-2 | content\n/products/matte-mug-set-of-4 | content\n/products/matte-bowl | content\n/products/matte-bowl-small | content\n/products/matte-bowl-large | content\n/products/matte-bowl-set-of-2 | content\n/products/matte-bowl-set-of-4 | content\n/products/matte-plate | content\n/products/matte-plate-small | content\n/products/matte-plate-large | content\n/products/matte-plate-set-of-2 | content\n/products/matte-plate-set-of-4 | content\n/products/matte-vase | content\n/products/matte-vase-small | content\n/products/matte-vase-large | content\n/products/matte-vase-set-of-2 | content\n/products/matte-vase-set-of-4 | content\n/products/matte-jug | content\n/products/matte-jug-small | content\n/products/matte-jug-large | content\n/products/matte-jug-set-of-2 | content\n/products/matte-jug-set-of-4 | content\n/products/matte-planter | content\n/products/matte-planter-small | content\n/products/matte-planter-large | content\n/products/matte-planter-set-of-2 | content\n/products/matte-planter-set-of-4 | content\n/products/matte-teapot | content\n/products/matte-teapot-small | content\n/products/matte-teapot-large | content\n/products/matte-teapot-set-of-2 | content\n/products/matte-teapot-set-of-4 | content\n/products/matte-cup | content\n/products/matte-cup-small | content\n/products/matte-cup-large | content\n/products/matte-cup-set-of-2 | content\n/products/matte-cup-set-of-4 | content\n/products/matte-platter | content\n/products/matte-platter-small | content\n/products/matte-platter-large | content\n/products/matte-platter-set-of-2 | content\n/products/matte-platter-set-of-4 | content\n/products/matte-dish | content\n/products/matte-dish-small | content\n/products/matte-dish-large | content\n/products/matte-dish-set-of-2 | content\n/products/matte-dish-set-of-4 | content\n/products/matte-tumbler | content\n/products/matte-tumbler-small | content\n/products/matte-tumbler-large | content\n/products/matte-tumbler-set-of-2 | content\n/products/matte-tumbler-set-of-4 | content\n/products/matte-pitcher | content\n/products/matte-pitcher-small | content\n/products/matte-pitcher-large | content\n/products/matte-pitcher-set-of-2 | content\n/products/matte-pitcher-set-of-4 | content\n/products/glossy-mug | content\n/products/glossy-mug-small | content\n/products/glossy-mug-large | content\n/products/glossy-mug-set-of-2 | content\n/products/glossy-mug-set-of-4 | content\n/products/glossy-bowl | content\n/products/glossy-bowl-small | content\n/products/glossy-bowl-large | content\n/products/glossy-bowl-set-of-2 | content\n/products/glossy-bowl-set-of-4 | content\n/products/glossy-plate | content\n/products/glossy-plate-small | content\n/products/glossy-plate-large | content\n/products/glossy-plate-set-of-2 | content\n/products/glossy-plate-set-of-4 | content\n/products/glossy-vase | content\n/products/glossy-vase-small | content\n/products/glossy-vase-large | content\n/products/glossy-vase-set-of-2 | content\n/products/glossy-vase-set-of-4 | content\n/products/glossy-jug | content\n/products/glossy-jug-small | content\n/products/glossy-jug-large | content\n/products/glossy-jug-set-of-2 | content\n/products/glossy-jug-set-of-4 | content\n/products/glossy-planter | content\n/products/glossy-planter-small | content\n/products/glossy-planter-large | content\n/products/glossy-planter-set-of-2 | content\n/products/glossy-planter-set-of-4 | content\n/products/glossy-teapot | content\n/products/glossy-teapot-small | content\n/products/glossy-teapot-large | content\n/products/glossy-teapot-set-of-2 | content\n/products/glossy-teapot-set-of-4 | content\n/blog/how-we-glaze-179 | content\n/blog/care-for-180 | content\n/blog/meet-the-maker-181 | content\n/blog/how-we-glaze-182 | content\n/blog/meet-the-maker-183 | content\n/blog/how-we-glaze-184 | content\n/blog/how-we-glaze-185 | content\n/blog/how-we-glaze-186 | content\n/blog/making-of-187 | content\n/blog/meet-the-maker-188 | content\n/blog/studio-notes-189 | content\n/blog/colour-story-190 | content\n/blog/meet-the-maker-191 | content\n/blog/care-for-192 | content\n/blog/studio-notes-193 | content\n/blog/how-we-glaze-194 | content\n/blog/how-we-glaze-195 | content\n/blog/colour-story-196 | content\n/blog/care-for-197 | content\n/blog/meet-the-maker-198 | content\n/blog/colour-story-199 | content\n/blog/how-we-glaze-200 | content\n/blog/making-of-201 | content\n/blog/meet-the-maker-202 | content\n/blog/colour-story-203 | content\n/blog/meet-the-maker-204 | content\n/blog/colour-story-205 | content\n/blog/care-for-206 | content\n/blog/colour-story-207 | content\n/blog/studio-notes-208 | content\n/blog/making-of-209 | content\n/blog/colour-story-210 | content\n/blog/colour-story-211 | content\n/blog/how-we-glaze-212 | content\n/blog/colour-story-213 | content\n/blog/care-for-214 | content\n/blog/care-for-215 | content\n/blog/making-of-216 | content\n/blog/care-for-217 | content\n/blog/how-we-glaze-218 | content\n/blog/studio-notes-219 | content\n/blog/making-of-220 | content\n/blog/colour-story-221 | content\n/blog/colour-story-222 | content\n/blog/studio-notes-223 | content\n/blog/colour-story-224 | content\n/blog/making-of-225 | content\n/blog/making-of-226 | content\n/blog/care-for-227 | content\n/blog/colour-story-228 | content\n/blog/making-of-229 | content\n/blog/care-for-230 | content\n/blog/kiln-diary-231 | content\n/blog/colour-story-232 | content\n/blog/care-for-233 | content\n/blog/how-we-glaze-234 | content\n/blog/studio-notes-235 | content\n/blog/care-for-236 | content\n/blog/studio-notes-237 | content\n/blog/care-for-238 | content\n/blog/kiln-diary-239 | content\n/blog/kiln-diary-240 | content\n/blog/colour-story-241 | content\n/blog/making-of-242 | content\n/blog/care-for-243 | content\n/blog/kiln-diary-244 | content\n/blog/care-for-245 | content\n/blog/how-we-glaze-246 | content\n/blog/care-for-247 | content\n/blog/studio-notes-248 | content\n/blog/studio-notes-249 | content\n/blog/making-of-250 | content\n/blog/how-we-glaze-251 | content\n/blog/colour-story-252 | content\n/blog/making-of-253 | content\n/blog/studio-notes-254 | content\n/blog/how-we-glaze-255 | content\n/blog/making-of-256 | content\n/blog/studio-notes-257 | content\n/blog/kiln-diary-258 | content\n/blog/how-we-glaze-259 | content\n/blog/how-we-glaze-260 | content\n/blog/tagged/process | archive\n/blog/tagged/studio | archive\n/blog/tagged/glazes | archive\n/blog/tagged/events | archive\n/blog/tagged/gifts | archive\n/blog/tagged/care | archive\n/blog?page=2 | archive\n/blog?page=3 | archive\n/blog?page=4 | archive\n/blog?page=5 | archive\n/blog?page=6 | archive\n/blog?page=7 | archive\n/blog?page=8 | archive\n/blog?page=9 | archive\n/blog?page=10 | archive\n/blog?page=11 | archive\n/blog?page=12 | archive\n/blog?page=13 | archive",
"left_out": "filter | 16 | /collections/mugs?sort=price-ascending\nstatus | 26 | /products/speckled-cup-small-old\nnoindex | 18 | /collections/planters/products/speckled-tumbler-large\nprivate | 2 | /cart\nsearch | 1 | /search?q=mug\nasset | 1 | /cdn/shop/files/hero-mugs.jpg",
"problems": "out.asset, out.private, out.search, out.filter, out.status, out.noindex, query.other",
"items_note": "Only 300 of 1,283 pages were sent: the first 200 and the last 100. The section counts cover all of them."
}
Reply:
{
"exclude": [
{
"path": "/collections/*?page=2",
"why": "Second pages of each collection repeat its list; the collections and products are listed directly."
},
{
"path": "/blog?page=*",
"why": "Numbered blog list pages repeat the blog list; the posts themselves are listed."
},
{
"path": "/blog/tagged/*",
"why": "Tag archives only repeat posts the blog list already shows; list the posts instead."
}
],
"sections": [
{
"name": "products",
"prefix": "/products/"
},
{
"name": "posts",
"prefix": "/blog/"
},
{
"name": "collections",
"prefix": "/collections/"
}
],
"tips": [
"Point menu and collection links at the final product addresses so the crawl stops finding redirects and errors.",
"Link products by their /products/ address, not the noindex path nested under a collection.",
"List only the sitemap index in robots.txt and submit it in Google Search Console."
]
}
On the page, the numbered collection and blog pages and the tag archives move to Left out, and the sitemap becomes an index with one file each for products, posts, collections and the remaining pages, downloaded together as a zip.
An old sitemap.xml
Input:
{
"task": "review",
"site": "http://brightline-tutoring.example",
"total": "19",
"sections": "/blog/ | 3\n/subjects/ | 3\n/tutors/ | 2\n/ | 1\n/blog | 1\n/book-a-free-lesson | 1\n/cy/ | 1\n/cy/pricing | 1\n/cy/subjects/ | 1\n/how-it-works | 1\n/pricing | 1\n/subjects | 1\n/terms | 1\n/tutors | 1",
"pages": "/ | home\n/subjects | content\n/subjects/gcse-maths | content\n/subjects/a-level-chemistry | content\n/subjects/11-plus-english | content\n/tutors | content\n/tutors/maths-tutors-in-leeds | content\n/tutors/chemistry-tutors-in-york | content\n/pricing | key\n/how-it-works | key\n/blog | hub\n/blog/revision-timetable-that-works | content\n/blog/past-papers-the-right-way | content\n/blog/author/sam | archive\n/cy/ | locale\n/cy/subjects/gcse-maths | content\n/cy/pricing | key\n/terms | legal\n/book-a-free-lesson | content",
"left_out": "private | 2 | /login\nvariant | 1 | /Pricing\nhost | 1 | http://staging.brightline-tutoring.example/pricing\nfilter | 1 | /tutors/maths-tutors-in-leeds?sort=price",
"problems": "site.http, out.host, out.private, out.filter, out.variant, lastmod.same",
"items_note": ""
}
Reply:
{
"exclude": [
{
"path": "/blog/author/sam",
"why": "An author archive that repeats posts the blog list already shows; the posts are listed."
}
],
"sections": [],
"tips": [
"Move the site to https and redirect http so every listed address answers without a redirect.",
"Give each page its real last-changed date; every page sharing one lastmod tells search engines nothing.",
"Keep the staging host out of search with a sign-in or noindex so its pages never compete with the live site."
]
}
On the page, the author archive moves to Left out and the tips join the check.
Errors
| HTTP | What to do |
|---|---|
| 401 | The token is missing, expired or a guest token on a run. Get a personal token on the token page. |
| 402 | The balance is below what the run reserves. Top up at skillsafe.ai/account/billing. |
| 400 | The body is not a JSON object of the fields above. |
| 429 | Wait 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://xml-sitemap-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"}
}import json, urllib.request
BASE = "https://api.skillsafe.ai/v1/app-api"
TOKEN = "paste-your-token-here" # from https://xml-sitemap-generator.skillsafe.ai/tokens.html
def api(method, path, body=None, headers=None):
req = urllib.request.Request(BASE + path, method=method,
data=None if body is None else json.dumps(body).encode(),
headers={"Content-Type": "application/json", **({"Authorization": "Bearer " + TOKEN} if TOKEN else {}), **(headers or {})})
with urllib.request.urlopen(req) as r:
env = json.load(r)
if env.get("error"):
raise RuntimeError(env["error"])
return env["data"]// xml-sitemap-generator.mjs -- Node 18+ (global fetch)
const BASE = "https://api.skillsafe.ai/v1/app-api";
let TOKEN = "paste-your-token-here"; // from https://xml-sitemap-generator.skillsafe.ai/tokens.html
async function api(method, path, body, headers = {}) {
const r = await fetch(BASE + path, { method, headers: { "Content-Type": "application/json",
...(TOKEN ? { Authorization: "Bearer " + TOKEN } : {}), ...headers },
body: body === undefined ? undefined : JSON.stringify(body) });
const env = await r.json();
if (env.error) throw new Error(env.error.code + ": " + env.error.message);
return env.data;
}package main
import ("bytes"; "encoding/json"; "fmt"; "net/http")
const base = "https://api.skillsafe.ai/v1/app-api"
var token = "paste-your-token-here" // from https://xml-sitemap-generator.skillsafe.ai/tokens.html
func api(method, path string, body any, headers map[string]string) (map[string]any, error) {
var buf bytes.Buffer
if body != nil { json.NewEncoder(&buf).Encode(body) }
req, _ := http.NewRequest(method, base+path, &buf)
req.Header.Set("Content-Type", "application/json")
if token != "" { req.Header.Set("Authorization", "Bearer "+token) }
for k, v := range headers { req.Header.Set(k, v) }
res, err := http.DefaultClient.Do(req)
if err != nil { return nil, err }
defer res.Body.Close()
var env struct { Data map[string]any; Error map[string]any }
json.NewDecoder(res.Body).Decode(&env)
if env.Error != nil { return nil, fmt.Errorf("%v", env.Error) }
return env.Data, nil
}// XmlSitemapGenerator.java -- Java 17+, with com.fasterxml.jackson.core:jackson-databind
import com.fasterxml.jackson.databind.*;
import java.net.URI; import java.net.http.*; import java.util.*;
public class XmlSitemapGenerator {
static final String BASE = "https://api.skillsafe.ai/v1/app-api";
static String token = "paste-your-token-here"; // from https://xml-sitemap-generator.skillsafe.ai/tokens.html
static final ObjectMapper M = new ObjectMapper();
static final HttpClient C = HttpClient.newHttpClient();
static JsonNode api(String method, String path, Object body, Map<String, String> headers) throws Exception {
var b = HttpRequest.newBuilder(URI.create(BASE + path)).header("Content-Type", "application/json");
if (!token.isEmpty()) b.header("Authorization", "Bearer " + token);
if (headers != null) headers.forEach(b::header);
b.method(method, body == null ? HttpRequest.BodyPublishers.noBody() : HttpRequest.BodyPublishers.ofString(M.writeValueAsString(body)));
JsonNode env = M.readTree(C.send(b.build(), HttpResponse.BodyHandlers.ofString()).body());
if (env.hasNonNull("error")) throw new RuntimeException(env.get("error").toString());
return env.get("data");
}
}require "json"
require "net/http"
BASE = "https://api.skillsafe.ai/v1/app-api"
TOKEN = "paste-your-token-here" # from https://xml-sitemap-generator.skillsafe.ai/tokens.html
def api(method, path, body = nil, headers = {})
uri = URI(BASE + path)
req = Net::HTTPGenericRequest.new(method, !body.nil?, true, uri.request_uri,
{ "Content-Type" => "application/json" }.merge(TOKEN.empty? ? {} : { "Authorization" => "Bearer #{TOKEN}" }).merge(headers))
req.body = JSON.generate(body) unless body.nil?
env = JSON.parse(Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |h| h.request(req) }.body)
raise env["error"].to_s if env["error"]
env["data"]
end<?php
const BASE = "https://api.skillsafe.ai/v1/app-api";
$TOKEN = "paste-your-token-here"; // from https://xml-sitemap-generator.skillsafe.ai/tokens.html
function api(string $method, string $path, $body = null, array $headers = []) {
global $TOKEN;
$h = ["Content-Type: application/json"];
if ($TOKEN) $h[] = "Authorization: Bearer $TOKEN";
foreach ($headers as $k => $v) $h[] = "$k: $v";
$ch = curl_init(BASE . $path);
curl_setopt_array($ch, [CURLOPT_CUSTOMREQUEST => $method, CURLOPT_HTTPHEADER => $h, CURLOPT_RETURNTRANSFER => true]);
if ($body !== null) curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body));
$env = json_decode(curl_exec($ch), true);
if (!empty($env["error"])) throw new Exception(json_encode($env["error"]));
return $env["data"];
}// Program.cs -- .NET 6+ console app
using System.Net.Http.Json; using System.Text.Json; using System.Text.Json.Nodes;
static class Api {
public const string Base = "https://api.skillsafe.ai/v1/app-api";
public static string Token = "paste-your-token-here"; // from https://xml-sitemap-generator.skillsafe.ai/tokens.html
static readonly HttpClient C = new();
public static async Task<JsonNode?> Call(string method, string path, object? body = null, Dictionary<string, string>? headers = null) {
var req = new HttpRequestMessage(new HttpMethod(method), Base + path);
if (Token != "") req.Headers.Add("Authorization", "Bearer " + Token);
if (headers != null) foreach (var h in headers) req.Headers.Add(h.Key, h.Value);
if (body != null) req.Content = JsonContent.Create(body);
var env = JsonNode.Parse(await (await C.SendAsync(req)).Content.ReadAsStringAsync())!;
if (env["error"] is JsonNode e && e.GetValueKind() != JsonValueKind.Null) throw new Exception(e.ToJsonString());
return env["data"];
}
}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":"xml-sitemap-generator"}' | jq -r '.data.token')# a guest token (enough for /me and /estimate); a run needs your personal token from /tokens.html
TOKEN = ""
TOKEN = api("POST", "/guest", {"slug": "xml-sitemap-generator"})["token"]// a guest token (enough for /me and /estimate); a run needs your personal token from /tokens.html
TOKEN = "";
TOKEN = (await api("POST", "/guest", { slug: "xml-sitemap-generator" })).token;// inside main: a guest token (enough for /me and /estimate); a run needs your personal token
token = ""
g, err := api("POST", "/guest", map[string]string{"slug": "xml-sitemap-generator"}, nil)
if err != nil { panic(err) }
token = g["token"].(string)// inside main: a guest token (enough for /me and /estimate); a run needs your personal token
token = "";
token = api("POST", "/guest", Map.of("slug", "xml-sitemap-generator"), null).get("token").asText();# a guest token (enough for /me and /estimate); a run needs your personal token from /tokens.html
TOKEN.replace("")
TOKEN.replace(api("POST", "/guest", { slug: "xml-sitemap-generator" })["token"])// a guest token (enough for /me and /estimate); a run needs your personal token from /tokens.html
$TOKEN = "";
$TOKEN = api("POST", "/guest", ["slug" => "xml-sitemap-generator"])["token"];// a guest token (enough for /me and /estimate); a run needs your personal token from /tokens.html
Api.Token = "";
Api.Token = (await Api.Call("POST", "/guest", new { slug = "xml-sitemap-generator" }))!["token"]!.GetValue<string>();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}' me = api("GET", "/me")
print(me["subject_type"], me.get("credits"))const me = await api("GET", "/me");
console.log(me.subject_type, me.credits);me, _ := api("GET", "/me", nil, nil)
fmt.Println(me["subject_type"], me["credits"])JsonNode me = api("GET", "/me", null, null);
System.out.println(me.get("subject_type") + " " + me.get("credits"));me = api("GET", "/me")
puts [me["subject_type"], me["credits"]].inspect$me = api("GET", "/me");
echo $me["subject_type"], " ", $me["credits"] ?? "", "\n";var me = await Api.Call("GET", "/me");
Console.WriteLine($"{me!["subject_type"]} {me["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": "review", "site": "https://www.saltmarsh-kitchen.example", "total": "21", "sections": "/recipes/ | 10\n/guides/ | 2\n/tag/ | 2\n/ | 1\n/about | 1\n/contact | 1\n/guides | 1\n/privacy | 1\n/recipes | 1\n/thank-you | 1", "pages": "/ | home\n/recipes | hub\n/recipes/sourdough-starter-in-seven-days | content\n/recipes/brown-butter-oat-cookies | content\n/recipes/one-pan-lemon-chicken | content\n/recipes/miso-glazed-aubergine | content\n/recipes/weeknight-dal | content\n/recipes/rhubarb-crumble | content\n/recipes/Fish-Pie | content\n/guides | hub\n/guides/how-to-feed-a-starter | content\n/guides/knife-skills-for-beginners | content\n/tag/vegetarian | archive\n/tag/baking | archive\n/recipes/page/2 | archive\n/about | key\n/contact | key\n/privacy | legal\n/thank-you | content\n/recipes/spring-pea-risotto | content\n/recipes/hot-cross-buns | content", "left_out": "variant | 1 | /recipes/weeknight-dal/\ndup | 2 | /recipes/rhubarb-crumble\nsearch | 1 | /?s=lemon\nprivate | 1 | /wp-admin/\nasset | 2 | /wp-content/uploads/2025/11/starter-day-3.jpg\nhost | 1 | https://saltmarsh-kitchen.example/recipes/fish-pie\nscheme | 1 | mailto:hello@saltmarsh-kitchen.example", "problems": "out.scheme, out.host, out.asset, out.private, out.search, out.dup, out.variant, host.www, proto.http, query.tracking, lastmod.future", "items_note": ""}
api POST /estimate "$(cat input.json)" | jq '.data | {hold_credits, min_credits, model, model_alias, markup_bps, warnings}' inp = json.load(open("input.json")) # {"task": "review", "site": "https://www.saltmarsh-kitchen.example", "total": "21", "sections": "/recipes/ | 10\n/guides/ | 2\n/tag/ | 2\n/ | 1\n/about | 1\n/contact | 1\n/guides | 1\n/privacy | 1\n/recipes | 1\n/thank-you | 1", "pages": "/ | home\n/recipes | hub\n/recipes/sourdough-starter-in-seven-days | content\n/recipes/brown-butter-oat-cookies | content\n/recipes/one-pan-lemon-chicken | content\n/recipes/miso-glazed-aubergine | content\n/recipes/weeknight-dal | content\n/recipes/rhubarb-crumble | content\n/recipes/Fish-Pie | content\n/guides | hub\n/guides/how-to-feed-a-starter | content\n/guides/knife-skills-for-beginners | content\n/tag/vegetarian | archive\n/tag/baking | archive\n/recipes/page/2 | archive\n/about | key\n/contact | key\n/privacy | legal\n/thank-you | content\n/recipes/spring-pea-risotto | content\n/recipes/hot-cross-buns | content", "left_out": "variant | 1 | /recipes/weeknight-dal/\ndup | 2 | /recipes/rhubarb-crumble\nsearch | 1 | /?s=lemon\nprivate | 1 | /wp-admin/\nasset | 2 | /wp-content/uploads/2025/11/starter-day-3.jpg\nhost | 1 | https://saltmarsh-kitchen.example/recipes/fish-pie\nscheme | 1 | mailto:hello@saltmarsh-kitchen.example", "problems": "out.scheme, out.host, out.asset, out.private, out.search, out.dup, out.variant, host.www, proto.http, query.tracking, lastmod.future", "items_note": ""}
est = api("POST", "/estimate", inp)
print(est["hold_credits"], est["min_credits"], est["model"], est.get("warnings"))import { readFileSync } from "node:fs";
const input = JSON.parse(readFileSync("input.json", "utf8")); // {task, site, total, sections, pages, left_out, problems, items_note}
const est = await api("POST", "/estimate", input);
console.log(est.hold_credits, est.min_credits, est.model, est.warnings);raw, _ := os.ReadFile("input.json") // add "os" to the imports
var input map[string]any
json.Unmarshal(raw, &input)
est, _ := api("POST", "/estimate", input, nil)
fmt.Println(est["hold_credits"], est["min_credits"], est["model"])Map<String, Object> input = M.readValue(new java.io.File("input.json"), Map.class);
JsonNode est = api("POST", "/estimate", input, null);
System.out.println(est.get("hold_credits") + " " + est.get("min_credits") + " " + est.get("model"));input = JSON.parse(File.read("input.json"))
est = api("POST", "/estimate", input)
puts [est["hold_credits"], est["min_credits"], est["model"]].inspect$input = json_decode(file_get_contents("input.json"), true);
$est = api("POST", "/estimate", $input);
echo $est["hold_credits"], " ", $est["min_credits"], " ", $est["model"], "\n";var input = JsonNode.Parse(File.ReadAllText("input.json"))!;
var est = await Api.Call("POST", "/estimate", input);
Console.WriteLine($"{est!["hold_credits"]} {est["min_credits"]} {est["model"]}");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="xml-sitemap-generator:review:$(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: exclude, sections, tips
echo "$J" | jq '.data | {charged_credits, truncated}' import hashlib, time
key = "xml-sitemap-generator:" + inp["task"] + ":" + hashlib.sha256(json.dumps(inp).encode()).hexdigest()[:16] + ":a1"
job = api("POST", "/run", inp, {"Idempotency-Key": key})
while True:
j = api("GET", "/jobs/" + job["job_id"])
if j["status"] in ("succeeded", "failed", "cancelled"):
break
time.sleep(2)
reply = json.loads(j["output"]["output"]) # {exclude, sections, tips}
print(j["charged_credits"], j.get("truncated"), reply.get("exclude"))import { createHash } from "node:crypto";
const key = `xml-sitemap-generator:${input.task}:${createHash("sha256").update(JSON.stringify(input)).digest("hex").slice(0, 16)}:a1`;
const job = await api("POST", "/run", input, { "Idempotency-Key": key });
let j;
do { await new Promise((r) => setTimeout(r, 2000)); j = await api("GET", "/jobs/" + job.job_id); }
while (!["succeeded", "failed", "cancelled"].includes(j.status));
const reply = JSON.parse(j.output.output);
console.log(j.charged_credits, j.truncated, reply.exclude);sum := sha256.Sum256(raw) // add "crypto/sha256", "encoding/hex", "time" to the imports
key := "xml-sitemap-generator:" + input["task"].(string) + ":" + hex.EncodeToString(sum[:8]) + ":a1"
job, _ := api("POST", "/run", input, map[string]string{"Idempotency-Key": key})
var j map[string]any
for {
time.Sleep(2 * time.Second)
j, _ = api("GET", "/jobs/"+job["job_id"].(string), nil, nil)
if s := j["status"]; s == "succeeded" || s == "failed" || s == "cancelled" { break }
}
fmt.Println(j["charged_credits"], j["truncated"], j["output"].(map[string]any)["output"])var digest = java.security.MessageDigest.getInstance("SHA-256").digest(M.writeValueAsBytes(input));
String key = "xml-sitemap-generator:" + input.get("task") + ":" + HexFormat.of().formatHex(digest, 0, 8) + ":a1";
JsonNode job = api("POST", "/run", input, Map.of("Idempotency-Key", key)), j;
do { Thread.sleep(2000); j = api("GET", "/jobs/" + job.get("job_id").asText(), null, null); }
while (!Set.of("succeeded", "failed", "cancelled").contains(j.get("status").asText()));
JsonNode reply = M.readTree(j.get("output").get("output").asText());
System.out.println(j.get("charged_credits") + " " + reply);require "digest"
key = "xml-sitemap-generator:#{input["task"]}:#{Digest::SHA256.hexdigest(JSON.generate(input))[0, 16]}:a1"
job = api("POST", "/run", input, { "Idempotency-Key" => key })
j = nil
loop do
sleep 2
j = api("GET", "/jobs/#{job["job_id"]}")
break if %w[succeeded failed cancelled].include?(j["status"])
end
reply = JSON.parse(j["output"]["output"])
puts [j["charged_credits"], j["truncated"], reply["exclude"]].inspect$key = "xml-sitemap-generator:" . $input["task"] . ":" . substr(hash("sha256", json_encode($input)), 0, 16) . ":a1";
$job = api("POST", "/run", $input, ["Idempotency-Key" => $key]);
do { sleep(2); $j = api("GET", "/jobs/" . $job["job_id"]); }
while (!in_array($j["status"], ["succeeded", "failed", "cancelled"]));
$reply = json_decode($j["output"]["output"], true);
echo $j["charged_credits"], " ", $reply["exclude"], "\n";var digest = System.Security.Cryptography.SHA256.HashData(System.Text.Encoding.UTF8.GetBytes(input.ToJsonString()));
var key = $"xml-sitemap-generator:{input["task"]}:{Convert.ToHexString(digest, 0, 8).ToLowerInvariant()}:a1";
var job = await Api.Call("POST", "/run", input, new() { ["Idempotency-Key"] = key });
JsonNode j;
do { await Task.Delay(2000); j = (await Api.Call("GET", "/jobs/" + job!["job_id"]))!; }
while (!new[] { "succeeded", "failed", "cancelled" }.Contains(j["status"]!.GetValue<string>()));
var reply = JsonNode.Parse(j["output"]!["output"]!.GetValue<string>());
Console.WriteLine($"{j["charged_credits"]} {reply}");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: xml-sitemap-generator:review:$(shasum -a 256 input.json | cut -c1-16):a1" --data @input.jsonrin = json.load(open("input.json")) # {"task": "review", "site": "https://www.saltmarsh-kitchen.example", "total": "21", "sections": "/recipes/ | 10\n/guides/ | 2\n/tag/ | 2\n/ | 1\n/about | 1\n/contact | 1\n/guides | 1\n/privacy | 1\n/recipes | 1\n/thank-you | 1", "pages": "/ | home\n/recipes | hub\n/recipes/sourdough-starter-in-seven-days | content\n/recipes/brown-butter-oat-cookies | content\n/recipes/one-pan-lemon-chicken | content\n/recipes/miso-glazed-aubergine | content\n/recipes/weeknight-dal | content\n/recipes/rhubarb-crumble | content\n/recipes/Fish-Pie | content\n/guides | hub\n/guides/how-to-feed-a-starter | content\n/guides/knife-skills-for-beginners | content\n/tag/vegetarian | archive\n/tag/baking | archive\n/recipes/page/2 | archive\n/about | key\n/contact | key\n/privacy | legal\n/thank-you | content\n/recipes/spring-pea-risotto | content\n/recipes/hot-cross-buns | content", "left_out": "variant | 1 | /recipes/weeknight-dal/\ndup | 2 | /recipes/rhubarb-crumble\nsearch | 1 | /?s=lemon\nprivate | 1 | /wp-admin/\nasset | 2 | /wp-content/uploads/2025/11/starter-day-3.jpg\nhost | 1 | https://saltmarsh-kitchen.example/recipes/fish-pie\nscheme | 1 | mailto:hello@saltmarsh-kitchen.example", "problems": "out.scheme, out.host, out.asset, out.private, out.search, out.dup, out.variant, host.www, proto.http, query.tracking, lastmod.future", "items_note": ""}
req = urllib.request.Request(BASE + "/run-stream", method="POST", data=json.dumps(rin).encode(),
headers={"Content-Type": "application/json", "Authorization": "Bearer " + TOKEN,
"Idempotency-Key": "xml-sitemap-generator:review:" + hashlib.sha256(json.dumps(rin).encode()).hexdigest()[:16] + ":a1"})
with urllib.request.urlopen(req) as r:
for line in r:
line = line.decode().strip()
if line.startswith("data:"):
print(line[5:].strip()[:200])const rin = JSON.parse(readFileSync("input.json", "utf8"));
const r = await fetch(BASE + "/run-stream", { method: "POST", body: JSON.stringify(rin), headers: {
"Content-Type": "application/json", Authorization: "Bearer " + TOKEN,
"Idempotency-Key": `xml-sitemap-generator:review:${createHash("sha256").update(JSON.stringify(rin)).digest("hex").slice(0, 16)}:a1` } });
const dec = new TextDecoder();
for await (const chunk of r.body) for (const line of dec.decode(chunk).split("\n"))
if (line.startsWith("data:")) console.log(line.slice(5).trim().slice(0, 200));rraw, _ := os.ReadFile("input.json") // add "bufio", "strings" to the imports
rs := sha256.Sum256(rraw)
req, _ := http.NewRequest("POST", base+"/run-stream", bytes.NewReader(rraw))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer "+token)
req.Header.Set("Idempotency-Key", "xml-sitemap-generator:review:"+hex.EncodeToString(rs[:8])+":a1")
res, _ := http.DefaultClient.Do(req)
sc := bufio.NewScanner(res.Body)
for sc.Scan() { if l := sc.Text(); strings.HasPrefix(l, "data:") { fmt.Println(l[5:]) } }String rin = java.nio.file.Files.readString(java.nio.file.Path.of("input.json"));
var rd = java.security.MessageDigest.getInstance("SHA-256").digest(rin.getBytes());
var sreq = HttpRequest.newBuilder(URI.create(BASE + "/run-stream")).header("Content-Type", "application/json")
.header("Authorization", "Bearer " + token).header("Idempotency-Key", "xml-sitemap-generator:review:" + HexFormat.of().formatHex(rd, 0, 8) + ":a1")
.POST(HttpRequest.BodyPublishers.ofString(rin)).build();
C.send(sreq, HttpResponse.BodyHandlers.ofLines()).body().filter(l -> l.startsWith("data:")).forEach(System.out::println);rin = File.read("input.json")
uri = URI(BASE + "/run-stream")
req = Net::HTTP::Post.new(uri, "Content-Type" => "application/json", "Authorization" => "Bearer #{TOKEN}",
"Idempotency-Key" => "xml-sitemap-generator:review:#{Digest::SHA256.hexdigest(rin)[0, 16]}:a1")
req.body = rin
Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |h|
h.request(req) { |res| res.read_body { |chunk| chunk.each_line { |l| puts l if l.start_with?("data:") } } }
end$rin = file_get_contents("input.json");
$ch = curl_init(BASE . "/run-stream");
curl_setopt_array($ch, [CURLOPT_POST => true, CURLOPT_POSTFIELDS => $rin, CURLOPT_HTTPHEADER => [
"Content-Type: application/json", "Authorization: Bearer $TOKEN",
"Idempotency-Key: xml-sitemap-generator:review:" . substr(hash("sha256", $rin), 0, 16) . ":a1"],
CURLOPT_WRITEFUNCTION => function ($ch, $chunk) { foreach (explode("\n", $chunk) as $l) if (str_starts_with($l, "data:")) echo $l, "\n"; return strlen($chunk); }]);
curl_exec($ch);var rin = File.ReadAllText("input.json");
var rd = System.Security.Cryptography.SHA256.HashData(System.Text.Encoding.UTF8.GetBytes(rin));
var sreq = new HttpRequestMessage(HttpMethod.Post, Api.Base + "/run-stream") { Content = new StringContent(rin, System.Text.Encoding.UTF8, "application/json") };
sreq.Headers.Add("Authorization", "Bearer " + Api.Token);
sreq.Headers.Add("Idempotency-Key", $"xml-sitemap-generator:review:{Convert.ToHexString(rd, 0, 8).ToLowerInvariant()}:a1");
using var http = new HttpClient();
using var res = await http.SendAsync(sreq, HttpCompletionOption.ResponseHeadersRead);
using var rdr = new StreamReader(await res.Content.ReadAsStreamAsync());
for (string? l; (l = await rdr.ReadLineAsync()) != null;) if (l.StartsWith("data:")) Console.WriteLine(l);