# List ask

URL: https://docs.hanzo.ai/docs/openapi/code/get-code-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`

> [Code →](https://docs.hanzo.ai/docs/openapi/code) · [All API references →](https://docs.hanzo.ai/docs/openapi) · [Get started →](https://docs.hanzo.ai/docs/guides)

|               |                                        |
| ------------- | -------------------------------------- |
| **Address**   | `https://api.hanzo.ai/v1/code/ask`     |
| **Method**    | `GET`                                  |
| **Operation** | `get_code_ask`                         |
| **Auth**      | `Authorization: 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.

| Field  | In    | Type   | Required | Description                               |
| ------ | ----- | ------ | -------- | ----------------------------------------- |
| `q`    | query | string | —        | Q is the question to answer.              |
| `repo` | query | string | —        | Repo narrows retrieval to one repository. |

## Response

| Status    | Body            | Meaning |
| --------- | --------------- | ------- |
| `200`     | code.AskAnswer  | ok      |
| `default` | problem-details | refused |

`200` body — 9 fields.

| Field                 | In   | Type             | Always | Description                                                                                                                                                                    |
| --------------------- | ---- | ---------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `answer`              | body | string           | —      | Answer is the synthesized prose.                                                                                                                                               |
| `citations`           | body | code.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[].endLine` | body | integer (int64)  | —      | EndLine is its last line, inclusive.                                                                                                                                           |
| `citations[].file`    | body | string           | —      | File is the path inside the repo, relative to its root.                                                                                                                        |
| `citations[].line`    | body | integer (int64)  | —      | Line is the first line of the cited region, 1-based.                                                                                                                           |
| `citations[].repo`    | body | string           | —      | Repo is the repository the cited code lives in ("owner/name"), absent when the ask was already scoped to one.                                                                  |
| `citations[].symbol`  | body | string           | —      | Symbol is the declaration the region belongs to, when it belongs to one.                                                                                                       |
| `degraded`            | body | boolean          | —      | Degraded is true when retrieval worked but no synthesizer was reachable.                                                                                                       |
| `question`            | body | string           | —      | Question is the ask, echoed back.                                                                                                                                              |

Failure carries the platform error shape — see [Errors](https://docs.hanzo.ai/docs/errors).

## Examples

**CLI**

```bash
hanzo code ask get
```

**SDK**

**.ts**

```ts
import { Configuration, CodeApi } from 'hanzoai';

const api = new CodeApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getCodeAsk();
```

**.py**

```python
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()
```

**.go**

```go
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
}
```

**.rs**

```rust
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?;
```

**.java**

```java
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();
```

**HTTP**

```bash
curl https://api.hanzo.ai/v1/code/ask \
  -H "Authorization: Bearer $HANZO_API_KEY"
```

**MCP**

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

```bash
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](https://docs.hanzo.ai/docs/openapi/code) · [All Hanzo APIs](https://docs.hanzo.ai/docs/openapi) · [Interactive reference](https://docs.hanzo.ai/docs/openapi/reference)
