Validate Every Mistral Batch Endpoint Before Upload
A Mistral batch file can carry many asynchronous API requests, so each row needs an approved method, endpoint, model and body contract before upload. This guide defines row-level route validation and evidence.

A Mistral batch file contains a collection of API requests processed later. Each row carries its own method, endpoint path, identifier and request body. The gateway should validate every row against an approved operation manifest before the file is uploaded or the batch job is created.
One wrong path in a 10,000-line JSONL file can hide between valid requests. A green check on the outer job is too broad.
TL;DR
- Parse every Mistral batch row and allow only the reviewed method, endpoint, model and body contract for the authenticated route.
- Reject the complete file or quarantine named rows when an endpoint is unknown, mismatched or outside the job purpose.
- Record row identifiers, endpoint decisions, manifest versions and file digests without copying sensitive request bodies into general logs.
- Revalidate result delivery because an approved submission does not prove that the original owner may still receive every output.
The endpoint is row-level policy
The Mistral batch-processing guide defines each request with a unique custom_id, an HTTP method, a URL and a body. Mistral's Batch API reference exposes operations to create, inspect, cancel and delete jobs. The file describes model work, while the job API manages its asynchronous lifecycle.
That split creates two policy layers. The outer job route can allow batch creation for one authenticated role. Each inner row still needs an approved inference endpoint and body. A job labeled for embeddings should reject a chat-completion row, even when both endpoint types are available to the same Mistral account.
Build a server-owned endpoint registry. For each route, name the exact path, method, model set, body schema, maximum payload, permitted options and output class. Compare normalized paths with exact registry entries. Reject absolute URLs, query-string tricks, encoded traversal and aliases absent from the registry.
Validation happens before upload
Read the file through a byte and row limit. Parse one JSON object at a time, require a unique custom_id, then validate the method, URL and body. Keep the provider upload on hold until the complete file has reached a terminal validation outcome.
Avoid silent rewriting. Changing an unsupported path into a nearby approved path alters the caller's request and hides an integration error. Return the row identifier, rule and expected contract. The source file should remain available only under its approved retention policy.
For every row, verify that the body belongs to the endpoint. A chat path needs a reviewed chat model and message contract. An embeddings path needs its own input limits. Model names, response settings and tools should come from the route manifest or pass an explicit allowlist. The LLM API parameter allowlisting guide covers the body-level control that follows endpoint selection.
On an operator screen, show the file digest and four counters: accepted, blocked, malformed and duplicate identifiers. Put the first blocked row in a red panel with its custom_id, method and URL. The failed contract should be visible before an operator downloads the file.
Choose one failure policy
A strict route rejects the complete batch when any row fails. That policy is simple to explain and preserves the submitted file as one unit. A partitioning route can create a new provider file containing only accepted rows, but it must record a source-to-derived manifest and make blocked rows visible to the owner.
I prefer full-file rejection for security-sensitive workloads. Partial submission can leave a workflow believing all records were processed when three rows never left the gateway.
If partitioning is a documented product feature, preserve the source file digest, derived file digest, accepted and blocked identifiers, transformation version and reason for every exclusion. Never relabel the derived file as the original.
Results keep endpoint provenance
When Mistral finishes the job, correlate each result with the accepted row and its endpoint decision. A response for an unknown identifier or unexpected operation belongs in a hold queue, regardless of a familiar outer job ID.
The batch custom ID correlation guide describes that row binding. Apply current tenant and ownership checks before result release. Preserve endpoint, model, route manifest and provider job ID beside each terminal outcome.
Cancellation and deletion are separate operations. Authorize them against the job owner and current workflow state, then record the decision. Submission permission grants access to that batch alone; another team's cancellation route requires its own authorization.
Tests change one row property
Create a valid mixed-size fixture from the production manifest, then change one field per test.
- Replace the approved URL with another documented Mistral endpoint.
- Change
POSTto another method. - Insert an absolute URL or encoded path variant.
- Use a model outside the endpoint's route allowlist.
- Put chat fields inside an embeddings body.
- Duplicate a
custom_idacross two valid rows. - Add one malformed JSON line after thousands of accepted rows.
- Return a result for an endpoint that was never accepted.
Assert zero provider uploads when strict validation fails. For accepted files, retain the source digest, row count, endpoint distribution, manifest version, authenticated owner, provider file ID and job ID.
DeepInspect
DeepInspect can inspect authenticated Mistral batch HTTP traffic deliberately routed through its proxy and enforce row-level method, endpoint and request-policy decisions before provider upload. It can attach each decision to the enterprise identity and route manifest.
Application teams own file construction, workflow state and result reconciliation. Mistral runs the provider-side batch service. Local files, direct provider calls and traffic outside the proxy remain outside DeepInspect's enforcement boundary.
Book a technical deep dive at deepinspect.ai.
Frequently asked questions
- Can the gateway trust a file generated by its own application?
Validate it at the boundary. Application releases drift, queues replay old payloads and shared storage can hold files from several versions. Deterministic validation also creates the evidence needed to prove which contract reached Mistral.
- Should endpoint paths be normalized?
Apply one documented parser, then compare the resolved form with exact approved entries. Reject ambiguous encodings, unexpected query components and near matches instead of repairing them silently.
- Can one batch contain several endpoint types?
Only when a reviewed route explicitly permits that set and defines body and result handling for each type. A single-purpose batch is simpler to authorize, reconcile and retry.
- What belongs in the decision record?
Record identity, route, source digest, row identifier, normalized method and endpoint, model, manifest version, decision reason, provider file ID and job ID when submission occurs.