---
title: "Ler documento de veículo (DUA/livrete) e devolver campos para autofill"
method: POST
path: "/api/vehicles/ocr-document"
tags: ["Vehicles (Protected)"]
---

# Ler documento de veículo (DUA/livrete) e devolver campos para autofill

`POST /api/vehicles/ocr-document`

OCR a vehicle document (JPEG/PNG/PDF) via Claude Vision and return RAW TEXT
fields for the create-vehicle form to prefill (id resolution happens in the
FE, section-scoped — never here).

Accepts ONE OR MORE images so the caller can send the frente AND the verso —
the technical fields (cilindrada, potência, combustível, cor, lugares) live on
the verso of the DUA/livrete, so a front-only photo can't read them. All
images are read together in a single vision call and billed as ONE read.

Unreadable/unsupported input returns success=False (never a 5xx); billing
only fires on success. Heavy sync work (CV + PyMuPDF + Anthropic + pyodbc)
runs in the threadpool so the event loop is never blocked (same pattern as
/invoices/process-qr).

## Headers

- `x-api-token` string, nullable

## Response `200`

Successful Response

- VehicleOcrResult — Result of POST /api/vehicles/ocr-document (QRProcessResult-style contract: flat raw-text fields + success/error_message — an unreadable document is success=False, never a 500). Text fields (marca_texto, combustivel_texto, cor_texto, ...) are the literal strings printed on the document — id resolution happens in the FE, inside the section-scoped Integrazu cascade (see docs/claude/rules/vehicle-id-spaces.md).
  - `success` boolean
  - `error_message` string, nullable
  - `billed` boolean
  - `doc_type` string, nullable
  - `confianca` string, nullable
  - `warnings` string[]
  - `matricula` string, nullable
  - `vin` string, nullable
  - `marca_texto` string, nullable
  - `modelo_texto` string, nullable
  - `versao_texto` string, nullable
  - `data_primeira_matricula` string, nullable
  - `data_matricula_nacional` string, nullable
  - `cilindrada` string, nullable
  - `combustivel_texto` string, nullable
  - `potencia_cv` string, nullable
  - `cor_texto` string, nullable
  - `caixa_texto` string, nullable
  - `lugares` integer, nullable
  - `portas` integer, nullable
  - `peso` string, nullable
  - `categoria` string, nullable

## Other responses

- `422` — Validation Error

---

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