List ask

Answers a question about the caller org's code with a CITED answer: retrieval packs grounding context, then the synthesizer writes the answer over exactly those spans, which come back alongside it.

GET /v1/code/ask

Addresshttps://api.hanzo.ai/v1/code/ask
MethodGET
Operationget_code_ask
AuthAuthorization: Bearer $HANZO_API_KEY

Answers a question about the caller org's code with a CITED answer: retrieval packs grounding context, then the synthesizer writes the answer over exactly those spans, which come back alongside it. It never answers without grounding — with no matched code the answer is empty and says so, and with no synthesizer available the citations still come back with "degraded": true so the caller can reason over the spans itself.

Request

2 fields.

FieldInTypeRequiredDescription
qquerystring—Q is the question to answer.
repoquerystring—Repo narrows retrieval to one repository.

Response

StatusBodyMeaning
200code.AskAnswerok
defaultproblem-detailsrefused

200 body — 9 fields.

FieldInTypeAlwaysDescription
answerbodystring—Answer is the synthesized prose.
citationsbodycode.Citation[]—Citations are the exact regions the answer was grounded on, and they are the point: an answer is checkable only because every claim in it can be read back at a file and line.
citations[].endLinebodyinteger (int64)—EndLine is its last line, inclusive.
citations[].filebodystring—File is the path inside the repo, relative to its root.
citations[].linebodyinteger (int64)—Line is the first line of the cited region, 1-based.
citations[].repobodystring—Repo is the repository the cited code lives in ("owner/name"), absent when the ask was already scoped to one.
citations[].symbolbodystring—Symbol is the declaration the region belongs to, when it belongs to one.
degradedbodyboolean—Degraded is true when retrieval worked but no synthesizer was reachable.
questionbodystring—Question is the ask, echoed back.

Failure carries the platform error shape — see Errors.

Examples

hanzo code ask get
import { Configuration, CodeApi } from 'hanzoai';

const api = new CodeApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getCodeAsk();
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import CodeApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = CodeApi(client).get_code_ask()
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.CodeAPI.GetCodeAsk(context.Background()).Execute()
if err != nil {
	return err
}
use hanzo_client::apis::{configuration::Configuration, code_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = code_api::get_code_ask(&cfg, Default::default()).await?;
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.CodeApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new CodeApi(client).getCodeAsk();
curl https://api.hanzo.ai/v1/code/ask \
  -H "Authorization: Bearer $HANZO_API_KEY"

Tool code, op get_code_ask — POST the JSON-RPC envelope to https://api.hanzo.ai/v1/mcp.

curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "code",
         "arguments": {
           "op": "get_code_ask",
           "input": {}
         }
       }
     }'

Code API · All Hanzo APIs · Interactive reference

Was this page useful?