Skip to the board
DIDRESET
UTC

"unexpected status 401 Unauthorized: {"detail":"Unauthorized"}, url: https://chatgpt.com/backend-api/codex/responses"

Updated

"unexpected status 401 Unauthorized: {"detail":"Unauthorized"}, url: https://chatgpt.com/backend-api/codex/responses" is not a usage-limit message. HTTP 401 means Codex sent a request without a valid credential: OpenAI's error reference lists 401 as "Invalid Authentication". No 5-hour window, weekly limit, banked reset or account-wide reset changes it; the fix is codex logout and codex login. The last official Codex reset on record was Sep 12, 2026, 08:09 UTC, and it is irrelevant here.

Last reset
12 SEP 08:09Z

@thsottiaux

Status
OVERDUE

The gap since the last reset is past 1.5x the recent median.

Next est.
ANY TIME

Days since
5.6

days

What does "unexpected status 401 Unauthorized: {"detail":"Unauthorized"}, url: https://chatgpt.com/backend-api/codex/responses" mean?

A 401 is an authentication error, not a quota. OpenAI's API error reference lists "401 - Invalid Authentication" with the solution "Ensure the correct API key and requesting organization are being used"; rate limiting is a different code, "429 - Rate limit reached for requests". When Codex prints this line, the request to chatgpt.com/backend-api/codex/responses was rejected before any usage was counted.

It is about your cached login. Codex "caches login details locally in a plaintext file at ~/.codex/auth.json or in your OS-specific credential store" and "refreshes tokens automatically during use before they expire". The reports behind this page show what breaks that: a revoked refresh token (issue #41973: "Your access token could not be refreshed because your refresh token was revoked. Please log out and sign in again."), a stale token missing a scope (issue #33664: "Missing scopes: api.responses.write", fixed by renaming auth.json and signing in again), or a desktop app stuck without a bearer token (issue #30039: "401 Unauthorized: Missing bearer authentication").

Because nothing is being metered, the usage-limit tools do not apply: /status may even show full bars, a banked reset has nothing to refresh, and an account-wide Codex reset does not touch credentials. Treat "You've hit your usage limit" and "401 Unauthorized" as two unrelated messages.

Which window is full?

Which window is full?
WindowResetsWhere to check
None: 401 is authentication, not a usage windowIt does not reset. Waiting for the 5-hour window or weekly limit, redeeming a banked reset, or an account-wide Codex reset will not clear a 401. Only a valid credential does.codex login status ("Logged in using ChatGPT" or the API-key state); the Account line in /status

What to do when you see it

  1. Check what Codex thinks you are signed in as

    Run codex login status; the docs say it shows "the active authentication method" and exits 0 when credentials are present. Note that in issue #41973 it still reported "Logged in using ChatGPT" while every request failed with 401, so a green status does not rule out a revoked token.

  2. Sign out, then sign in again

    Run codex logout ("Remove saved credentials for both API key and ChatGPT authentication") or type /logout in the session, then codex login and complete the browser flow; codex login --device-auth is the alternative when the browser hand-off fails. In the desktop app or IDE, use Log out in the profile menu and sign in again.

  3. If it persists, clear the cached credential file

    Codex stores credentials in ~/.codex/auth.json (or the OS credential store, per cli_auth_credentials_store). In issue #33664 the 401 survived reinstalling the app and only went away after renaming auth.json and signing in fresh. Also confirm no OPENAI_API_KEY variable or ~/.codex/.env is overriding your ChatGPT login, since API-key sign-in is a separate path.

  4. Do not wait for a reset

    Nothing about this error is time-based. If a fresh login still returns 401, file an issue at github.com/openai/codex with the request id and cf-ray printed after the message (label auth), or contact OpenAI Support.

When does it reset?

Your own windows: not involved. A 401 is returned before Codex counts anything against your 5-hour window or weekly limit, so /status can show room while every request fails. Re-authenticating is the only fix; the window tracker and the reset time in a limit notice have no bearing on it.

Account-wide resets: also not involved. An announced Codex reset "is applied directly to the usage limits covered by the announcement"; it does not reissue tokens or scopes. The board row above is shown for context only. If you see both a 401 and "You've hit your usage limit", fix the login first, then read the limit page.

FAQ

Is 401 Unauthorized a rate limit?

No. In OpenAI's error reference 401 is "Invalid Authentication" and rate limiting is 429 ("Rate limit reached for requests"). A 401 means the request carried no valid credential; no usage was consumed and no window is involved.

Will waiting for my window or a Codex reset fix it?

No. Usage windows and account-wide resets change allowances, not credentials. The reports behind this page were resolved by signing out and back in or by replacing the cached auth.json, never by waiting.

codex login status says I am logged in. Why do I still get 401?

A cached credential can be present but no longer accepted. Issue #41973 shows "Logged in using ChatGPT" alongside the 401, with the app also reporting that the refresh token was revoked; issue #33664 had a token missing the api.responses.write scope. Sign out and sign in again, or rename ~/.codex/auth.json and log in fresh.

How is this different from "You've hit your usage limit"?

That message is a usage limit with a reset time and options to add credits, use a reset, upgrade or wait. A 401 has none of those: it is rejected before metering. OpenAI's help center tells limited users to check "any reset time shown"; a 401 shows no reset time because there is nothing to wait for.

Sources

  1. openai/codex issue #26497 (2026-06-05): Codex CLI 0.137.0: "unexpected status 401 Unauthorized: {"detail":"Unauthorized"}, url: https://chatgpt.com/backend-api/codex/responses"verified 2026-09-18
  2. openai/codex issue #41973 (2026-09-01): Codex CLI 0.152.0 and Desktop on macOS: same 401 after a successful ChatGPT login; "Your access token could not be refreshed because your refresh token was revoked. Please log out and sign in again."verified 2026-09-18
  3. openai/codex issue #30039 (2026-06-25): Codex Desktop 26.616.81150: "401 Unauthorized: Missing bearer authentication", then 429 after retries, no sign-in promptverified 2026-09-18
  4. openai/codex issue #33664 (2026-07-16): Codex Desktop on Windows: "401 Unauthorized / Missing scopes: api.responses.write"; fixed by renaming ~/.codex/auth.json and signing in againverified 2026-09-18
  5. ChatGPT Learn: Authentication (codex login, codex login status, codex logout, login caching)verified 2026-09-18
  6. OpenAI Developers: API error codes (401 Invalid Authentication, 429 Rate limit reached)verified 2026-09-18
  7. ChatGPT Learn: Codex CLI slash commands (/status, /usage, /logout)verified 2026-09-18
  8. OpenAI Help Center: Using Codex with your ChatGPT plan (article 11369540)verified 2026-09-18

Want the next Codex reset on your phone?

Sponsors