Bind Mistral Batch custom_id to One Request and One Owner
Mistral batch input uses custom_id to correlate each submitted request with its eventual result. The application should generate that identifier server-side, bind it to one authenticated owner and request digest, enforce uniqueness inside the batch, and reconcile every success, error and missing row before releasing output.

Mistral batch processing uses custom_id to connect an input request with its eventual output. The Mistral Batch Processing guide shows each batch row carrying a caller-defined identifier alongside the HTTP method, endpoint and request body. That field becomes the application's reconciliation field after asynchronous processing. It should identify an enterprise request record, not expose a customer email or accept a browser-generated value on trust.
A batch that finishes successfully can still be operationally wrong when two rows share one identifier.
TL;DR
- Generate each Mistral batch
custom_idon the server and bind it to one authenticated principal, route and canonical request digest. - Enforce uniqueness within the submitted file and within the application's active reconciliation window.
- Match outputs and errors by identifier, reject duplicates or unknown values, and account for every submitted row.
- Release a result only after ownership, request binding, terminal status and output policy all pass.
The identifier belongs to the enterprise record
The Mistral Batch API reference defines the asynchronous job around an uploaded input file and target endpoint. The enterprise needs a durable record before creating that job. Generate a random or structured opaque identifier on the server, then store its authenticated owner, tenant, route, canonical body digest, exact model, input file, batch job reference and creation time.
Keep personal and confidential data out of the identifier. Batch files, provider dashboards and logs can expose correlation fields more widely than prompt content. An opaque value gives operators a join field without turning the key into another data leak.
The batch input validation guide covers the file-level gate for another provider. The same operational requirement applies here: every line must be attributable before upload.
Uniqueness is checked before submission
Parse the complete input file before it leaves the enterprise boundary. Reject missing identifiers, duplicate custom_id values, identifiers already active in another job under the same namespace, unsupported endpoints and bodies that fail route policy. Count accepted rows and compute a digest of the final file.
Namespace the enterprise record by tenant and operation internally, while sending an opaque provider value. Never rely on line order for later matching. A provider may produce output and error files in a different order, and retries can generate a second job for a subset of requests.
On the operator screen, show submitted rows as narrow white cards with the opaque ID, route and owner alias. Duplicate IDs should turn both cards red before the upload button becomes active. That is a concrete release gate, not a warning buried in a job log.
The per-route policy guide provides the model, endpoint and request constraints that should be resolved for each row.
Reconciliation accounts for every row
When the job reaches a terminal state, download the provider artifacts through the approved path and parse every result. For each custom_id, locate exactly one enterprise record. Verify the Mistral job reference, tenant, route and expected request digest before attaching output. Unknown and duplicate identifiers enter a hold queue.
Build a ledger with one terminal outcome per submitted row: succeeded, provider error, missing, duplicate, unknown, withheld by output policy, or awaiting retry. The sum must equal the accepted input count before the job is marked reconciled. A provider job marked completed describes processing state. It does not prove that the application safely delivered every result.
Run output validation and data policy before releasing content to the owner. The AI audit log schema guide supplies the identity, model and policy fields around each row-level decision.
Retry creates a new provider attempt
A retry should preserve the enterprise request record and create a distinct provider attempt. Generate a new custom_id or a documented attempt-specific derivation when the provider namespace requires uniqueness, then link both attempts in the internal ledger. Avoid overwriting the first error because investigators need to see the sequence.
Test the reconciliation path with deliberate faults.
- Submit two rows with the same identifier.
- Return one unknown identifier in the output artifact.
- Omit one accepted row from both output and error artifacts.
- Place the same identifier in success and error data.
- Attach a result to the wrong batch job reference.
- Retry one failed row under a new attempt.
- Complete a result after the authenticated owner loses route access.
- Return sensitive content that output policy blocks.
Assert that held results never reach another tenant or downstream workflow. Record the job, file digest, submitted count, terminal counts, row binding, output-policy result and retry lineage.
DeepInspect
DeepInspect can enforce row-level request policy on authenticated Mistral HTTP traffic deliberately routed through its proxy and write the submission decision beside the enterprise correlation record. It can also apply output policy when batch results return through a managed HTTP path.
Application teams own file construction, identifier uniqueness, job polling, reconciliation and delivery authorization. Mistral runs the provider-side batch service. Files moved outside the proxy, local jobs and direct provider traffic remain outside DeepInspect's enforcement boundary.
Book a technical deep dive at deepinspect.ai.
Frequently asked questions
- Reconciliation stays incomplete until each accepted input has exactly one terminal row-level outcome.
The answers below cover identifier exposure, the required uniqueness window, result matching, and the authorization check that happens after a batch finishes but before any output reaches its owner.
- Can custom_id contain a database primary key?
An internal primary key may reveal tenancy, volume or record structure in provider-visible artifacts. Prefer an opaque value and keep the database join in the enterprise record. If a structured key is unavoidable, document its exposure and exclude personal or confidential content.
- Is uniqueness required across all time?
Enforce uniqueness across the active provider and reconciliation window at minimum. Long-term evidence should still identify attempts unambiguously. A globally unique opaque value removes ambiguity and costs little.
- Can results be matched by line order?
Match results with
custom_idbecause asynchronous processing and separate error artifacts make positional matching fragile. The identifier should map to one expected request record, and reconciliation should reject any second result for that binding.- What happens if access changes while the batch runs?
Re-evaluate delivery authorization before releasing the output. Preserve the original submission decision and the current delivery decision as separate events. A principal approved yesterday may lose access before the provider finishes.