---
title: "Trace Query"
method: POST
path: "/api/debug/trace-query"
tags: ["debug"]
---

# Trace Query

`POST /api/debug/trace-query`

## Request

- Base URL: `https://api.erux.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://api.erux.ai/api/debug/trace-query`
- Auth: OAuth 2 (password, token URL `token`)

Execute a QA query with full tracing enabled.

**Authentication Required**: This endpoint requires a valid JWT token.

**Debug Mode Required**: Set ENABLE_DEBUG_ENDPOINTS=true in environment.

Returns the answer plus detailed trace data including:
- All service method calls with timing
- Knowledge base sources retrieved with scores
- LLM metrics (tokens, model, latency)
- Total request duration

Example response:
```json
{
    "answer": "With Sun in your 10th house...",
    "trace": {
        "trace_id": "abc12345",
        "query": "What does Sun in 10th house mean?",
        "total_duration_ms": 1850,
        "services_called": [...],
        "kb_sources_used": [...],
        "llm_metrics": {...}
    }
}
```

## Request body

- TraceQueryRequest: Request model for trace-query endpoint.
  - `question` string, required: The astrological question to trace
  - `system` string: Astrological system: 'western' or 'vedic'
  - `chart_data` object, nullable: Optional chart data. If not provided, uses a sample chart.

## Response `200`

Successful Response

- TraceQueryResponse: Response model for trace-query endpoint.
  - `answer` string, required
  - `trace` object, required

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/erux/apis/erux-astrology-ephemeris-engine.md) · [All operations](https://skmtc.dev/erux/apis/erux-astrology-ephemeris-engine/llms.txt) · [OpenAPI document](https://skmtc.dev/erux/apis/erux-astrology-ephemeris-engine/revisions/9db1de17d2a5?raw)
