claude/for
Search
Subscribe
Claude Code

How do I check when my Claude Code login ends with `claude auth status`?

Claude Code 2.1.318 adds loginExpiresAt to claude auth status, so you can see when your claude.ai sign-in ends before a script fails.

To see when your Claude Code sign-in ends, run claude auth status on Claude Code 2.1.318 or later. Anthropic's changelog dates that version November 4, 2026. It adds a loginExpiresAt field to the command's output for a stored claude.ai sign-in. Scripts get the same date as credential_expires_at in claude -p JSON results.

This site is independent and not affiliated with Anthropic. We read the changelog and Anthropic's documentation on 2026-11-06. We did not run claude auth status for this guide, so nothing below is a hands-on result and we show no sample output.

What 2.1.318 changed

Anthropic's changelog lists the new field in one line:

Added the date a stored claude.ai sign-in ends to claude auth status (loginExpiresAt) and to claude -p JSON results (credential_expires_at)

A second line adds an early warning for unattended runs:

Added a one-line stderr warning to claude -p text output, starting 10 days before a stored claude.ai sign-in ends

So the same date now reaches you two ways: on request through claude auth status, and unprompted in the output of a claude -p job once ten days remain. The changelog does not say what the date looks like, so check the real output before you parse it.

Check your expiry date

now

Update Claude Code

Run claude update, then claude --version. You want 2.1.318 or later.

now

Run claude auth status

Anthropic's CLI reference says it shows authentication status as JSON. Look for loginExpiresAt.

next

Try the text mode

claude auth status --text gives human-readable output. The changelog names the date only for the JSON field, so check whether text mode shows it.

next

Read the exit code in scripts

The CLI reference says it exits with code 0 if logged in, 1 if not.

For a script that already calls claude -p, read credential_expires_at in its JSON result instead of running a second command.

Update past 2.1.317 first

One earlier fix matters if you plan to run claude auth status on a schedule. The 2.1.317 entry says:

Fixed claude auth status exiting before a slow token refresh was saved, which could sign you out on the next run

Checking your status could, on a slow refresh, cost you the sign-in you were checking.

The Claude moves worth stealing, by email

Workflows tested on real jobs, sent only when they are worth it. Free.

What to do when the date is close

The authentication documentation already describes what you see in an interactive session. When a login created with /login is within three days of expiring, Claude Code shows this at startup:

Your login expires in 3 days · run /login to renew

Run /login to renew. In a shell, claude auth login signs you in too, per the CLI reference. The documentation adds: "Renewing early matters most for sessions that run unattended." It names a background session in agent view and a Remote Control session as examples.

For a job on a server or in CI, the documentation points to claude setup-token, which it says generates "a one-year OAuth token". You set that token as CLAUDE_CODE_OAUTH_TOKEN. Our API key guide shows where that variable ranks against your other credentials.

Check authMethod first. The CLI reference says the JSON's authMethod field is one of none, claude.ai, oauth_token, api_key, api_key_helper or third_party. The new date is tied to a stored claude.ai sign-in, so an API key or a cloud provider is a different case.

A check you can set up this week

You do not need a script to get value from this. On the machine that runs your unattended claude -p jobs, do three things:

  1. Update to 2.1.318 or later and run claude auth status.
  2. Write down the loginExpiresAt value you see, and put a reminder in your calendar ten days earlier.
  3. When the reminder fires, run /login or claude auth login before the job fails.

Ten days is the same lead time as the stderr warning in claude -p text output, so your reminder and that warning point at the same window. Scheduled work in Anthropic's cloud is a different setup, covered in our routines guide.

Where this does not help

  • We did not run it. We have no output to show, and we do not know the date format or whether text mode prints it.
  • Only a stored claude.ai sign-in. The changelog line names that case. It does not say what the field holds for an API key, a gateway or a cloud provider.
  • Expiry is not always a hard stop. The documentation says a request fails once the login "expires and can't be refreshed". The changelog does not say whether loginExpiresAt is the date refreshing stops working.
  • Managed machines add rules. Organizations can restrict which logins are allowed. See our managed settings guide.

Version 2.1.318 also changed the failure message. Per the changelog, a sign-in that reaches its time limit now says so, and claude -p names claude auth login and claude setup-token. That makes the failure easier to read, but it still arrives after the job has already stopped.

Which Claude Code version adds loginExpiresAt?

Version 2.1.318, dated November 4, 2026 in Anthropic's changelog. It adds loginExpiresAt to claude auth status and credential_expires_at to claude -p JSON results. Run claude update, then claude --version to confirm you have 2.1.318 or later.

Does claude auth status show an expiry date for an API key?

The changelog adds the date for a stored claude.ai sign-in only. It does not say what happens for an API key, so we cannot promise a value. Read the authMethod field first: the CLI reference lists api_key as one of its values.

How do I renew an expiring Claude Code login?

Type /login inside Claude Code, or run claude auth login in your shell. For CI and scripts, Anthropic's documentation says claude setup-token generates a one-year OAuth token that you set as CLAUDE_CODE_OAUTH_TOKEN.

Sources (checked 2026-11-06)

  • Claude Code changelog: the 2.1.317 entry (November 3, 2026) and the 2.1.318 entry (November 4, 2026).
  • Authentication: the three-day warning, /login, claude setup-token and CLAUDE_CODE_OAUTH_TOKEN.
  • CLI reference: claude auth login, claude auth status, --text, the exit codes and the authMethod values.

The Claude moves worth stealing, by email

Workflows tested on real jobs, sent only when they are worth it. Free.