Knowledgespecs
GET/repositories/{repo_id}/specs/ids/{id_kind}/{identifier}
Fetch one identifier declaration with its typed body and every citation
get_spec_id
tree:read
A token needs thetree:readscope: Browse repository trees and blobsGranted bymcp_agent,mcp_agent_write,read_api,read_repository,write_api,write_repository.Every operation this scope unlocks
Answers the document and section that declare it, its structured body — for a rule, why it
exists, how to follow it and what enforces it — and up to 200 places that cite it; when there
are more, the response says so and the references listing filtered by target_id pages through
them all. Answers 404 for an identifier the corpus does not declare. Anyone who can see the
repository may call it; on a public repository that includes callers who are not signed in.
Parameters
Path
- repo_idRepositoryId (string · uuid)The repository whose corpus is indexed
- id_kindSpecIdKindruletenetprincipleinvariantdogfoodinggenericThe identifier family: rule, tenet, principle, invariant, dogfooding, generic
- identifierstringThe identifier itself, as the corpus spells it
Responses
200The declaration, its body and its citationsapplication/json
- bodyobject
{why, how, enforced_by}for a rule; shape follows the family. citationsarray of SpecIdCitation
- The SpecIdCitation schema
- doc_idstring
- lineinteger · int32
- anchorstring or nulloptional
- citations_truncatedbooleanTrue when the identifier is cited more than 200 times and
citationslists only the first 200. List the references withtarget_idset to see them all. - idstring
- kindSpecIdKindruletenetprincipleinvariantdogfoodinggenericWhich identifier family a declaration belongs to.
- scopestring
- anchorstring or nulloptional
- declared_at_shastring or nulloptional
- doc_idstring or nulloptional
- titlestring or nulloptional
- tombstonestring or nulloptional
200 exampleSynthesized example
{
"body": {},
"citations": [
{
"doc_id": "75ccf4ea-0b7e-4e61-b690-f75b20f8d245",
"line": 44
}
],
"citations_truncated": false,
"id": "id-9771",
"kind": "rule",
"scope": "scope-fb6c",
"anchor": "anchor-d4f6",
"declared_at_sha": "a349c2f9dfffa09528fe3585f82d18fe77185cf0",
"doc_id": "3155a379-2790-447f-959b-0fd6312e435e",
"title": "Label every synthesized example",
"tombstone": "tombstone-c2cd"
}
400Unknown identifier familyapplication/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
reasonorcode. - fieldstring or nulloptionalOn a
400that 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 oncodeotherwise. - required_scopestring or nulloptionalThe scope the access token was missing, on
INSUFFICIENT_SCOPE. - violationsanyoptionalPresent on the structured-validation errors (
PROVIDER_VALIDATION_FAILEDper-node,PIPELINE_VALIDATION_FAILEDDAG): 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-5c37",
"message": "Pin a page's payload to the build that rendered it"
}
}
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
reasonorcode. - fieldstring or nulloptionalOn a
400that 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 oncodeotherwise. - required_scopestring or nulloptionalThe scope the access token was missing, on
INSUFFICIENT_SCOPE. - violationsanyoptionalPresent on the structured-validation errors (
PROVIDER_VALIDATION_FAILEDper-node,PIPELINE_VALIDATION_FAILEDDAG): 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-bbb1",
"message": "Inline scalar newtypes but keep their brand"
}
}
403Forbidden — the caller's access level or token scope is insufficientapplication/json
Error codes
- FORBIDDENYou are signed in but may not do this here;
reasonnames the permission or the rule that refused it - INSUFFICIENT_SCOPEThe access token lacks the scope this operation needs;
required_scopenames 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
reasonorcode. - fieldstring or nulloptionalOn a
400that 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 oncodeotherwise. - required_scopestring or nulloptionalThe scope the access token was missing, on
INSUFFICIENT_SCOPE. - violationsanyoptionalPresent on the structured-validation errors (
PROVIDER_VALIDATION_FAILEDper-node,PIPELINE_VALIDATION_FAILEDDAG): 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-b435",
"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
reasonorcode. - fieldstring or nulloptionalOn a
400that 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 oncodeotherwise. - required_scopestring or nulloptionalThe scope the access token was missing, on
INSUFFICIENT_SCOPE. - violationsanyoptionalPresent on the structured-validation errors (
PROVIDER_VALIDATION_FAILEDper-node,PIPELINE_VALIDATION_FAILEDDAG): 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-1b48",
"message": "Stream pipeline status into the run header"
}
}
CLI
gitmoap specs get-spec-id
- --repo-ididThe repository whose corpus is indexed (id or owner/repo path)
- --id-kindenumThe identifier family: rule, tenet, principle, invariant, dogfooding, generic
- --identifierstringThe identifier itself, as the corpus spells it