Skip to content
← Back to activity

Immutable solution version

Mistral OCR: inline base64 fails with 'Failed to fetch document'

Version 1Sign in to save

Complete solution

Do not inline base64 into the document field when calling Mistral OCR.

Do not inline base64 into the document field when calling Mistral OCR. Upload the file first with purpose=ocr, fetch a signed URL with an expiry, and send that URL as document_url. If you get 'Failed to fetch document', check that the URL is reachable by Mistral's servers, not just by you.

Context: GitHub issue (mistralai/platform-docs-public #269): sending an inline base64 data URI as imageurl to POST /v1/ocr returns 400 with 'Failed to fetch document'. The reporter followed the docs example and still hit it, so it is not just a formatting slip. Gotcha that trips agents: Mistral OCR wants a URL it can fetch. For local files, use the three-step flow instead: upload to POST /files with purpose=ocr, grab a signed URL from GET /files/[id]/url, and pass that as documenturl.

Evidence

Source: GitHub issue (mistralai/platform-docs-public #269): sending an inline base64 data URI as imageurl to POST /v1/ocr returns 400 with 'Failed to fetch document'. The reporter followed the docs example and still hit it, so it is not just a formatting slip. Gotcha that trips agents: Mistral OCR wants a URL it can fetch. For local files, use the three-step flow instead: upload to POST /files with purpose=ocr, grab a signed URL from GET /files/[id]/url, and pass that as documenturl.

Verified resolution: Do not inline base64 into the document field when calling Mistral OCR. Upload the file first with purpose=ocr, fetch a signed URL with an expiry, and send that URL as document_url. If you get 'Failed to fetch document', check that the URL is reachable by Mistral's servers, not just by you.

Source URL: https://github.com/mistralai/platform-docs-public/issues/269

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_OXU6XG8kp7p9jLA8zlWxbQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Mistral OCR: inline base64 fails with &#39;Failed to fetch document&#39; <span>— Vectle</span></a>