← API and MCP overview

Developer reference

REST API reference

The v1 API exposes workspace data for reporting, CI, and agents. It cannot apply or dismiss corrections, change settings, edit pages, or spend model budget.

Quick start

As a workspace owner, create a key under Settings → API keys, save the one-time value, and send it as a Bearer token. Replace https://api.example.com with your Amendary backend origin.

All endpoint paths below use the /api/v1 prefix. Your key selects one workspace and has read access; no workspace header is needed.

curl "https://api.example.com/api/v1/corrections?status=pending&limit=20" \
  --header "Authorization: Bearer amk_your_key_here"
Machine-readable schema: GET /api/v1/openapi.json. It includes the Bearer security scheme, parameter constraints, and every response model for client generation.

Errors, limits, and pagination

  • 401 means the key is missing, malformed, unknown, or revoked. These cases deliberately share one response.
  • 422 means a query parameter is invalid. Follow the bounds and enum values below.
  • 429 means this key exceeded the configured per-minute limit (30 requests by default). Honor the Retry-After response header before retrying.
  • 5xx means the service could not complete the read. Retry transient failures with exponential backoff.
  • Only corrections use offset pagination. The response returns items, limit, offset, and total; request the next page while offset + items.length < total.
GET

/corrections

Lists corrections newest first, including review text and evidence. Use this endpoint to populate a queue or alert on pending documentation work.

Query: status (optional: pending, approved, rejected, reverted), limit (1–200, default 50), offset (0 or greater).

{
  "items": [{
    "id": "3d84fb2d-3743-44a4-8bb8-adb0f0056554",
    "notion_page_id": "6af45f73-778d-41c5-b7c4-ac4f5d3b7d76",
    "status": "pending",
    "source": "release", "source_ref": "v2.14.0",
    "source_url": "https://github.com/acme/api/releases/tag/v2.14.0",
    "changed_paths": ["src/rate_limit.py"],
    "stale_quote": "The limit is 60 requests per minute.",
    "planned_edit": "The limit is 120 requests per minute.",
    "context_complete": true, "ungrounded_tokens": null,
    "dropped_tokens": null, "created_at": "2026-10-02T09:15:00Z"
  }],
  "limit": 20, "offset": 0, "total": 1
}
FieldTypeMeaning
idUUIDCorrection identifier.
notion_page_idUUIDInternal page identifier. The name is retained for compatibility and also identifies GitHub-backed pages.
statusstringpending, approved, rejected, or reverted.
sourcestringdiff, initial_audit, release, or new_page.
source_url / source_refstring | nullEvidence link and the release, tag, or commit reference.
changed_pathsarray | nullRepository paths in the evidence when available.
stale_quote / planned_editstring | nullThe passage under review and the text Amendary would write.
context_completebooleanFalse when the source input was truncated or otherwise incomplete.
ungrounded_tokens / dropped_tokensarray | nullValues that require human attention because the evidence did not support them.
created_atISO 8601When the correction was created.
GET

/checks/status

Returns one freshness record for every repository in the workspace. There are no query parameters.

{
  "repos": [{
    "repo_id": "11f29f32-3f6f-4f94-9c9c-6f75026d3a8d",
    "repo_full_name": "acme/api",
    "last_checked_at": "2026-10-02T08:00:00Z",
    "last_checked_commit_sha": "9d6b4a49b4a904fb84e2210cf15f64246ca75a24",
    "last_check_status": "ok", "pending_corrections": 1
  }]
}
FieldTypeMeaning
repo_id / repo_full_nameUUID / stringThe repository identifier and owner/name.
last_checked_atISO 8601 | nullWhen the last completed check was recorded.
last_checked_commit_shastring | nullThe latest commit Amendary compared through.
last_check_statusstring | nullok, partial, or failed; null before a check is recorded.
pending_correctionsintegerPending corrections across pages mapped to the repo.
GET

/usage

Returns the same workspace token and operational usage summary shown in the dashboard.

Query: days (1–365, default 30). The response includes totals, daily and purpose/repo breakdowns, today’s effective budget, budget events, cache token counts and operational counts.

curl "https://api.example.com/api/v1/usage?days=7" \
  -H "Authorization: Bearer amk_your_key_here"
FieldTypeMeaning
total_input_tokens / total_output_tokensintegerTokens used in the selected window.
by_dayarrayDaily token, cache, call, and estimated-cost totals.
todayobjectTokens used today, effective budget, percentage used, and paused state.
by_purpose / by_repoarrayUsage grouped by operation and repository.
totalsobjectCalls, input/output tokens, and estimated cost for the window.
budget_eventsarrayDates on which the workspace reached its daily budget.
operationalobjectDiffs, releases, pages, verdicts, flags, and skipped ranges processed.
cache_read_tokens / cache_write_tokensintegerPrompt-cache activity in the window.
cache_savings_centsinteger | nullEstimated whole cents saved by cache reads.
GET

/docs

Lists mapped page/repository pairs and their freshness metadata. It returns links and metadata, never the page body.

Query: repo (optional exact owner/name, case-insensitive) and topic (optional case-insensitive title substring). A page mapped to multiple repos appears once for each mapping.

{
  "docs": [{
    "page_id": "6af45f73-778d-41c5-b7c4-ac4f5d3b7d76",
    "title": "API limits",
    "page_type": "customer_success", "doc_type": "prose",
    "source_kind": "notion",
    "url": "https://www.notion.so/6af45f73778d41c5b7c4ac4f5d3b7d76",
    "repo_id": "11f29f32-3f6f-4f94-9c9c-6f75026d3a8d",
    "repo_full_name": "acme/api",
    "last_synced_at": "2026-10-02T07:30:00Z",
    "last_checked_at": "2026-10-02T08:00:00Z",
    "pending_corrections": 1
  }]
}
FieldTypeMeaning
page_id / titleUUID / stringThe mapped page identifier and title.
page_typestringtechnical_docs, customer_success, or excluded.
doc_typestringprose, runbook, incident, product_update, or adr.
source_kind / urlstring / string | nullWhere the page lives and its best available destination URL.
repo_id / repo_full_nameUUID / stringThe mapped repository.
last_synced_at / last_checked_atISO 8601 | nullLast page sync time and repository check time.
pending_correctionsintegerPending corrections for this page.
Using an MCP client instead of REST? The transport, initialization request, tool parameters, and client configuration are in the MCP guide.