---
title: "Test Ocr Extraction"
method: POST
path: "/api/admin/ocr-test"
tags: ["copilot_frontend", "admin", "OCR Testing"]
---

# Test Ocr Extraction

`POST /api/admin/ocr-test`

Prueba de extraccion OCR desde una imagen o PDF subido.

Requiere autenticacion JWT y rol 'admin'.

## Response `200`

Successful Response

- OCRResponse — Response schema for OCR processing.
  - `success` boolean, required — Whether the OCR processing was successful
  - `document_type` 'cadastral_reference' | 'dni' | 'bank_document', required — Document types supported by the OCR service.
  - `extracted_data` OCRExtractedData, required — Union type for all possible extracted data.
    - `cadastral_reference` CadastralReferenceData — Data extracted from cadastral reference documents.
      - `cadastral_reference` string, nullable — Spanish cadastral reference (format: 1234567AB1234C0001AB)
      - `confidence` 'high' | 'medium' | 'low', required — Confidence level of the extraction
    - `dni` DNIData — Data extracted from DNI/NIE documents.
      - `dni_number` string, nullable — DNI/NIE number (format: 12345678A or X1234567L)
      - `first_name` string, nullable — First name(s) only, without surnames
      - `last_name` string, nullable — Surnames as shown in the document
      - `full_name` string, nullable — Full name (first name + surnames)
      - `sex` string, nullable — Sex: M or F
      - `nationality` string, nullable — Nationality code (e.g. ESP)
      - `birth_date` string, nullable — Birth date (format: DD/MM/YYYY)
      - `expiry_date` string, nullable — Document expiry date (format: DD/MM/YYYY)
      - `support_number` string, nullable — IDESP / document support number
      - `birth_place` string, nullable — Place of birth (only visible on back side)
      - `address` string, nullable — Address (only visible on back side)
      - `parents` string, nullable — Parents names from HIJO/A DE field (only visible on back side)
      - `document_side` string, nullable — Which side of the document: 'front' or 'back'
      - `confidence` 'high' | 'medium' | 'low', required — Confidence level of the extraction
    - `bank_document` BankDocumentData — Data extracted from bank documents.
      - `iban` string, nullable — IBAN number (format: ES12 1234 1234 1234 1234 1234)
      - `confidence` 'high' | 'medium' | 'low', required — Confidence level of the extraction
    - `raw_response` string, nullable — Raw response from Claude API for debugging
  - `message` string, nullable — Additional message or error description
  - `image_url` string, nullable — URL of the uploaded image in HubSpot (if applicable)

## 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)
