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

List cross-references, including backlinks and the dangling report

list_spec_refs
  • 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
  • Single-resource

    x-gitmoap-isolation: {"kind":"single_or_self_scoped"}

  • Paginated
    Pass the next_token a page returns to get the next one.

Every link a document makes — to another document, a section, an anchor, an identifier, a code path or an API operation — with what it resolved to. Filter by the citing document, by the target document (its backlinks) or identifier (who cites it), by form, or with resolved=false for the links that resolve to nothing. Paginated with limit (20 by default, at most 100) and next_token. 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
Query
  • doc_idstringoptionalRestrict to references made by one document
  • target_doc_idstringoptionalBacklinks: references that resolved to this document
  • target_idstringoptionalWho cites this identifier
  • ref_kindstringoptionalRestrict to one reference form: document, section, anchor, identifier, code, operation
  • resolvedbooleanoptionalfalse is the dangling report
  • limitinteger · int32optionalPage size (1-100, default 20)
  • next_tokenstringoptionalPagination cursor

Responses

200A page of references, grouped by source documentapplication/json
  • itemsarray of object
    • doc_idstring
    • lineinteger · int32
    • rawstring
    • ref_kindSpecRefKinddocumentsectionanchoridentifiercodeoperationThe form a cross-reference took in the source.
    • resolvedboolean
    • anchorstring or nulloptional
    • target_anchorstring or nulloptional
    • target_doc_idstring or nulloptional
    • target_idstring or nulloptional
    • target_methodstring or nulloptional
    • target_pathstring or nulloptional
    • target_sectionstring or nulloptional
  • next_tokenstring or nulloptional
200 exampleSynthesized example
{
"items": [
{
"doc_id": "0601bf4f-ea5d-43b9-8034-07050290b2f4",
"line": 70,
"raw": "raw-3f3f",
"ref_kind": "document",
"resolved": false
},
{
"doc_id": "b9b2f0cb-0ecf-4975-998a-545b2c0806f9",
"line": 87,
"raw": "raw-5e6a",
"ref_kind": "document",
"resolved": false
}
],
"next_token": "next-token-61b4"
}
400Unknown reference kind or malformed cursorapplication/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-dee8",
"message": "Inline scalar newtypes but keep their brand"
}
}
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-0f40",
"message": "Label every synthesized example"
}
}
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-416c",
"message": "Label every synthesized example"
}
}
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-cd12",
"message": "Inline scalar newtypes but keep their brand"
}
}

CLI

gitmoap specs list-spec-refs

  • --repo-ididThe repository whose corpus is indexed (id or owner/repo path)
  • --doc-idstringoptionalRestrict to references made by one document
  • --limitnumberoptionalPage size (1-100, default 20)
  • --next-tokenstringoptionalPagination cursor
  • --ref-kindstringoptionalRestrict to one reference form: document, section, anchor, identifier, code, operation
  • --resolvedflagoptionalfalse is the dangling report
  • --target-doc-idstringoptionalBacklinks: references that resolved to this document
  • --target-idstringoptionalWho cites this identifier

Used in these guides