expired_time. This page is the focused guide to that one control. For
the spend-cap side of the same screen, see
Quota cap & expiry.
1. Why set an expiring api key
The point of a time-bound key is to make the safe outcome the default one. A few cases where it pays off:Ephemeral agents
A scheduled job or short-lived agent gets a key that dies with the
deployment lifecycle. A forgotten cron task can’t keep spending months
later.
Demos & trials
Hand a prospect a key that works for the length of the evaluation and
then goes dark on its own — no follow-up revoke needed.
Contractors & vendors
Scope a credential to the engagement window. When the contract ends,
so does the key.
Incident-scoped access
Grant a narrow, short-lived key during an incident so elevated access
can’t outlive the incident itself.
2. The expired_time field
A key’s expiry lives in a single field on the
token object:
| Field | Type | Meaning |
|---|---|---|
expired_time | Unix timestamp (seconds) | The absolute instant the key stops authorizing. -1 means never expires. |
expired_timeis absolute, not a duration. You set the moment the key dies, not “30 days from now” — the console date picker computes the timestamp for you.- The default for a new key is
-1(never). A key only expires if you give it a real timestamp; leaving the field untouched mints a non-expiring key.
3. Set an expiry in the console
Setting an expiry is a console action on your session / access token — not something you pass on a relay call. Creating or editing a key requires the Developer role or above.- Open Keys (
/console/token) and create a new key, or edit an existing one. - In the expiry field, pick the date and time the key should stop working. Leave it blank (or set never) to keep the key permanent.
- Save. The change takes effect immediately — no redeploy, no agent-code change.
Only
/v1/* relay calls carry the sk-orca-… key. The expiry you set
here governs that relay key, but you configure it from the console
session, never by sending the relay key to a management route.4. What an expired key does
When a key is presented after itsexpired_time has passed, the gateway
rejects it at the auth layer — the request never reaches a model, so it
costs no quota. The key’s status moves to Expired, one of the
automatic end-states a key can reach:
| Status | Reached how |
|---|---|
Enabled | Active; requests are authorized. |
Disabled | You paused it; reversible. |
Expired | Past its expired_time — reached automatically. |
Exhausted | Over its quota / spend cap — reached automatically. |
Expired is terminal in the sense that the key won’t authorize again on
its own. If you need it back, edit the key to push expired_time into the
future (Developer+) and it returns to Enabled on the next request — the
key, its limits, and its policy attachments are all preserved. To retire a
key for good instead, revoke it.
5. A worked example: a two-week demo key
Suppose you’re giving a prospect a key for a 14-day evaluation. You want it to call one cheap model, spend no more than a fixed budget, and go dark when the trial ends — all without a calendar reminder to revoke it. In the New key dialog, set:model_limits:["openai/gpt-4o-mini"]— the demo can’t reach for a pricier model.credit_limit_usd: a fixed trial budget — a runaway loop can’t overrun it.expired_time: the end of the 14-day window — the key stops authorizing on its own when the trial is over.
Expired in the list. Nothing for you to
clean up; the credential retired itself.
6. Who can do what
Expiry is governed by the same role gate as the rest of a key’s lifecycle, scoped to your active workspace:| Action | Minimum role |
|---|---|
| View a key’s expiry | Viewer |
Set or change expired_time (create / edit a key) | Developer |
| Re-reveal an ordinary key’s plaintext | Developer |
Read a gateway-scoped (is_firewall_gateway) key’s plaintext | Admin |
7. Next steps
Quota cap & expiry
The spend-cap sibling of expiry — bound a key by dollars as well as by
time.
Key rotation
The zero-downtime handoff that keeps a non-expiring key from living
forever.
The token object
Every field a key carries, including
expired_time, and what each one
constrains.Least-agency checklist
Combine expiry with model limits, IP allow-lists, and spend caps for a
minimal-blast-radius key.
expired_time whenever you can name the date — and let the
gateway do the cleanup for you.