REST API
The live OpenAPI docs are available on your running Synth deployment:
https://synth.example.com/api/docs
This page shows the calls most users need.
Set your deployment URL once before running the examples:
export SYNTH_URL=https://synth.example.com
Auth
On a fresh install, create the first admin account and save its session cookie:
curl -c /tmp/synth.cookie -X POST $SYNTH_URL/api/auth/setup \
-F username=admin \
-F password='Admin12345!' \
-F display_name=Admin
Create an API key with that saved admin session cookie:
SYNTH_API_KEY=$(curl -s -b /tmp/synth.cookie \
-H "Content-Type: application/json" \
-d '{"name":"docs-key","scopes":["knowledge:read","ingest:write"]}' \
$SYNTH_URL/api/auth/api-keys | jq -r .key)
Use it:
Authorization: Bearer synth_sk_REPLACE_ME
The examples below use a scoped API key for knowledge, ingest, and watcher calls. Project creation uses the admin session cookie from setup.
Projects
Create a project:
curl -b /tmp/synth.cookie \
-H "Content-Type: application/json" \
-d '{"name":"docs","backend_type":"local"}' \
$SYNTH_URL/api/projects/
Set a reusable project path from the active project:
PROJECT_PATH=$(curl -s -b /tmp/synth.cookie \
$SYNTH_URL/api/projects/active | jq -r .path)
Set active project:
curl -b /tmp/synth.cookie -X PUT \
-H "Content-Type: application/json" \
-d "{\"project_path\":\"$PROJECT_PATH\"}" \
$SYNTH_URL/api/projects/active
Create a Git-backed project:
curl -X POST $SYNTH_URL/api/projects/ \
-b /tmp/synth.cookie \
-H "Content-Type: application/json" \
-d '{
"name": "backend-api",
"backend_type": "git",
"backend_config": {
"remote_url": "https://github.com/your-org/synth-knowledge.git",
"update_method": "pullRequest",
"target_branch": "$default",
"project_subdir": "projects/backend-api",
"credential_id": "github-write-token",
"auto_merge": false
},
"import_existing": false
}'
update_method is required for new Git configuration and accepts exactly
pullRequest, direct, or branch. Set import_existing to true only when
the configured folder already contains a Synth Project that should be read
during this create request. It is an action, not a stored backend setting.
Inspect the safe backend configuration, operational control, and latest update state:
curl -b /tmp/synth.cookie \
"$SYNTH_URL/api/projects/backend-api/backend"
Change how the Project updates its repository. Set sync_now to true only
when the remote Project files should be pulled immediately after saving:
curl -X PUT -b /tmp/synth.cookie \
-H "Content-Type: application/json" \
-d '{
"backend_type": "git",
"backend_config": {
"remote_url": "https://github.com/your-org/synth-knowledge.git",
"update_method": "direct",
"target_branch": "main",
"project_subdir": "projects/backend-api",
"credential_id": "github-write-token"
},
"sync_now": false
}' \
"$SYNTH_URL/api/projects/backend-api/backend"
Run one repository update now. This works even when background updates are paused:
curl -X POST -b /tmp/synth.cookie \
-H "Content-Type: application/json" \
-d '{"message":"docs: update backend API knowledge"}' \
"$SYNTH_URL/api/projects/backend-api/backend/update"
Pause and resume background repository updates without changing the stored method:
curl -X POST -b /tmp/synth.cookie \
-H "Content-Type: application/json" \
-d '{"reason":"Repository maintenance"}' \
"$SYNTH_URL/api/projects/backend-api/backend/pause"
curl -X POST -b /tmp/synth.cookie \
-H "Content-Type: application/json" \
-d '{"reason":"Maintenance complete"}' \
"$SYNTH_URL/api/projects/backend-api/backend/resume"
See Remote Git Backends for method selection, protected branches, GitHub/GitLab Enterprise setup, status meanings, and troubleshooting.
Ingest
URL:
curl -H "Authorization: Bearer $SYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d "{\"url\":\"https://modelcontextprotocol.io/introduction\",\"project_path\":\"$PROJECT_PATH\"}" \
$SYNTH_URL/ingest/api/url
File:
curl -H "Authorization: Bearer $SYNTH_API_KEY" \
-F "project_path=$PROJECT_PATH" \
-F "file=@README.md" \
$SYNTH_URL/ingest/api/file
Git:
curl -H "Authorization: Bearer $SYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d "{\"url\":\"https://github.com/modelcontextprotocol/modelcontextprotocol\",\"project_path\":\"$PROJECT_PATH\",\"branch\":\"main\"}" \
$SYNTH_URL/ingest/api/git
GitLab uses the same endpoint:
curl -H "Authorization: Bearer $SYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d "{\"url\":\"https://gitlab.com/your-group/your-project\",\"project_path\":\"$PROJECT_PATH\",\"branch\":\"main\",\"credential_id\":\"gitlab-read-token\"}" \
$SYNTH_URL/ingest/api/git
Poll:
curl -H "Authorization: Bearer $SYNTH_API_KEY" \
"$SYNTH_URL/ingest/api/status/$JOB_ID?project_path=$PROJECT_PATH"
OKF-Native Knowledge Bundles
Synth is OKF-native for project knowledge. The API preserves existing v0.1 Projects and supports the current v0.2 specification, including version-aware validation, safe supporting assets, explicit conversion, and activated Search snapshots after import.
Status:
curl -H "Authorization: Bearer $SYNTH_API_KEY" \
"$SYNTH_URL/api/projects/okf/status?project_path=$PROJECT_PATH"
Validate OKF readiness:
curl -H "Authorization: Bearer $SYNTH_API_KEY" \
"$SYNTH_URL/api/projects/okf/status?validate=true&project_path=$PROJECT_PATH"
Validate a ZIP:
curl -H "Authorization: Bearer $SYNTH_API_KEY" \
-F "project_path=$PROJECT_PATH" \
-F "file=@bundle.zip" \
$SYNTH_URL/api/projects/okf/validate
Start export:
curl -H "Authorization: Bearer $SYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d "{\"project_path\":\"$PROJECT_PATH\"}" \
$SYNTH_URL/api/projects/okf/export
Export preserves the Project's declared version by default. To create a v0.2
artifact without migrating the Project, include "target_version":"0.2" in
the JSON body.
Preview import before mutation:
curl -H "Authorization: Bearer $SYNTH_API_KEY" \
-F "project_path=$PROJECT_PATH" \
-F "file=@bundle.zip" \
$SYNTH_URL/api/projects/okf/import/validate
Apply import:
curl -H "Authorization: Bearer $SYNTH_API_KEY" \
-F "project_path=$PROJECT_PATH" \
-F "file=@bundle.zip" \
-F "overwrite=false" \
$SYNTH_URL/api/projects/okf/import/apply
Export and validation require project viewer access with read scope. Import
requires project editor access with full_access, ingest:write, or
knowledge:write. The API intentionally does not expose remote OKF publish or
OKF-specific MCP controls. Import preserves the target Project's version;
Project migration is an explicit server-operator CLI action.
Canonical Project Search And Exact Read
Search one stable Project ID:
curl -H "Authorization: Bearer $SYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{"project_id":"'$PROJECT_ID'","query":"MCP protocol","limit":5}' \
"$SYNTH_URL/api/v1/projects/$PROJECT_ID/search"
Read an exact returned page revision:
curl -H "Authorization: Bearer $SYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{"project_id":"'$PROJECT_ID'","page":"'$PAGE_ID'","expected_snapshot_id":"'$SNAPSHOT_ID'","expected_revision":"'$REVISION'"}' \
"$SYNTH_URL/api/v1/projects/$PROJECT_ID/pages/read"
Graph
Graph data:
curl -H "Authorization: Bearer $SYNTH_API_KEY" \
"$SYNTH_URL/api/graph/data?project_path=$PROJECT_PATH"
Graph stats:
curl -H "Authorization: Bearer $SYNTH_API_KEY" \
"$SYNTH_URL/api/graph/stats?project_path=$PROJECT_PATH"
Watchers
Watcher mutations require an API key with watchers:manage (or full_access)
and editor access to the target project. Watcher reads require
knowledge:read, repo_context:read, or full_access and viewer access. Use
the web Watchers screen first if you are still tuning file rules.
curl -H "Authorization: Bearer $SYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d "{\"watcher_type\":\"git\",\"watcher_id\":\"docs\",\"config\":{\"git_url\":\"https://github.com/modelcontextprotocol/modelcontextprotocol\",\"branch\":\"main\",\"poll_interval\":60,\"files\":{\"rules\":[{\"name\":\"docs\",\"include\":[\"**/*.{md,mdx,rst,txt,markdown,yml,yaml,tf,tfvars}\",\"**/*.tf.json\"],\"exclude\":[\"**/reports/**\"]}]},\"project_path\":\"$PROJECT_PATH\"}}" \
$SYNTH_URL/api/watchers
Create a GitLab group watcher, including nested subgroups:
curl -H "Authorization: Bearer $SYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d "{\"watcher_type\":\"git\",\"watcher_id\":\"platform-group\",\"credential_id\":\"gitlab-read-token\",\"config\":{\"provider\":\"gitlab\",\"org_url\":\"https://gitlab.com/acme/platform\",\"include_subgroups\":true,\"include_archived\":false,\"include_shared\":false,\"branch\":\"main\",\"poll_interval\":60,\"auto_start\":true,\"project_path\":\"$PROJECT_PATH\"}}" \
$SYNTH_URL/api/watchers
auto_start belongs inside config and controls restart behavior. auto_sync
controls whether scheduled source checks automatically apply detected changes;
both default to true when omitted. With auto_sync: false, a running watcher
continues read-only checks and reports pending differences for manual Sync. The
web UI presents the out_of_sync contract state as Changes pending; API
clients should continue to use the stable state ID instead of parsing display
text.
Preview Git watcher file rules without creating a watcher:
curl -H "Authorization: Bearer $SYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{"watcher_type":"git","config":{"repo_path":"/var/lib/synth/imports/docs-repo","files":{"rules":[{"name":"docs","include":["docs/**/*.{md,mdx,txt,yml,yaml,tf,tfvars}","docs/**/*.tf.json"],"exclude":["docs/**/reports/**"]}]}}}' \
$SYNTH_URL/api/watchers/preview-files
Preview responses include included, excluded, and ignored samples with the exact include or exclude pattern that produced the decision.
Preview Jira watcher scope without creating a watcher:
curl -H "Authorization: Bearer $SYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{"site_url":"https://example.atlassian.net","credential_id":"jira-prod","jql":"updated >= -30d ORDER BY updated DESC"}' \
$SYNTH_URL/api/watchers/preview-jira
Create a Jira watcher:
curl -H "Authorization: Bearer $SYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{"watcher_type":"jira","watcher_id":"roadmap","credential_id":"jira-prod","config":{"site_url":"https://example.atlassian.net","jql":"updated >= -30d ORDER BY updated DESC","poll_interval":300,"comments":{"mode":"latest","limit":10},"changelog":{"enabled":true},"privacy":{"user_display":"display_name","include_emails":false}}}' \
$SYNTH_URL/api/watchers
Common watcher actions:
curl -H "Authorization: Bearer $SYNTH_API_KEY" $SYNTH_URL/api/watchers
curl -H "Authorization: Bearer $SYNTH_API_KEY" -X POST $SYNTH_URL/api/watchers/docs/check-now
curl -H "Authorization: Bearer $SYNTH_API_KEY" -X POST $SYNTH_URL/api/watchers/docs/stop
curl -H "Authorization: Bearer $SYNTH_API_KEY" -X POST $SYNTH_URL/api/watchers/docs/start
curl -H "Authorization: Bearer $SYNTH_API_KEY" -X POST $SYNTH_URL/api/watchers/docs/logs/clear
curl -H "Authorization: Bearer $SYNTH_API_KEY" -X POST $SYNTH_URL/api/watchers/platform-group/reconcile
curl -H "Authorization: Bearer $SYNTH_API_KEY" -X POST \
-H "Content-Type: application/json" \
-d "{\"approve\":true,\"snapshot_digest\":\"$BLOCKED_SNAPSHOT_DIGEST\"}" \
$SYNTH_URL/api/watchers/platform-group/catalog-removals/approve
The compatibility endpoints /check-now and /reconcile perform a combined
check-and-apply operation. They are not aliases for the read-only Refresh
action. Integrations should use the explicit Refresh and Sync endpoints.
The Refresh/Sync watcher contract exposes:
# Read-only comparison; returns a bounded plan and does not publish.
curl -H "Authorization: Bearer $SYNTH_API_KEY" -X POST \
$SYNTH_URL/api/watchers/docs/refresh
# Complete read-only comparison for Google Drive change-feed scopes.
curl -H "Authorization: Bearer $SYNTH_API_KEY" -X POST \
$SYNTH_URL/api/watchers/marketing-drive/full-refresh
# Re-checks the source, then applies through the normal durable pipeline.
curl -H "Authorization: Bearer $SYNTH_API_KEY" -X POST \
$SYNTH_URL/api/watchers/docs/sync
# Disable automatic publication without stopping scheduled source checks.
curl -H "Authorization: Bearer $SYNTH_API_KEY" -X PUT \
-H "Content-Type: application/json" \
-d '{"auto_sync":false}' \
$SYNTH_URL/api/watchers/docs/auto-sync
Refresh plans are server-owned comparison evidence. Clients may display the
returned id, mode, status, completeness, timestamps, and summary, but
must not treat a plan as permission to publish. Sync performs a fresh
comparison and rejects incomplete observations, active protected publication
recovery, budget blocks, or removal plans that still require review. Repeating
Refresh for the same current observation is idempotent. Git · OKF Sync keeps
its separate deterministic mirror API and does not expose these actions.
If the explicit action routes are unavailable, the server returns 404. Clients
must not reinterpret /check-now as read-only Refresh. Operators can find the
rolling-upgrade sequence in the deployment release note.
Set BLOCKED_SNAPSHOT_DIGEST to the full blocked_snapshot_digest returned by
the latest GET /api/watchers response. The approval is rejected if the
catalog changes before execution and is intentionally one-use. Failed or
incomplete collection enumeration retains the last trusted repository catalog
and cannot remove repositories.
For collection watchers, GET /api/watchers returns separate catalog and
repository_freshness objects. The catalog includes status, generation,
repository_count, last_complete_at, last_attempt_at, age_seconds,
authenticated, missing_candidates, pending_additions,
blocked_snapshot_digest, and active_generation. Repository freshness
includes bounded counts for fresh, checking, retrying, blocked,
empty, and unknown, plus at most 100 safe result rows.
Collection safety settings are optional and server-bounded:
{
"catalog_missing_confirmations": 2,
"catalog_confirmation_window_seconds": 300,
"catalog_max_removals": 20,
"catalog_max_removal_fraction": 0.25,
"catalog_repo_concurrency": 4
}
The server accepts 1–10 confirmations, a 0–604800 second confirmation window, 0–10000 absolute removals, a 0–1 removal fraction, and 1–16 concurrent repository bootstraps. Values outside these limits are rejected rather than silently clamped.
Background Link and Lint
The background quality workflow uses these routes. They require
Project editor access and, for API keys, admin:write or full_access.
All GET routes accept a project_path query parameter; POST job controls do too.
| Method and path | Purpose |
|---|---|
POST /api/lint/run | Submit a bounded batch; HTTP 202 with job IDs and submitted/deferred page counts |
GET /api/lint/status | Read up to 100 recent Link/quality jobs, outcomes, per-page linking progress and the unchecked legacy backlog |
GET /api/lint/latest | Read the latest structured job report |
GET /api/lint/report/raw | Read the latest available Markdown export |
GET /api/lint/reports/list | List report exports; optional limit from 1 to 100 |
POST /api/lint/jobs/{id}/cancel | Cancel a Link or quality job |
POST /api/lint/jobs/{id}/retry | Retry terminal Link or quality work; HTTP 202 with the replacement job ID |
Submission body:
{
"project_path": "/var/lib/synth/projects/docs",
"pages": ["concepts/deployment.md"],
"use_llm": true,
"use_grounded": true
}
pages is optional and accepts up to 50 derived-page paths relative to
knowledge/. Both boolean options default to true. The older SDK field
allow_llm remains an alias for use_llm; new clients should send use_llm.
Setting it to false skips semantic auditing, model repairs and model linking.
Manual audits can publish eligible repairs and links; they are not preview-only.
Do not parse a submission as a completed audit. Poll the returned job IDs and
distinguish execution status: done from result.quality_outcome:
pass, fail, inconclusive or not_checked. A superseded job can finish
without a quality verdict. The latest report is per job, not a batch aggregate.
For linking, inspect linking.counts and linking.pages in the status response.
Each page reports its state, job_id and publication status. A
no_supported_links result means the bounded review completed without an
accepted relationship; pending, waiting_budget, semantic_disabled and
needs_attention are different outcomes. See the
linking state table.
To retry only linking, pass that page's Link job_id to the retry route. This
reuses completed relationship checks without rerunning source ingestion or the
full content audit. It can use model credits. To start checking older pages
without an existing job, submit a selective audit with pages; it includes
linking.
See Link & Lint for curl/SDK/server CLI examples, budgets, model settings, legacy-page behavior and troubleshooting.
Error Shape
Synth returns JSON errors such as:
{
"detail": "Not authenticated"
}
For MCP, use the JSON-RPC endpoint instead: MCP for AI Agents.
Source retirement recovery
GET /api/lint/status?project_path=... includes a retirement object with
safety events and pages containing state, reason and associated quality jobs.
These are editor/operator details; public knowledge read schemas are unchanged.
| Method and path | JSON body | Purpose |
|---|---|---|
POST /api/lint/retirement/retry | project_path, event_id | Retry deterministic safety publication after fixing its cause; already-published events are inert |
POST /api/lint/retirement/review | project_path, page_path, expected_sha256 | Authorize replacing an exact manually reviewed revision with a safe remaining-evidence page, or withdrawing it if no support remains |
Both require editor access to the selected Project and admin:write or
full_access for API-key authentication. Review conflicts return 409; an unknown
retry event returns 404. Background semantic retries use the existing quality-job
retry route. See Removed Sources and Shared Pages
for complete examples and recovery limits.