NativePort Mistral API

The mistral API from NativePort — 1 operation(s) for mistral.

GitHub OpenAPI

Operations 1

POST /mistral/v1/ocr OCR a document or image (Document AI) #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/nativeport-ai:nativeport-ai-mistral-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

nativeport-ai-mistral-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Reference Mistral API
  version: 1.0.0
servers:
- url: https://api.nativeport.ai
  description: NativePort production
- url: http://localhost:8787
  description: Local development (wrangler dev)
tags:
- name: mistral
paths:
  /mistral/v1/ocr:
    post:
      operationId: mistral_ocr
      summary: OCR a document or image (Document AI)
      description: 'Relays to `https://api.mistral.ai/v1/ocr`, injecting the `Authorization: Bearer` credential.

        Extracts the selected pages of a PDF (or a single image) as per-page markdown, optionally

        with structured annotations pulled from the same pass. This is the only mounted Mistral

        route — every other Mistral path answers the gateway''s own `404`, this one included under any

        other method or with a trailing slash.


        Unlike the transparent routes in this spec, the body is a closed allow-set and the forwarded

        request is rebuilt from it:


        - `model` is pinned to `mistral-ocr-4-0`. Send it or omit it; any other value — including the

        `mistral-ocr-latest` alias — is a `400`.

        - `document` must be a `document_url` chunk (optionally with a `document_name`) or an

        `image_url` chunk, carrying a public `https` URL. Mistral''s `file_id` chunk is denied: the

        shared account key behind this route would make one client''s uploaded file readable by all.

        - `pages` is **required** and selects at most 100 unique, zero-based page indices — an

        integer array, or a string of comma-separated indices and `start-end` ranges. It is the

        cost basis the balance preflight prices, which is why the route asks for it up front

        instead of defaulting to the whole document.

        - `include_blocks` and `include_image_base64` are always forwarded as `false`; asking for

        `true` is a `400`, as are `image_limit` and `image_min_size`, and so is any field the

        policy doesn''t recognize.

        - Adding `document_annotation_format` or `bbox_annotation_format` prices the whole call at

        the Document AI rate ($5.275 per 1,000 pages) instead of the OCR rate

        ($4.22 per 1,000 pages), both with the gateway''s 5.5% fee included; the two rates never

        stack, and `document_annotation_prompt` alone does not change the rate.


        Mistral''s answer comes back exactly as it arrived — status, headers, and body bytes — and the

        charge is settled from the `usage_info.pages_processed` it reports. There is no retry: a

        second attempt is yours to make, as a separate, separately billed request.'
      tags:
      - mistral
      responses:
        '200':
          description: 'Mistral''s own OCR result, relayed byte-for-byte — one entry per processed page, plus the

            `usage_info.pages_processed` count the charge is settled from. Fields the request asked for

            (`document_annotation`, per-image `image_annotation`) appear alongside; `image_base64` is

            always `null`, since the gateway forwards `include_image_base64: false`.

            '
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MistralOcrResponse'
        '400':
          description: 'The gateway''s own closed body policy rejected the call before it reached Mistral — a missing or

            out-of-bounds `pages` selection, a `document` that isn''t one of the two admitted URL chunks (or

            whose URL isn''t a public `https` one), an aliased or unknown `model`, a query parameter (none

            are permitted), a request for a forced-`false` or denied field, or anything else the policy

            doesn''t recognize. Plain gateway-shaped error, not Mistral''s own envelope, since Mistral was

            never reached — and nothing is billed.

            '
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: 'The bearer token was missing, unknown, or revoked. The reply body is the JSON `{ "error": "Unauthorized." }`.

            '
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '402':
          description: "Insufficient credits — two distinct checks, at two layers, can answer this status:\n\n- **The account-wide credit gate**, shared by every route in this spec (see [Common\n  responses](/api-reference)), rejects the call before the OCR policy runs at all if the\n  account balance is zero or negative.\n- **The per-request balance preflight**, this route's page-priced form of the per-request\n  cost preflight that every priced route in this spec runs: the selected page count times the\n  applicable per-page rate is compared with the remaining balance *before* the upstream\n  request, and a job that doesn't fit is refused rather than forwarded. The message names the\n  price in microcredits and the number of pages selected, so the fix — top up, or select\n  fewer pages — is unambiguous. Nothing is charged either way.\n"
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: 'No route matched the path, or the matched route disallows that method (an unlisted

            `/serper/<endpoint>`, for instance). The body lists every mounted route, verbatim as the

            gateway sends it. A path on one of the four model-inference routes also `404`s this way when

            the specific endpoint or model isn''t on that provider''s allowlist; an unsupported model

            addressed through `/inference` gets that endpoint''s own `400` instead (see the Inference tag).

            '
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      requestBody:
        description: 'The OCR request. A closed allow-set: `document` and `pages` are required, every other field

          below is optional, and anything not listed is rejected with a `400` before Mistral is called.

          '
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MistralOcrRequest'
      security:
      - bearerAuth: []
components:
  schemas:
    MistralAnnotationFormatJsonSchema:
      type: object
      properties:
        name:
          type: string
          pattern: ^[A-Za-z0-9_-]{1,64}$
          description: A short identifier for the schema — 1–64 letters, digits, `_`, or `-`.
        schema:
          type: object
          additionalProperties:
            description: Any type
          description: The JSON Schema describing what to extract.
        description:
          type: string
        strict:
          type: boolean
      required:
      - name
      - schema
      title: MistralAnnotationFormatJsonSchema
    MistralOcrRequestConfidenceScoresGranularity:
      type: string
      enum:
      - page
      description: Ask for per-page confidence scores. Only `page` (or `null`) is admitted; Mistral's `word` granularity is denied, since a score per word multiplies the response size without changing what is metered.
      title: MistralOcrRequestConfidenceScoresGranularity
    MistralOcrRequestDocument:
      oneOf:
      - $ref: '#/components/schemas/MistralDocumentUrlChunk'
      - $ref: '#/components/schemas/MistralImageUrlChunk'
      description: What to read — one of the two admitted URL chunks. Mistral's third chunk type, a `file_id` handle to a file on the account, is denied.
      title: MistralOcrRequestDocument
    MistralDocumentUrlChunk:
      type: object
      properties:
        type:
          type: string
          enum:
          - document_url
        document_url:
          type: string
          format: uri
          maxLength: 2048
          description: 'A public `https` URL — signed, time-limited links are the intended use. Refused: any other

            scheme, an embedded `user:password`, an IP-literal host in any spelling, a single-label or

            `.localhost`/`.local`/`.internal` hostname.

            '
        document_name:
          type: string
          pattern: ^[A-Za-z0-9._()-]+$
          maxLength: 256
          description: Optional label Mistral echoes back in its response. A plain filename — letters, digits, `.`, `_`, `-`, and parentheses; no spaces, quotes, or path separators.
      required:
      - type
      - document_url
      description: A document (PDF and the other formats Mistral's OCR accepts) that Mistral fetches itself, from its own network, at the URL you give it.
      title: MistralDocumentUrlChunk
    MistralOcrResponse:
      type: object
      properties:
        pages:
          type: array
          items:
            $ref: '#/components/schemas/MistralOcrResponsePagesItems'
          description: One entry per processed page, in page order.
        model:
          type: string
          description: The model that ran — always the pinned OCR model.
        document_annotation:
          description: The whole-document annotation when `document_annotation_format` was sent, `null` otherwise.
        usage_info:
          $ref: '#/components/schemas/MistralOcrResponseUsageInfo'
          description: Mistral's own accounting for the call.
      description: Mistral's own OCR result, relayed as received. The gateway reads `usage_info.pages_processed` to settle the charge and changes nothing.
      title: MistralOcrResponse
    MistralImageUrlChunk:
      type: object
      properties:
        type:
          type: string
          enum:
          - image_url
        image_url:
          type: string
          format: uri
          maxLength: 2048
          description: A public `https` URL, under the same URL policy as `document_url`.
      required:
      - type
      - image_url
      description: A single image to read, fetched by Mistral from the URL you give it.
      title: MistralImageUrlChunk
    MistralOcrRequestPages:
      oneOf:
      - type: array
        items:
          type: integer
          minimum: 0
          maximum: 9999
      - type: string
        maxLength: 1000
      description: 'Which pages to read — **required**, and the basis for both the balance preflight and the

        charge. Zero-based, at most 100 unique pages per request, and each index at most 9999. A

        repeated or overlapping selection is refused rather than deduplicated, so a request always

        costs what it looks like it costs. Either spelling works: an integer array, or a string of

        comma-separated indices and ascending `start-end` ranges.

        '
      title: MistralOcrRequestPages
    MistralOcrRequest:
      type: object
      properties:
        model:
          type: string
          enum:
          - mistral-ocr-4-0
          description: Pinned. Optional to send, but no other value — including the `mistral-ocr-latest` alias — is accepted, because an alias can re-point to a model at a different price.
        document:
          $ref: '#/components/schemas/MistralOcrRequestDocument'
          description: What to read — one of the two admitted URL chunks. Mistral's third chunk type, a `file_id` handle to a file on the account, is denied.
        pages:
          $ref: '#/components/schemas/MistralOcrRequestPages'
          description: 'Which pages to read — **required**, and the basis for both the balance preflight and the

            charge. Zero-based, at most 100 unique pages per request, and each index at most 9999. A

            repeated or overlapping selection is refused rather than deduplicated, so a request always

            costs what it looks like it costs. Either spelling works: an integer array, or a string of

            comma-separated indices and ascending `start-end` ranges.

            '
        table_format:
          $ref: '#/components/schemas/MistralOcrRequestTableFormat'
          description: How tables come back in the page markdown. `null` leaves Mistral's own default in place.
        extract_header:
          type: boolean
          description: Whether page headers are extracted alongside the body text.
        extract_footer:
          type: boolean
          description: Whether page footers are extracted alongside the body text.
        confidence_scores_granularity:
          $ref: '#/components/schemas/MistralOcrRequestConfidenceScoresGranularity'
          description: Ask for per-page confidence scores. Only `page` (or `null`) is admitted; Mistral's `word` granularity is denied, since a score per word multiplies the response size without changing what is metered.
        include_blocks:
          type: boolean
          enum:
          - false
          description: Always forwarded as `false`. Sending `true` is rejected rather than silently rewritten.
        include_image_base64:
          type: boolean
          enum:
          - false
          description: Always forwarded as `false`. Sending `true` is rejected rather than silently rewritten — extracted image bytes are neither metered nor buffered here.
        document_annotation_format:
          $ref: '#/components/schemas/MistralAnnotationFormat'
        bbox_annotation_format:
          $ref: '#/components/schemas/MistralAnnotationFormat'
        document_annotation_prompt:
          type: string
          minLength: 1
          maxLength: 2000
          description: Plain-language instructions for the annotation pass. On its own it does not change the rate — only an annotation format does.
      required:
      - document
      - pages
      description: 'The admitted OCR request. `document` and `pages` are required; unlisted fields are rejected

        with a `400`, and the request forwarded upstream is rebuilt from exactly these fields.

        '
      title: MistralOcrRequest
    Error:
      type: object
      properties:
        error:
          type: string
          description: Explanatory message meant for humans.
      required:
      - error
      title: Error
    MistralOcrResponsePagesItems:
      type: object
      properties:
        index:
          type: integer
          description: The zero-based page index this entry came from.
        markdown:
          type: string
          description: The page's extracted text as markdown, tables included.
        images:
          type: array
          items:
            type: object
            additionalProperties:
              description: Any type
          description: Figures detected on the page, with their bounding boxes. `image_base64` is always `null` here; `image_annotation` carries the per-figure result when `bbox_annotation_format` was sent.
        dimensions:
          type: object
          additionalProperties:
            description: Any type
          description: The page's rendered size, as Mistral reports it.
      title: MistralOcrResponsePagesItems
    MistralAnnotationFormat:
      type: object
      properties:
        type:
          type: string
          enum:
          - json_schema
        json_schema:
          $ref: '#/components/schemas/MistralAnnotationFormatJsonSchema'
      required:
      - type
      - json_schema
      description: 'Mistral''s `json_schema` response format, at most 8,192 bytes serialized. Used for both

        `document_annotation_format` (fields drawn from the whole document) and

        `bbox_annotation_format` (labels for each detected figure); either one prices the call at the

        Document AI rate.

        '
      title: MistralAnnotationFormat
    MistralOcrRequestTableFormat:
      type: string
      enum:
      - markdown
      - html
      description: How tables come back in the page markdown. `null` leaves Mistral's own default in place.
      title: MistralOcrRequestTableFormat
    MistralOcrResponseUsageInfo:
      type: object
      properties:
        pages_processed:
          type: integer
          description: How many pages Mistral processed — the figure the charge is settled from.
        doc_size_bytes:
          type: integer
          description: Size of the fetched document, as Mistral measured it.
      description: Mistral's own accounting for the call.
      title: MistralOcrResponseUsageInfo
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Your per-client bearer token — the API key the gateway issued to you. Present it in

        `Authorization: Bearer <token>` form. A token that is missing, unknown, or revoked draws a

        `401`. Before the call is sent upstream the token is removed (stripped, or swapped for the

        upstream''s own credential); it never makes it past the gateway.

        '