---
title: "View Budget"
method: GET
path: "/api/budget/view/{token}"
tags: ["copilot_frontend", "copilot_budget"]
---

# View Budget

`GET /api/budget/view/{token}`

View budget via encrypted token.

This is a PUBLIC endpoint (no authentication required).

The token contains the encrypted client_data_id. This endpoint:
1. Decrypts the token to get client_data_id
2. Retrieves client data from presup_datos_presupuesto_cliente
3. Retrieves associated budget from presup_presupuestos
4. Extracts data from datos_formulario
5. Gets panel information from database:
   - If selected panel is premium -> also fetches basic panel
   - If selected panel is basic -> also fetches premium panel
6. Prepares template context with both panel types for comparison
7. Renders budget HTML template with the data

Args:
    token: Encrypted token containing client_data_id
    request: FastAPI request object (needed for Jinja2)
    db: Database session

Returns:
    HTMLResponse with budget visualization or friendly error page (404) if:
    - Token is invalid or expired
    - Client data or budget not found in database

## Path parameters

- `token` string, required

## Response `200`

Successful Response

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.dev/hogarsolar/apis/hogarsolar-backend-api.md) · [All operations](https://skmtc.dev/hogarsolar/apis/hogarsolar-backend-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/hogarsolar/hogarsolar-backend-api/revisions/d9861e46bef8/schema)
