Mistral API Key Rotation: Zero-Downtime Rotation and the Leaked-Key Runbook

How to replace a Mistral credential without dropping a request, what to do in the first ten minutes after one leaks, and why a stolen key usually shows up as a rate-limit anomaly rather than an authentication error.

10 min read
Staff Pick

📡 Monitor your APIs — know when they go down before your users do

Better Stack checks uptime every 30 seconds with instant Slack, email & SMS alerts. Free tier available.

Start Free →

Affiliate link — we may earn a commission at no extra cost to you

Getting your first Mistral key working is a five-minute job, and there is asetup guidefor it. This page is about the part nobody writes down: the credential you already have is a liability with an age, and at some point it has to be replaced — on a schedule, when someone leaves, or at 2am because it turned up in a public repository.

Almost every painful key rotation fails for the same structural reason: the team treats it as editing a secret rather than running two credentials in parallel. Editing in place guarantees a window where the deployed configuration and the set of valid keys disagree, and the length of that window is however long your slowest deploy target takes to pick up the change. Overlap eliminates the window entirely.

If your key is leaking right now: issue a replacement first, deploy it, then revoke the old one — unless you can see active abuse, in which case revoke immediately and take the outage. Jump to the leaked-key runbook. If instead you are seeing errors and are not sure whose fault they are, checklive Mistral status first.

Rotation Is a Four-Phase Overlap, Not an Edit

The whole technique is that two Mistral keys are valid at the same time for as long as it takes every consumer to move. Nothing clever happens in any individual step; the safety comes entirely from the order.

PhaseActionDone when
1. InventoryList every place the current key is stored — secret manager, CI variables, serverless config, container env, local .env files, and any third-party tool you pasted it into.The list is written down, not remembered. This is the phase teams skip and the reason rotations half-complete.
2. IssueCreate a second key in the Mistral La Plateforme console, named for its purpose and creation date rather than key2.Both keys return 200 on a test call. Neither has been revoked.
3. Cut overUpdate every location from the inventory, redeploy, and restart anything that reads the credential once at boot.A real API call from each environment succeeds and the old key shows zero usage in the dashboard.
4. RevokeDelete the old key. Not disable-and-forget — delete, so it cannot be re-enabled by someone tidying up later.A deliberate call with the old key returns 401 and nothing in production notices.

Phase 3 is where the discipline lives. "I updated the secret" is not evidence; zero usage on the old key is. A long-running process that read MISTRAL_API_KEY at startup will happily keep using the old credential for days after the secret store was updated, and you will discover this at the exact moment you revoke.

🔐
Recommended

Keep Provider Keys Somewhere You Can Actually Rotate Them

Overlapping rotation only works if you know every location a credential lives in. A managed secret store gives you one authoritative copy and an audit trail, instead of a key copied into six env files and one Slack thread.

Try 1Password Free →

The Mistral-Specific Trap: "The Mistral Key" Is Ambiguous in a Hybrid Stack

Mistral models are reachable through more than one commercial surface. A first-party La Plateforme key authenticates against Mistral's own API. A Mistral deployment running on a cloud marketplace — Azure AI Foundry being the common one — authenticates with a credential issued and rotated by that cloud, in that cloud's portal, on that cloud's identity model. They are different secrets with different lifecycles and different revocation paths.

In a hybrid stack the instruction "rotate the Mistral key" therefore resolves to at least two different procedures, and rotating the La Plateforme key does absolutely nothing to a workload that is calling a cloud-hosted deployment. Worse, it looks like it worked: the first-party traffic keeps flowing on the new key, the cloud-hosted traffic keeps flowing on the old one, and nobody notices the second credential was never touched until an audit or a breach forces the question.

Record the surface alongside every credential in your inventory — first-party or cloud-hosted, and which subscription or workspace issued it. Mistral's first-party keys are workspace-scoped, so the same discipline applies internally: a key issued in one workspace cannot be rotated from another, and a service that was onboarded through a colleague's workspace becomes unrotatable the day that colleague's access is removed.

Reading the Credential So Rotation Is a Config Change

A rotation is only as fast as the slowest consumer, and the slowest consumer is always the one that read the key once, at import time, into a module-level constant. Build every Mistral client from one place, read the credential at call time, and a rotation becomes a config change rather than a redeploy.

// ONE module constructs every Mistral client for the whole codebase.
// Nothing else in the repo reads MISTRAL_API_KEY directly.

function credential() {
  // Read at call time, not at import time — a process that has been
  // running for a week must be able to pick up a rotated key.
  const key = process.env.MISTRAL_API_KEY;
  if (!key) throw new Error('MISTRAL_API_KEY is not set');
  return key;
}

export async function callMistral(path, body) {
  const res = await fetch(`https://api.mistral.ai/v1${path}`, {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${credential()}`,
      'Content-Type': 'application/json',
      // Tag every request with which key issued it. During a rotation
      // this is how you prove the old credential has actually drained.
      'X-Key-Id': process.env.MISTRAL_API_KEY_ID ?? 'unlabelled',
    },
    body: JSON.stringify(body),
  });

  // 401 is fatal. Retrying it during a revocation turns a clean
  // cutover into a retry storm against a dead credential.
  if (res.status === 401) {
    throw new Error('Mistral: credential rejected — rotated or revoked, do not retry');
  }
  return res;
}

The X-Key-Id line is the cheap trick worth stealing. Emit the key identifier — never the key itself — into your own logs, and phase 3 stops being a guess: you can watch traffic on the old identifier fall to zero across every service before you revoke anything.

The Leaked-Key Runbook: First Ten Minutes

A leaked Mistral key is not primarily a security incident with a fixed cost. It is a metered credential that somebody else is now spending, and every minute of deliberation has a price. Work the list in order.

  1. Decide whether to revoke first or rotate first. Visible abuse — usage you cannot attribute, a spend curve that is not yours — means revoke now and accept the outage. No evidence of abuse means rotate first and revoke a few minutes later with no downtime at all.
  2. Issue the replacement in the Mistral La Plateforme console and push it through the same four-phase overlap. Do not shortcut the inventory step just because you are in a hurry; a half-rotated stack under incident pressure is how a ten-minute problem becomes a two-day one.
  3. Delete the exposed key once traffic on it is zero. Delete rather than disable.
  4. Pull the usage record for the entire window the key was exposed — not since you noticed. The exposure started when the secret was written, not when it was found.
  5. Purge the secret from history. A key committed to git is still in the reflog, in forks, in CI caches, and in any build log that echoed the environment. Rewriting the commit is not sufficient on its own, which is precisely why revocation comes first.
  6. Close the process gap. Ask how a credential reached a location your secret store does not control, and fix that. A rotation that does not end in a changed process is a rotation you will be repeating.

Do not skip step 4. The instinct after revoking is relief, and the forensic step gets dropped. But the usage record is the only thing that tells you whether this was a scraped key nobody used or a credential that has been quietly funding somebody else's product for three weeks — and those two incidents have very different disclosure obligations.

How a Compromised Key Actually Presents

This is the part that makes credential incidents hard to spot: almost none of the symptoms look like a security event. Five of the six rows below return a perfectly ordinary HTTP status.

What you seeWhat it looks likeWhat it may actually be
429s on a workload whose volume did not changeCapacity problem — "we need a limit increase"Someone else consuming your quota on your key
Spend up, product metrics flatA regression in prompt length or retry behaviourUnauthorised traffic on a shared credential
Usage on a model your app never callsA stale experiment somebody forgotA third party using your key for their own workload
A flat overnight usage plateauA scheduled batch jobAutomated abuse with no diurnal curve
Latency up across the boardA Mistral-side incidentYour own account queued behind borrowed traffic
401 in one service onlyA deploy problemA half-finished rotation — the real one, and the only row here that is loud

The through-line: with a single shared key, every one of these is indistinguishable from an ordinary engineering problem, and teams reliably spend days debugging the wrong layer. Split keys per workload and the same anomalies become attributable in the first hour, because the usage that does not belong is sitting on a credential with a name.

📡
Recommended

Alert on Usage Shape, Not Just Errors

A compromised key mostly returns 200s. Continuous monitoring of request volume, latency and status-code distribution on your Mistral endpoint turns an invisible spend anomaly into a page.

Try Better Stack Free →

A Rotation Schedule Worth Actually Keeping

  • Every 90 days for production credentials, calendared, with an owner. An unowned schedule is a decoration.
  • On offboarding, for every key the departing person could read — which, if you have a shared secret store, is a bigger list than the one they personally created.
  • On exposure, immediately — including "probably fine" exposure like a screenshot, a support ticket, a pasted log, or a shared no-code workflow. Probability is not a control.
  • Before an audit or a security questionnaire, because the first question is always the age of the credential and the second is when you last practised the procedure.
  • After any incident in which the key was read out of a running environment by a human, even a trusted one.

One more discipline that costs nothing: rotate on a boring Tuesday when nothing is on fire. A rotation procedure that has only ever been executed during an incident is a procedure you are testing in production at the worst possible moment.

Where to Send Traffic If a Revocation Goes Wrong

A botched rotation is an outage you caused, and it deserves the same fallback path as one the provider caused. Each of these runs on separate infrastructure and a separate credential, so a Mistral key problem does not follow you there.

Groq

Separate credential, separate console, separate rotation schedule. Rotating one never rotates the other.

Check Groq status →

Together AI

Separate credential, separate console, separate rotation schedule. Rotating one never rotates the other.

Check Together AI status →

OpenAI

Separate credential, separate console, separate rotation schedule. Rotating one never rotates the other.

Check OpenAI status →

Choosing a destination is its own problem — see thefallback ranking guidefor how to decide whether the answer you get back is worth the same, and thefailover guidefor the cutover mechanics.

Frequently Asked Questions

How do I rotate a Mistral API key without downtime?

Never rotate by editing one secret in place. Issue a second Mistral key alongside the first, deploy it to every consumer, verify with a real API call from each environment that the new key is the one being used, and only then revoke the old key. The overlap window — two valid keys at once — is what makes the rotation safe, because at no point is there a moment where the deployed configuration and the valid credentials disagree.

How often should I rotate Mistral API keys?

On a fixed schedule of 90 days for production credentials, and immediately on three triggers: anyone with access to the key leaves the team, the key was pasted anywhere outside your secret store, or you see usage you cannot attribute. The schedule matters less than the fact that the procedure is practised — a rotation runbook that has never been executed will not work the first time you need it under pressure.

My Mistral API key leaked. What do I do first?

Issue a replacement key first, then revoke the exposed one — in that order, unless you have evidence of active abuse, in which case revoke immediately and accept the outage. Rotating before revoking keeps your service up. After the credential is dead, the work is forensic: check usage for the period the key was exposed, purge it from git history and any build logs or screenshots, and find the process gap that let a secret reach a place your secret store does not control.

How do I tell whether someone else is using my Mistral key?

Look for usage whose shape does not match your product. Unauthorised traffic on a stolen key typically has no diurnal curve, targets models your application does not call, or originates during hours your users are asleep. This is why per-key, per-workload credentials matter: with one shared key every request looks the same, and with keys split per service the anomaly is visible in the first hour.

Will revoking a Mistral key break requests that are already in flight?

Assume yes. Revocation takes effect at the edge and an in-flight request can fail with a 401 mid-stream, which client code often surfaces as a truncated response rather than an authentication error. Revoke during a low-traffic window where you can, drain long-running work first, and make sure your error handling classifies 401 as fatal and non-retryable so a revocation does not turn into a retry storm.

Related Mistral Guides

Know Within Minutes If a Rotation Broke Something

API Status Check monitors Mistral and every other provider in your stack continuously, so a revoked key, a missed consumer and a genuine Mistral incident never look the same again.

Start Your Free Trial →

Alert Pro

14-day free trial

Stop checking — get alerted instantly

Next time Mistral goes down, you'll know in under 60 seconds — not when your users start complaining.

  • Email alerts for Mistral + 9 more APIs
  • $0 charged today — card required to start
  • Cancel anytime — $9/mo after trial

🌐 Can't Access Mistral?

If Mistral is working for others but not for you, it might be an ISP or regional issue. A VPN can help bypass network-level blocks and routing problems.

🔒

Troubleshoot with a VPN

Connect from a different region to test if the issue is local to your network. Also protects your connection on public Wi-Fi.

Try NordVPN — 30-Day Money-Back Guarantee
🔑

Secure Your Mistral Account

Service outages are a common time for phishing attacks. Use a password manager to keep unique, strong passwords for every account.

Try NordPass — Free Password Manager
Quick ISP test: Try accessing Mistral on mobile data (Wi-Fi off). If it works, the issue is with your ISP or local network.

⏳ While You Wait — Try These Alternatives

🛠 Tools We Use & Recommend

Tested across our own infrastructure monitoring 200+ APIs daily

SEMrushBest for SEO

SEO & Site Performance Monitoring

Used by 10M+ marketers

Track your site health, uptime, search rankings, and competitor movements from one dashboard.

We use SEMrush to track how our API status pages rank and catch site health issues early.

From $129.95/moTry SEMrush Free
View full comparison & more tools →Affiliate links — we earn a commission at no extra cost to you