Hanzo
OpenapiCode

(re)indexes a repository for the caller's org, incrementally: files whose…

(re)indexes a repository for the caller's org, incrementally: files whose content hash is unchanged are skipped, so re-sending a whole tree is cheap.

POST /v1/code/index

Addresshttps://api.hanzo.ai/v1/code/index
MethodPOST
Operationpost_code_index
AuthAuthorization: Bearer $HANZO_API_KEY

(re)indexes a repository for the caller's org, incrementally: files whose content hash is unchanged are skipped, so re-sending a whole tree is cheap. Each file is parsed for symbols, split at AST boundaries and — when the semantic tier is available — embedded, which is what makes it searchable across all three retrieval tiers. Pass prune to also DELETE indexed files absent from the request, which turns the call into a full sync; without it the call is an upsert. The index is written to the caller org's own physically separate database.

Request

5 fields, body application/json (required).

FieldInTypeRequiredDescription
filesbodyfileInput[]Files is the full set of files to index. Required and non-empty; max 20000 files, 1 MiB per file and 1 GiB in total.
files[].contentbodystringContent is the file's full text.
files[].pathbodystringPath is the file's repo-relative path, e.g.
prunebodybooleanPrune deletes indexed files that are NOT in this request — which makes the call a full sync of the repo rather than an upsert.
repobodystringRepo is the repository label to index under.

Response

StatusBodyMeaning
200indexResultok

200 body — 9 fields.

FieldInTypeAlwaysDescription
chunksbodyintegerChunks is how many AST-boundary chunks the repo holds after this pass.
filesbodyintegerFiles is how many files the repo holds after this pass.
indexedbodyintegerIndexed is how many files were parsed and written on this pass.
prunedbodyintegerPruned is how many stored files were deleted because prune was set and they were absent from the request.
repobodystringRepo is the repository that was indexed.
semanticbodybooleanSemantic reports whether the semantic tier was available for this pass.
skippedbodyintegerSkipped is how many files were unchanged by content hash and left alone.
symbolsbodyintegerSymbols is how many symbol definitions the repo holds after this pass.
vectorsbodyintegerVectors is how many of those chunks carry an embedding.

Failure carries the platform error shape — see Errors.

Examples

hanzo code index

Code API · All Hanzo APIs · Interactive reference

How is this guide?

On this page