Contents
API and MCP
Plan, write, approve and publish articles, and read analytics, AI visibility and the site health fix plan, from your scripts and AI agents. Included in Growth and Agency; read-only during the free trial.
https://searchlark.com/api/v1Authentication
Create a key under Workspace settings, API and MCP. Keys are shown once, can be read-only or read/write, and can be revoked at any time. Send the key as a bearer token on every request.
Keys start with sl_live_. Keys created before Oct 16, 2026 start with kst_live_ and keep working; you don't need to replace them.
curl https://searchlark.com/api/v1/sites \
-H "Authorization: Bearer sl_live_…"{
"data": [{
"id": "site_7Hq2…",
"name": "Harbour Bakery",
"url": "https://harbourbakery.example"
}]
}Response shape is illustrative. The OpenAPI schema is the reference.
Errors and limits
Errors share one shape: an error object with a machine-readable code and a sentence you can show a person. Each key can make 120 requests a minute.
| Status | Meaning |
|---|---|
| 400 | The body isn't valid JSON (invalid_json) |
| 401 | Missing, wrong or revoked key (unauthorized) |
| 402 | The plan doesn't allow it right now (plan_limit): for example the articles this period are used, or the trial has ended |
| 403 | The plan doesn't include this call (plan_required: no API on Starter, read-only during the trial), or the key lacks the write scope (insufficient_scope) |
| 404 | Not found, or not in this workspace. Unknown paths also answer 404 (not_found) |
| 405 | Method not supported for this path (method_not_allowed). The Allow header lists the ones that are |
| 409 | Wrong state, for example approving an article that is not in review |
| 422 | Invalid body or query. The message names each field; details lists them |
| 429 | Over 120 requests a minute for this key (rate_limited), a site health problem re-checked less than 10 minutes ago (rate_limited), or 500 jobs already waiting for this workspace (queue_full) |
| 500 | Something failed on our side (internal). Retry later; tell us if it persists |
| 503 | Searchlark is busy. Wait for the Retry-After header, then send the same request again |
{
"error": {
"code": "…",
"message": "…"
}
}Endpoints
Base path /api/v1. Full schema: OpenAPI 3.1.
The article list comes in pages of up to 200 (limit, default 200). When more remain, the response has a next_cursor; pass it back as cursor until it is null.
- GET
/sitesList sites - GET
/sites/{siteId}/keywordsTop keyword opportunities (?limit=) - GET
/sites/{siteId}/contentList articles, paged (?status=&limit=&cursor=) - POST
/sites/{siteId}/contentPlan an article for a keyword - GET
/content/{id}Article, current draft, publication - POST
/content/{id}/generateWrite the draft (returns a job id) - POST
/content/{id}/approveApprove a draft in review - POST
/content/{id}/publishPublish now (returns a job id) - GET
/jobs/{id}Job status - GET
/sites/{siteId}/analyticsSearch Console summary - GET
/sites/{siteId}/ai-visibilityAI mention rates per engine - GET
/sites/{siteId}/health/planSite health fix plan, biggest wins first (?limit=) - GET
/sites/{siteId}/health/problems/{problemId}One problem: its pages, steps and an agent prompt - POST
/sites/{siteId}/health/problems/{problemId}/recheckRe-check a problem's pages (returns a job id) - GET
/sites/{siteId}/journeysJourneys overview: visits, goals, pages, sources (?days=) - GET
/sites/{siteId}/journeys/dropoffsBiggest drop-offs, ranked by visits lost (?days=) - GET
/sites/{siteId}/journeys/pageHow visitors use one page (?path=)
Write and publish an article
- Plan it. Post a keyword to the site's content list. You get an article id back.
- Write it. Ask for a draft. Writing runs in the background and returns a job id.
- Wait for the job. Poll the job until it finishes. The draft then waits in review.
- Approve and publish. Approve the draft, then publish it to the site's connected CMS.
# 1. plan
curl -X POST $BASE/sites/$SITE/content \
-H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d '{"keyword":"wedding cake order timeline"}'
# 2. write (returns a job id)
curl -X POST $BASE/content/$ID/generate -H …
# 3. wait
curl $BASE/jobs/$JOB -H …
# 4. approve, then publish
curl -X POST $BASE/content/$ID/approve -H …
curl -X POST $BASE/content/$ID/publish -H …Optional fields when planning: title, content_type and scheduled_for (a date like 2026-11-02). The OpenAPI schema lists every field.
Webhook signatures
A site that publishes through a webhook gets a signing secret when you connect it. Every request carries an X-Searchlark-Signature header: t=<unix seconds>,v1=<hex HMAC-SHA256 of "t.body">. Recompute the HMAC over the raw body, compare it in constant time, and reject timestamps more than five minutes old.
The Idempotency-Key header is the same for every delivery and update of one article: create the post the first time, update it afterwards. What to build, every payload field, what to answer and starter receivers are in Publish with a webhook.
POST https://yoursite.com/hooks/searchlark
Content-Type: application/json
X-Searchlark-Signature: t=1760600000,v1=5f2c…
Idempotency-Key: 7a1e…
X-Searchlark-Delivery: 0c4b…
{"event":"article.publish","data":{…}}import { createHmac, timingSafeEqual } from "node:crypto";
// header = request.headers["x-searchlark-signature"]
// body = the raw request body, before JSON parsing
export function verify(secret, body, header) {
const parts = Object.fromEntries(
header.split(",").map((p) => p.trim().split("=", 2)),
);
const t = Number(parts.t);
if (!parts.v1 || Math.abs(Date.now() / 1000 - t) > 300) return false;
const mac = createHmac("sha256", secret).update(`${t}.${body}`).digest("hex");
return (
mac.length === parts.v1.length &&
timingSafeEqual(Buffer.from(mac), Buffer.from(parts.v1))
);
}Connect an agent
The same operations are MCP tools. Most apps connect to the hosted server by signing in (OAuth): https://searchlark.com/mcp. Step-by-step setup for Claude, ChatGPT, Cursor, VS Code and your own agents is in Connect AI apps. OAuth access tokens also work on this API as bearer tokens.
To run the server on your computer with an API key instead, download one file that runs with Node.js 20 or later and add it to your client's config.
The server reads SEARCHLARK_API_KEY and, optionally, SEARCHLARK_API_BASE. Configs that still use the older KESTREL_API_KEY, KESTREL_API_BASE and KESTREL_API_URL names keep working.
{
"mcpServers": {
"searchlark": {
"command": "node",
"args": ["/path/to/searchlark-mcp.mjs"],
"env": {
"SEARCHLARK_API_KEY": "sl_live_…",
"SEARCHLARK_API_BASE": "https://searchlark.com"
}
}
}
}Tools
17 tools, one per API operation. Use a read-only key if the agent should only look.
Two prompts hand site health work to a coding agent in your site's repository: fix_health_problem (one problem, ending with a re-check) and fix_health_plan (the plan, one problem at a time). Claude Code lists them as slash commands.
list_sitesSites in the workspacelist_keywordsKeyword opportunitieslist_articlesArticles, by status, 200 per pagecreate_articlePlan an articlewritegenerate_articleWrite the draftwriteget_jobJob statusget_articleArticle and draftapprove_articleApprove a draftwritepublish_articlePublish nowwriteget_analyticsSearch Console summaryget_ai_visibilityAI mention ratesget_health_planSite health fix planget_health_problemOne problem, with an agent promptrecheck_health_problemRe-check a problem's pageswriteget_journeysJourneys overviewget_journey_dropoffsWhere visitors drop offget_journey_pageHow visitors use one page
“Plan an article on month-end close checklists for my site, write it, show me the draft, and publish it if the fact-check is clean.”