VX Agents

API directory · AI & ML

Mistral OCR & Document Q&A

v1.0.0 · 7 endpoints · 0 connections · shared by vx.ai

Turn invoices, contracts and scanned PDFs into clean Markdown with Mistral OCR: tables, headers and images come back page by page. Upload a file or point at a URL, choose the pages, then ask follow-up questions about the same document through Mistral chat with a document_url message.

Connect this API to an AI agent Browse all specs

What you can do with Mistral OCR & Document Q&A via MCP

Every endpoint below becomes a governed tool your AI agent (Claude, ChatGPT, or a customer-facing VX agent) can call — with scoped permissions, sandbox testing, and audit logs.

MethodPathOperationDescription
POST /v1/ocr runOcr Extract a document's text, tables and images as Markdown, page by page
POST /v1/files uploadFile Upload a PDF or image so OCR and chat can read it by file id
GET /v1/files listFiles List uploaded files, filtered by purpose, name or type
GET /v1/files/{file_id} getFile Get an uploaded file's name, size, purpose and creation time
GET /v1/files/{file_id}/url getFileSignedUrl Get a temporary download link for an uploaded file
POST /v1/chat/completions askAboutDocument Ask Mistral a question, optionally about a document passed as document_url
GET /v1/models listModels List the models this key can use, including the OCR models

Authentication

ApiKey

Bearer token — sent as Authorization: Bearer <token>

Mistral API key, sent as Authorization: Bearer <key>.

How to get a credential

  1. Sign in to La Plateforme (https://console.mistral.ai).
  2. Pick a workspace and make sure it has a plan (the free Experiment plan works for testing; OCR is billed per page on paid plans).
  3. Open API Keys, click Create new key, name it and copy the value (it is shown once).

Permissions used

Key access Operations
Workspace API key runOcr, uploadFile, listFiles, getFile, getFileSignedUrl, askAboutDocument, listModels

Mistral API keys are not scoped: any key in the workspace can call every operation above.

Common errors

Status Meaning Fix
401 Key missing, wrong or deleted Create a new key in the console; new keys can take a minute to activate.
403 Plan or workspace does not allow the model Check the workspace plan and billing.
400 / 422 Bad document or body Use a public document_url (or a file_id from uploadFile) and a valid model such as mistral-ocr-latest.
429 Rate limit or monthly quota reached Wait and retry; raise limits in the console.

Store the key as a VX Agents credential (Bearer token).

Usage guide

Setup

  1. Add a Mistral API key from https://console.mistral.ai as a VX Agents Bearer credential.
  2. Pin model on runOcr to mistral-ocr-latest, and on askAboutDocument to a chat model such as mistral-small-latest (check listModels for what your key can use).

Read a document

  1. If the file is public, skip uploading. Otherwise confirm with the user, then uploadFile (multipart file, purpose: ocr) and keep the returned id.
  2. runOcr with model and document:
    • public PDF: {"type": "document_url", "document_url": "https://..."}
    • uploaded file: {"type": "file", "file_id": "<id>"}
    • image: {"type": "image_url", "image_url": "https://..."} Optional: pages (e.g. "0-2,5", first page is 0), table_format (markdown or html), extract_header / extract_footer, include_image_base64 (only when images are needed: it makes the response large).
  3. The response has pages[] with index and markdown, plus tables and images per page and usage_info (pages processed). Join the page markdown to quote or summarise the document.
  4. For structured fields (invoice number, totals, parties), add document_annotation_format with a JSON schema and read document_annotation.

Ask questions about a document

  1. askAboutDocument with model and messages, for example a user message whose content is [{"type": "text", "text": "What is the notice period?"}, {"type": "document_url", "document_url": "https://..."}]. An uploaded file works as {"type": "file", "file_id": "<id>"}.
  2. For follow-ups, resend the earlier user messages (and the document chunk); the API keeps no history.
  3. Use temperature 0 to 0.3 for factual answers, and response_format {"type": "json_object"} when you need JSON.

Good to know

  • listFiles filters by purpose, search (file name) and mimetypes; getFileSignedUrl returns a download link valid for expiry hours (default 24, max 168).
  • OCR is billed per page: send pages when only part of a long document matters.
  • Large PDFs give large responses; ask for a page range first, then continue.
  • 429 means rate or quota limits; wait and retry.
  • Deleting files is not part of this spec.

Source: Mistral AI API reference (https://docs.mistral.ai/api), checked 2026-10-20.

How to use this spec

  1. Create a free VX Agents account (sandbox tools included).
  2. Open the marketplace and connect “Mistral OCR & Document Q&A” to an agent.
  3. Expose it as an MCP server for Claude/ChatGPT, or chat with it directly.

Related APIs