canonical: https://jentic.com/apis/serpro.gov.br/serpro

# Serpro Vio Decodificar

The Vio Decodificar API decodes the data in a Vio QR code printed on a Brazilian document and, where the issuing body allows it, checks the document's status online. It is published by SERPRO, Brazil's federal data processing service, to speed up and automate the authentication of compatible documents. You send the raw bytes extracted from the QR code, and the response returns the document template with its name and owner, the decoded data fields, an embedded image in base64, and a status when the online check is available.

## For AI agents

Decode the bytes from a Vio QR code on a Brazilian document and get back its template, data fields, embedded image, and online status when the issuer supports it.

## Scope

Does not handle face matching, CPF lookups, or documents without a Vio QR code. Use for decoding and checking Vio QR codes on compatible documents only.

## Capabilities

- Decode the raw bytes extracted from a Vio QR code into structured document data
- Check a document's status online when its issuing entity has authorised that lookup
- Return the document template name and the owner of that template
- Return the document's data fields and an embedded image as base64
- Report why a QR payload could not be processed as a list of property and message violations

## Use cases

### AI Agent Document Checks Through Jentic

An onboarding or back-office agent connected through Jentic can authenticate a Brazilian document from its Vio QR code without hand-wiring the bearer token. It searches by intent, such as 'decode a Vio QR code', receives the decode operation with its input schema, and posts the QR bytes. The structured response tells it the template, the data, and the issuer status to record or flag.

Example prompt: Search Jentic for 'decode a Vio QR code', load the decode operation, and POST the bytes extracted from the QR code on a scanned document as application/octet-stream

### Automated Document Authentication

Manual checking of printed documents is slow and error-prone. Vio Decodificar reads the bytes of the document's Vio QR code and, where the issuing entity provides the service, verifies the document's status online; when the online check is not possible, it still returns the decoded result. A workflow can accept a document only when the decoded data matches what the user typed and the status is acceptable.

Example prompt: POST the QR bytes to `/v1/decode`, compare the returned data fields with the form the user submitted, and flag the case if status is present and not valid

### Handling Unreadable QR Payloads

Scans fail: a cropped or damaged QR code yields bytes that cannot be decoded. The API answers those with a 422 and a list of violations, each naming the property that caused it and a message, so an agent can ask the user for a better scan instead of guessing.

Example prompt: POST the QR bytes to `/v1/decode`; on a 422 response read each violation's property and message and ask the user to rescan the document

## Key resources

- **Decode** — Decode Vio QR code bytes and return template, data, image, and status

## AI readiness

This API is usable in Jentic One now. Its AI-readiness score against Jentic's framework shows where it stands today and where improvements would make it even easier for agents to use.

- **Score:** 65 / 100
- **Maturity:** AI-Aware
- **Dimensions:**
  - Foundational Compliance: 100 / 100
  - Developer Experience & Jentic Compatibility: 63 / 100
  - AI-Readiness & Agent Experience: 44 / 100
  - Agent Usability: 94 / 100
  - Security: 60 / 100
  - AI Discoverability: 75 / 100
- **View full report:** https://jentic.com/apis/serpro.gov.br/serpro/scorecard
- **How the score is calculated:** https://docs.jentic.com/reference/api-readiness-framework/overview/
- **More about the dimensions:** https://docs.jentic.com/reference/api-readiness-framework/specification/#dimensional-model-overview

### Score it yourself

Every API in the directory is allowlisted, so you can re-score it with no key required.

- **Score your own API:** https://jentic.com/scorecard.md
- **Scoring CLI agent skill:** https://github.com/jentic/jentic-api-scorecard/blob/main/skills/jentic-api-scorecard/SKILL.md

```sh
npx @jentic/api-scorecard-cli score <openapi-url>
```

## Why Jentic

- **Setup:** Wiring Vio Decodificar by hand means sending its bearer token, posting raw QR bytes as application/octet-stream rather than JSON, and handling the 422 violation list yourself. Through Jentic you install once, import it from the API Directory, store the token once, and your agent calls it.
- **Permission scoping:** Vio Decodificar exposes one operation, POST `/v1/decode`, with the QR payload in the request body. A rule therefore decides whether your agent may decode documents at all, and it cannot reach any other SERPRO service through this binding.
- **Credential handling:** Your SERPRO token is stored once, encrypted, by your own Jentic One instance and injected at execution time. It never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'decode a Vio QR code' or 'verify a Brazilian document', and Jentic returns the Vio Decodificar operation with its input schema so the agent calls the right endpoint without browsing the reference docs.

## Related APIs

- **Onfido API** — Global ID document and biometric verification
- **Veriff API** — Identity verification sessions with document and face checks
- **CPFHub.io API** — Brazilian CPF lookups for name and date of birth

## FAQ

### Is there a Vio Decodificar MCP server?

You don't need an MCP server to give your agent the Vio Decodificar API. Jentic connects it directly from the API Directory: import it, store your bearer token once, and your agent calls the decode operation when a document needs checking.

### Can I limit what my agent is allowed to do with the Vio Decodificar API?

Yes. The API has a single read-style operation, POST `/v1/decode`, so the useful rule is which of your agents may call it at all: allow it for your document-checking agent and leave it out for the rest. Every decode it runs is logged by your self-hosted instance.

### What authentication does the Vio Decodificar API use?

Per its OpenAPI spec, the Vio Decodificar API uses HTTP bearer authentication: send your SERPRO token as a Bearer token in the Authorization header. Through Jentic the token is stored encrypted by your own Jentic One instance and injected at call time.

### What does the Vio Decodificar API return?

A successful decode returns a template object with the template name and its owner, a data object of string fields, an image object with a type and base64 content, and a status string when the issuer's online check is available. If the bytes cannot be processed, a 422 returns violations with property and message.

### Is the base URL in the spec for production use?

The spec's server is the trial gateway at gateway.apiserpro.serpro.gov.br under the viodec-trial path. Use it to test the integration, and check the SERPRO API store at https://loja.serpro.gov.br for production access and pricing.

### What are the rate limits for the Vio Decodificar API?

The OpenAPI spec does not state rate limits. Check https://loja.serpro.gov.br for the limits attached to your SERPRO contract.

### How do I decode a Vio QR code through Jentic?

Search Jentic for 'decode a Vio QR code' and it returns the decode operation. Send the raw bytes extracted from the QR code as an application/octet-stream body and read the template, data, image, and status from the response. To run it on your own infrastructure, install Jentic One from its GitHub repo.
