Skip to content
GitmoapAPIBeta
Knowledgespecs
GET/repositories/{repo_id}/specs/docs/{doc_id}

Fetch one spec document with its block outline and findings

get_spec_doc
  • tree:read
    A token needs the tree:read scope: Browse repository trees and blobsGranted by mcp_agent, mcp_agent_write, read_api, read_repository, write_api, write_repository.Every operation this scope unlocks

Returns one indexed spec document: its frontmatter, its outline of sections, and the findings reported against it. Name it by its id, or by the id derived from its path when it declares none.

Parameters

Path
  • repo_idRepositoryId (string · uuid)The repository whose corpus is indexed
  • doc_idstringThe document's frontmatter id, or its path-derived fallback

Responses

200The document, its outline and its findings — no proseapplication/json
  • blocksarray of SpecBlock
    • The SpecBlock schema
    • anchorstring
    • end_lineinteger · int32
    • headingstring
    • kindstring
    • levelinteger · int32
    • namestring
    • ordinalinteger · int32
    • start_lineinteger · int32
    • heading_numberstring or nulloptional
    • markerstring or nulloptional
    • parent_ordinalinteger · int32 or nulloptionalThe enclosing block's ordinal, not its id — the tree is addressed the way it is read.
    • summarystring or nulloptional
  • docSpecDocSummary
    • The SpecDocSummary schema
    • block_countinteger · int32
    • byte_leninteger · int32
    • corpus_idCorpusId (string · uuid)
    • doc_idstring
    • finding_countinteger · int32
    • last_seen_shastring
    • pathstring
    • postureSpecPosturedeclareduntypedWhether a document claims to follow the spec format. A declared document carries gsf: 1 in its frontmatter and is checked in full; an untyped one made no claim and is never reported for not following it.
    • profilestring
    • record_countinteger · int32
    • staleboolean
    • stemstring
    • synced_atstring
    • titlestring
    • createdstring or nulloptional
    • depends_onarray of stringoptional
    • gsf_versioninteger · int32 or nulloptional
    • kindstring or nulloptional
    • last_reviewedstring or nulloptionalISO YYYY-MM-DD, verbatim from the frontmatter.
    • orphaned_atstring or nulloptionalWhen the file stopped being present in the repository. The record is kept rather than deleted, so an existing link still resolves and tells you it moved.
    • owner_group_idGroupId (string · uuid) or nulloptional
    • owner_principal_idPrincipalId (string · uuid) or nulloptional
    • parent_doc_idstring or nulloptional
    • part_of_doc_idstring or nulloptional
    • statusSpecStatusdraftreviewapprovedimplementedpartialsupersededlivingnoneor nulloptionalA document's declared lifecycle state. none is a real value rather than an absence: a document that declares status: none has said the question does not apply to it, which is a different fact from one that declared nothing.
    • status_notestring or nulloptional
    • summarystring or nulloptional
    • superseded_bystring or nulloptional
    • tagsarray of stringoptional
  • findingsarray of SpecFinding
    • The SpecFinding schema
    • codestring
    • doc_idstring
    • messagestring
    • severitySpecSeverityerrorwarninginfoHow serious a finding is.
    • lineinteger · int32 or nulloptional
200 exampleSynthesized example
{
"blocks": [
{
"anchor": "anchor-a1d9",
"end_line": 62,
"heading": "heading-7d42",
"kind": "kind-2e18",
"level": 10,
"name": "payments-api",
"ordinal": 40,
"start_line": 24
},
{
"anchor": "anchor-c795",
"end_line": 35,
"heading": "heading-1914",
"kind": "kind-e793",
"level": 47,
"name": "payments-api",
"ordinal": 83,
"start_line": 84
}
],
"doc": {
"block_count": 2,
"byte_len": 3,
"corpus_id": "cc74bd70-d648-438d-907f-b99dc61517f5",
"doc_id": "e963f1c7-a8e4-4ff7-ad60-d784e6c3112a",
"finding_count": 1,
"last_seen_sha": "027bd99a3ec9c866b1cd1d58cb851c8a130c466f",
"path": "path-a5ea",
"posture": "declared",
"profile": "profile-0522",
"record_count": 7,
"stale": false,
"stem": "stem-9689",
"synced_at": "2026-10-15T15:03:34Z",
"title": "Inline scalar newtypes but keep their brand",
"created": "created-cb4a",
"depends_on": [
"depends-on-d77d",
"depends-on-bce5"
],
"gsf_version": 40,
"kind": "kind-0887",
"last_reviewed": "last-reviewed-3e75",
"orphaned_at": "2026-10-10T15:09:13Z",
"owner_group_id": "4c1d8e2f-6a3b-4f90-b7c5-1e2d3c4b5a69",
"owner_principal_id": "b73008b4-f502-4513-bd98-5382dcf6536f",
"parent_doc_id": "a1fdbc41-ef60-4082-9d74-c84e2840bb6a",
"part_of_doc_id": "36151958-e875-4552-8c14-ae92b29ea1f4",
"status": "draft",
"status_note": "status-note-3187",
"summary": "summary-025d",
"superseded_by": "a3f1c2d4-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
"tags": [
"tags-f3ff"
]
},
"findings": [
{
"code": "code-47dd",
"doc_id": "7aff2cfe-aa3c-4712-b55c-d5386ebdbe65",
"message": "Pin a page's payload to the build that rendered it",
"severity": "error"
}
]
}
400Bad request — a path parameter is not a well-formed value of its typeapplication/json
Error codes
  • BAD_REQUESTThe request is malformed: a parameter or a body field is not a well-formed value of its type
  • errorErrorBody
    • The ErrorBody schema
    • codestringThe coarse category, tied to the status: NOT_FOUND, CONFLICT, INSUFFICIENT_SCOPE. Every error has one; the API reference's error catalogue lists them all.
    • messagestringWhat went wrong, for a person. Written to be read, not parsed: match on reason or code.
    • fieldstring or nulloptionalOn a 400 that refused one field's value, the field, as its JSON path: email, items[0].name. Put the message under that input. Absent on every other error.
    • reasonstring or nulloptionalThe specific code, when the error has one: LAST_ORGANIZATION_OWNER, BRANCH_PROTECTED. The message starts with it too. Match on this when it is present, and on code otherwise.
    • required_scopestring or nulloptionalThe scope the access token was missing, on INSUFFICIENT_SCOPE.
    • violationsanyoptionalPresent on the structured-validation errors (PROVIDER_VALIDATION_FAILED per-node, PIPELINE_VALIDATION_FAILED DAG): a JSON array of the offending elements, so a caller can fix every one in a single round-trip. Absent (omitted) on every other error.
400 exampleSynthesized example
{
"error": {
"code": "code-e30a",
"message": "Label every synthesized example"
}
}
401Unauthenticated — no credential, or an invalid oneapplication/json
Error codes
  • UNAUTHORIZEDNo credential was sent, or the one sent is invalid, expired or revoked
  • errorErrorBody
    • The ErrorBody schema
    • codestringThe coarse category, tied to the status: NOT_FOUND, CONFLICT, INSUFFICIENT_SCOPE. Every error has one; the API reference's error catalogue lists them all.
    • messagestringWhat went wrong, for a person. Written to be read, not parsed: match on reason or code.
    • fieldstring or nulloptionalOn a 400 that refused one field's value, the field, as its JSON path: email, items[0].name. Put the message under that input. Absent on every other error.
    • reasonstring or nulloptionalThe specific code, when the error has one: LAST_ORGANIZATION_OWNER, BRANCH_PROTECTED. The message starts with it too. Match on this when it is present, and on code otherwise.
    • required_scopestring or nulloptionalThe scope the access token was missing, on INSUFFICIENT_SCOPE.
    • violationsanyoptionalPresent on the structured-validation errors (PROVIDER_VALIDATION_FAILED per-node, PIPELINE_VALIDATION_FAILED DAG): a JSON array of the offending elements, so a caller can fix every one in a single round-trip. Absent (omitted) on every other error.
401 exampleSynthesized example
{
"error": {
"code": "code-4fca",
"message": "Draw the region map from operation density"
}
}
403Forbidden — the caller's access level or token scope is insufficientapplication/json
Error codes
  • FORBIDDENYou are signed in but may not do this here; reason names the permission or the rule that refused it
  • INSUFFICIENT_SCOPEThe access token lacks the scope this operation needs; required_scope names it
  • PERMISSION_REQUIREDYou need a permission you do not hold here; the message names it
  • errorErrorBody
    • The ErrorBody schema
    • codestringThe coarse category, tied to the status: NOT_FOUND, CONFLICT, INSUFFICIENT_SCOPE. Every error has one; the API reference's error catalogue lists them all.
    • messagestringWhat went wrong, for a person. Written to be read, not parsed: match on reason or code.
    • fieldstring or nulloptionalOn a 400 that refused one field's value, the field, as its JSON path: email, items[0].name. Put the message under that input. Absent on every other error.
    • reasonstring or nulloptionalThe specific code, when the error has one: LAST_ORGANIZATION_OWNER, BRANCH_PROTECTED. The message starts with it too. Match on this when it is present, and on code otherwise.
    • required_scopestring or nulloptionalThe scope the access token was missing, on INSUFFICIENT_SCOPE.
    • violationsanyoptionalPresent on the structured-validation errors (PROVIDER_VALIDATION_FAILED per-node, PIPELINE_VALIDATION_FAILED DAG): a JSON array of the offending elements, so a caller can fix every one in a single round-trip. Absent (omitted) on every other error.
403 exampleSynthesized example
{
"error": {
"code": "code-f547",
"message": "Draw the region map from operation density"
}
}
404Not found — or found and private, which is masked as absentapplication/json
Error codes
  • NOT_FOUNDThe resource does not exist — or exists and you cannot see it: a private resource you have no access to answers exactly as an absent one does
  • errorErrorBody
    • The ErrorBody schema
    • codestringThe coarse category, tied to the status: NOT_FOUND, CONFLICT, INSUFFICIENT_SCOPE. Every error has one; the API reference's error catalogue lists them all.
    • messagestringWhat went wrong, for a person. Written to be read, not parsed: match on reason or code.
    • fieldstring or nulloptionalOn a 400 that refused one field's value, the field, as its JSON path: email, items[0].name. Put the message under that input. Absent on every other error.
    • reasonstring or nulloptionalThe specific code, when the error has one: LAST_ORGANIZATION_OWNER, BRANCH_PROTECTED. The message starts with it too. Match on this when it is present, and on code otherwise.
    • required_scopestring or nulloptionalThe scope the access token was missing, on INSUFFICIENT_SCOPE.
    • violationsanyoptionalPresent on the structured-validation errors (PROVIDER_VALIDATION_FAILED per-node, PIPELINE_VALIDATION_FAILED DAG): a JSON array of the offending elements, so a caller can fix every one in a single round-trip. Absent (omitted) on every other error.
404 exampleSynthesized example
{
"error": {
"code": "code-f444",
"message": "Stream pipeline status into the run header"
}
}

CLI

gitmoap specs get-spec-doc

  • --repo-ididThe repository whose corpus is indexed (id or owner/repo path)
  • --doc-idstringThe document's frontmatter id, or its path-derived fallback

Used in these guides