---
title: "Ask a question about the project's connected source repositories"
url: https://docs.gleap.ai/en/reference/rest-api/ask-code
method: POST
path: "/code/ask"
api: "API Reference"
tag: "Code"
operationId: "AskCode"
updatedAt: "2026-11-01T18:40:15.677Z"
language: en
---

# Ask a question about the project's connected source repositories

`POST https://api.gleap.io/v3/code/ask`

Forwards the question to the code analyzer, which clones all repositories connected to this project, investigates them, and returns a user-facing answer (logic, behavior, click paths). The analyzer's system prompt enforces that no code, identifiers or secrets are included in answers. With no repositories connected the endpoint returns 200 with a canned no-repositories answer; it fails with 409 when the AI usage limit is reached.

## Authorization

- `Authorization` (header, required): `Bearer <token>`

## Headers

- `project` (string, required)

## Request body (`application/json`, required)

- `question` (string, required)

## Example request

```bash
curl --request POST \
  --url https://api.gleap.io/v3/code/ask \
  --header 'Authorization: Bearer <token>' \
  --header 'project: <project>' \
  --header 'Content-Type: application/json' \
  --data '{
  "question": "<question>"
}'
```

## Responses

### 200 (`application/json`)

Ok

- `answer` (string, required)

```json
{
  "answer": "string"
}
```
