{"openapi":"3.1.0","info":{"title":"Mistral","version":"1.0.0","description":"Document OCR and structured extraction with Mistral Document AI — PDF to markdown, image OCR, structured field extraction, and file upload.","contact":{"email":"support@payweave.app"},"x-guidance":"Document OCR and structured extraction with Mistral Document AI — PDF to markdown, image OCR, structured field extraction, and file upload.\nEach endpoint takes a JSON request and returns either a 200 with the result or a 402 Payment Required challenge (MPP / x402). Pricing is fixed per endpoint in USD; the per-operation `x-payment-info` block carries the exact challenge metadata (price, accepted protocols, payment realm).\nFor per-endpoint schemas, examples, and detailed usage, fetch https://api.payweave.app/app/app_fshx9kdvgsdw8cnb0n9naz2t/skill.md or `<this-origin>/<path>/skill.md` for a single endpoint."},"x-service-info":{"categories":["Documents","OCR","Data extraction"]},"servers":[{"url":"https://mistral.payweave.services"}],"paths":{"/ocr":{"post":{"summary":"Mistral: OCR","description":"Run Mistral OCR (mistral-ocr-latest) on a document or image URL and get markdown per page, plus optional structured annotations. Mirrors POST api.mistral.ai/v1/ocr: same request and response shape, swap only the host. Price is $0.01 per page, or $0.02 per page when any annotation option is set. pages accepts an array like [0, 1, 2] or a range string like \"0,2-4\"; omit it to process the whole document, in which case the service counts the PDF pages itself before quoting the price (PPTX/DOCX need explicit pages; max 1000 pages per call). Image inputs always count as one page. The body is validated before charging, and upstream failures (including pages past the end of the document) are refunded automatically. For private files, upload to storage.payweave.services first and pass the returned URL.","x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.010000"},"protocols":[{"mpp":{"method":"tempo","intent":"charge","currency":"0x20c000000000000000000000b9537d11c60e8b50","network":"eip155:4217","amount":"10000"}},{"mpp":{"method":"solana","intent":"charge","currency":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v","network":"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","amount":"10000"}},{"x402":{"scheme":"exact","network":"eip155:8453","currency":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","amount":"10000","extra":{"name":"USD Coin","version":"2"}}},{"x402":{"scheme":"exact","network":"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","currency":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v","amount":"10000"}}],"description":"Run Mistral OCR (mistral-ocr-latest) on a document or image URL and get markdown per page, plus optional structured annotations. Mirrors POST api.mistral.ai/v1/ocr: same request and response shape, swap only the host. Price is $0.01 per page, or $0.02 per page when any annotation option is set. pages accepts an array like [0, 1, 2] or a range string like \"0,2-4\"; omit it to process the whole document, in which case the service counts the PDF pages itself before quoting the price (PPTX/DOCX need explicit pages; max 1000 pages per call). Image inputs always count as one page. The body is validated before charging, and upstream failures (including pages past the end of the document) are refunded automatically. For private files, upload to storage.payweave.services first and pass the returned URL."},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"pages":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer"},"markdown":{"type":"string"},"images":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":true}},"dimensions":{"anyOf":[{"type":"object","properties":{"dpi":{"type":"number"},"height":{"type":"number"},"width":{"type":"number"}},"required":["dpi","height","width"],"additionalProperties":false},{"type":"null"}]}},"required":["index","markdown"],"additionalProperties":true}},"model":{"type":"string"},"document_annotation":{"type":["string","null"]},"usage_info":{"type":"object","properties":{"pages_processed":{"type":"integer"},"doc_size_bytes":{"type":["number","null"]}},"required":["pages_processed"],"additionalProperties":true}},"required":["pages","model","usage_info"],"additionalProperties":true}}}},"402":{"description":"Payment Required"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"model":{"type":["string","null"],"description":"Mistral OCR model id. Defaults to mistral-ocr-latest."},"include_image_base64":{"type":["boolean","null"],"description":"Return base64 image data for images extracted from the document"},"image_limit":{"anyOf":[{"type":"integer","exclusiveMinimum":0},{"type":"null"}],"description":"Maximum number of images to extract"},"image_min_size":{"anyOf":[{"type":"integer","exclusiveMinimum":0},{"type":"null"}],"description":"Minimum height and width, in pixels, for an image to be extracted"},"bbox_annotation_format":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["text","json_object","json_schema"]}},"required":["type"],"additionalProperties":true},{"type":"null"}],"description":"Structured format for per-image bbox annotations (upstream accepts json_schema only). Setting this prices the call at the annotation rate."},"document_annotation_format":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["text","json_object","json_schema"]}},"required":["type"],"additionalProperties":true},{"type":"null"}],"description":"Structured format for a whole-document annotation (upstream accepts json_schema only). Setting this prices the call at the annotation rate."},"document_annotation_prompt":{"type":["string","null"],"description":"Optional prompt guiding structured extraction over the whole document. Requires document_annotation_format. Setting this prices the call at the annotation rate."},"table_format":{"anyOf":[{"type":"string","enum":["markdown","html"]},{"type":"null"}],"description":"Output format for extracted tables"},"extract_header":{"type":"boolean","description":"Extract page headers separately"},"extract_footer":{"type":"boolean","description":"Extract page footers separately"},"confidence_scores_granularity":{"anyOf":[{"type":"string","enum":["word","page"]},{"type":"null"}],"description":"Granularity for OCR confidence scores: \"word\" (per-word) or \"page\" (aggregate only). Omit for no confidence scores."},"document":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","const":"document_url"},"document_url":{"type":"string","format":"uri","description":"Publicly reachable URL of a PDF, PPTX, or DOCX document"},"document_name":{"type":"string","description":"Optional display name for the document"}},"required":["type","document_url"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"image_url"},"image_url":{"type":"string","format":"uri","description":"Publicly reachable URL of a PNG, JPEG, or AVIF image"}},"required":["type","image_url"],"additionalProperties":false}],"description":"The document or image to process"},"pages":{"anyOf":[{"anyOf":[{"type":"array","items":{"type":"integer","minimum":0},"maxItems":1000},{"type":"string","pattern":"^\\d+(-\\d+)?(,\\d+(-\\d+)?)*$"}]},{"type":"null"}],"description":"0-indexed pages to process: an array like [0, 1, 2] or a range string like \"0,2-4\", same grammar as upstream (max 1000 distinct pages per call). Each distinct page adds to the price. Omit (or send null or []) to process the whole document: the service then counts the PDF pages itself and prices the full document. PPTX and DOCX inputs must pass explicit pages since their page count depends on rendering. Ignored for image inputs, which always count as one page. Requesting pages beyond the end of the document may fail upstream, in which case the charge is refunded automatically."}},"required":["document"],"additionalProperties":false}}}}}},"/ocr/image":{"post":{"summary":"Mistral: OCR Image","description":"Run Mistral OCR on a single image (PNG, JPEG, or AVIF) by URL and get the text back as markdown. $0.01 flat, or $0.02 when any annotation option is set. Works on photos of receipts, tickets, signs, screenshots, and scanned pages. Same engine as POST /ocr (which also handles PDFs and mirrors api.mistral.ai/v1/ocr); use POST /ocr/upload to send a local image file instead of a URL. The body is validated before charging and upstream failures are refunded automatically.","x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.010000"},"protocols":[{"mpp":{"method":"tempo","intent":"charge","currency":"0x20c000000000000000000000b9537d11c60e8b50","network":"eip155:4217","amount":"10000"}},{"mpp":{"method":"solana","intent":"charge","currency":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v","network":"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","amount":"10000"}},{"x402":{"scheme":"exact","network":"eip155:8453","currency":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","amount":"10000","extra":{"name":"USD Coin","version":"2"}}},{"x402":{"scheme":"exact","network":"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","currency":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v","amount":"10000"}}],"description":"Run Mistral OCR on a single image (PNG, JPEG, or AVIF) by URL and get the text back as markdown. $0.01 flat, or $0.02 when any annotation option is set. Works on photos of receipts, tickets, signs, screenshots, and scanned pages. Same engine as POST /ocr (which also handles PDFs and mirrors api.mistral.ai/v1/ocr); use POST /ocr/upload to send a local image file instead of a URL. The body is validated before charging and upstream failures are refunded automatically."},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"pages":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer"},"markdown":{"type":"string"},"images":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":true}},"dimensions":{"anyOf":[{"type":"object","properties":{"dpi":{"type":"number"},"height":{"type":"number"},"width":{"type":"number"}},"required":["dpi","height","width"],"additionalProperties":false},{"type":"null"}]}},"required":["index","markdown"],"additionalProperties":true}},"model":{"type":"string"},"document_annotation":{"type":["string","null"]},"usage_info":{"type":"object","properties":{"pages_processed":{"type":"integer"},"doc_size_bytes":{"type":["number","null"]}},"required":["pages_processed"],"additionalProperties":true}},"required":["pages","model","usage_info"],"additionalProperties":true}}}},"402":{"description":"Payment Required"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"image_url":{"type":"string","format":"uri","description":"Publicly reachable URL of a PNG, JPEG, or AVIF image, or a data: URI"},"model":{"type":["string","null"],"description":"Mistral OCR model id. Defaults to mistral-ocr-latest."},"include_image_base64":{"type":["boolean","null"],"description":"Return base64 image data for images extracted from the document"},"image_limit":{"anyOf":[{"type":"integer","exclusiveMinimum":0},{"type":"null"}],"description":"Maximum number of images to extract"},"image_min_size":{"anyOf":[{"type":"integer","exclusiveMinimum":0},{"type":"null"}],"description":"Minimum height and width, in pixels, for an image to be extracted"},"bbox_annotation_format":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["text","json_object","json_schema"]}},"required":["type"],"additionalProperties":true},{"type":"null"}],"description":"Structured format for per-image bbox annotations (upstream accepts json_schema only). Setting this prices the call at the annotation rate."},"document_annotation_format":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["text","json_object","json_schema"]}},"required":["type"],"additionalProperties":true},{"type":"null"}],"description":"Structured format for a whole-document annotation (upstream accepts json_schema only). Setting this prices the call at the annotation rate."},"document_annotation_prompt":{"type":["string","null"],"description":"Optional prompt guiding structured extraction over the whole document. Requires document_annotation_format. Setting this prices the call at the annotation rate."},"table_format":{"anyOf":[{"type":"string","enum":["markdown","html"]},{"type":"null"}],"description":"Output format for extracted tables"},"extract_header":{"type":"boolean","description":"Extract page headers separately"},"extract_footer":{"type":"boolean","description":"Extract page footers separately"},"confidence_scores_granularity":{"anyOf":[{"type":"string","enum":["word","page"]},{"type":"null"}],"description":"Granularity for OCR confidence scores: \"word\" (per-word) or \"page\" (aggregate only). Omit for no confidence scores."}},"required":["image_url"],"additionalProperties":false}}}}}},"/ocr/upload":{"post":{"summary":"Mistral: OCR Upload","description":"Upload a file directly via multipart/form-data and run Mistral OCR on it — no hosting step needed. Same pricing as POST /ocr: $0.01 per page, $0.02 per page with annotation options. Fields: file (PDF or PNG/JPEG/AVIF image, max 50 MB), pages (optional, a range string like \"0,2-4\" or JSON array string like \"[0,1]\"; omit to process the whole PDF, counted from the uploaded bytes, max 25 MB for whole-document pricing), and options (optional JSON object string with the same option fields as POST /ocr). Images always count as one page. The body is validated before charging and upstream failures are refunded automatically.","x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.010000"},"protocols":[{"mpp":{"method":"tempo","intent":"charge","currency":"0x20c000000000000000000000b9537d11c60e8b50","network":"eip155:4217","amount":"10000"}},{"mpp":{"method":"solana","intent":"charge","currency":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v","network":"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","amount":"10000"}},{"x402":{"scheme":"exact","network":"eip155:8453","currency":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","amount":"10000","extra":{"name":"USD Coin","version":"2"}}},{"x402":{"scheme":"exact","network":"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","currency":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v","amount":"10000"}}],"description":"Upload a file directly via multipart/form-data and run Mistral OCR on it — no hosting step needed. Same pricing as POST /ocr: $0.01 per page, $0.02 per page with annotation options. Fields: file (PDF or PNG/JPEG/AVIF image, max 50 MB), pages (optional, a range string like \"0,2-4\" or JSON array string like \"[0,1]\"; omit to process the whole PDF, counted from the uploaded bytes, max 25 MB for whole-document pricing), and options (optional JSON object string with the same option fields as POST /ocr). Images always count as one page. The body is validated before charging and upstream failures are refunded automatically."},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"pages":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer"},"markdown":{"type":"string"},"images":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":true}},"dimensions":{"anyOf":[{"type":"object","properties":{"dpi":{"type":"number"},"height":{"type":"number"},"width":{"type":"number"}},"required":["dpi","height","width"],"additionalProperties":false},{"type":"null"}]}},"required":["index","markdown"],"additionalProperties":true}},"model":{"type":"string"},"document_annotation":{"type":["string","null"]},"usage_info":{"type":"object","properties":{"pages_processed":{"type":"integer"},"doc_size_bytes":{"type":["number","null"]}},"required":["pages_processed"],"additionalProperties":true}},"required":["pages","model","usage_info"],"additionalProperties":true}}}},"402":{"description":"Payment Required"}},"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"description":"The document (PDF) or image (PNG, JPEG, AVIF) to process"},"pages":{"anyOf":[{"anyOf":[{"type":"array","items":{"type":"integer","minimum":0},"maxItems":1000},{"type":"string","pattern":"^\\d+(-\\d+)?(,\\d+(-\\d+)?)*$"}]},{"type":"null"}],"description":"Same semantics as POST /ocr pages, as a form field: a range string like \"0,2-4\" or a JSON array string like \"[0, 1, 2]\". Omit to process the whole document (PDF page count is determined from the uploaded bytes; images always count as one page)."},"options":{"type":"object","properties":{"model":{"type":["string","null"],"description":"Mistral OCR model id. Defaults to mistral-ocr-latest."},"include_image_base64":{"type":["boolean","null"],"description":"Return base64 image data for images extracted from the document"},"image_limit":{"anyOf":[{"type":"integer","exclusiveMinimum":0},{"type":"null"}],"description":"Maximum number of images to extract"},"image_min_size":{"anyOf":[{"type":"integer","exclusiveMinimum":0},{"type":"null"}],"description":"Minimum height and width, in pixels, for an image to be extracted"},"bbox_annotation_format":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["text","json_object","json_schema"]}},"required":["type"],"additionalProperties":true},{"type":"null"}],"description":"Structured format for per-image bbox annotations (upstream accepts json_schema only). Setting this prices the call at the annotation rate."},"document_annotation_format":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["text","json_object","json_schema"]}},"required":["type"],"additionalProperties":true},{"type":"null"}],"description":"Structured format for a whole-document annotation (upstream accepts json_schema only). Setting this prices the call at the annotation rate."},"document_annotation_prompt":{"type":["string","null"],"description":"Optional prompt guiding structured extraction over the whole document. Requires document_annotation_format. Setting this prices the call at the annotation rate."},"table_format":{"anyOf":[{"type":"string","enum":["markdown","html"]},{"type":"null"}],"description":"Output format for extracted tables"},"extract_header":{"type":"boolean","description":"Extract page headers separately"},"extract_footer":{"type":"boolean","description":"Extract page footers separately"},"confidence_scores_granularity":{"anyOf":[{"type":"string","enum":["word","page"]},{"type":"null"}],"description":"Granularity for OCR confidence scores: \"word\" (per-word) or \"page\" (aggregate only). Omit for no confidence scores."}},"additionalProperties":false,"description":"Optional JSON object string with the same option fields as POST /ocr (model, include_image_base64, image_limit, image_min_size, bbox_annotation_format, document_annotation_format, document_annotation_prompt, table_format, extract_header, extract_footer, confidence_scores_granularity). Annotation options price the call at the annotation rate."}},"required":["file"],"additionalProperties":false}}}}}}}}