One idea explains all of Terania authentication: a key belongs to a person in your organisation, and it can never do more than that person can. Scopes narrow. Roles narrow. Leaving narrows to nothing. Learn this and every key decision that follows is easy.
Making a key takes three fields, all required. A name of one to eighty characters, named for the system that will hold it rather than for yourself. Scopes, picked as the fewest you need, with customer read ticked by default. An expiry of one to three hundred and sixty six days, defaulting to ninety. There is no key that never expires and no IP restriction option: asking for IP restrictions is refused plainly as not available yet. A key holds at most sixty four scope entries with duplicates removed, which is far more than a well-designed integration needs.
The key is shown once and never recoverable. The screen says to copy it now because it will not be shown again and nobody can recover it for you. Terania stores only a digest, never the key. Put it in a secret store or an environment variable on the server that will call the API. Never put it in a web page, a mobile app, a repository or a support message. The key starts with a short prefix, then your organisation's ID, a full stop and a secret. Anyone who sees the prefix and the organisation ID sees routing, not access. The secret after the full stop is the part that must never travel.
One header carries the key on every call: the Authorization header with a Bearer token. A key in the query string is refused with 401 before anything else happens. Make this a rule in your HTTP client setup rather than a decision per request. Headers carry secrets. Addresses do not.
A scope is a filter, not a grant. At creation, every scope you tick must sit inside what your role holds right now. At every request, the scopes are checked again against the maker's current permissions. Demote the person and every key they made narrows on the next request. If the maker is suspended the key answers 401 and shows Paused. When the maker has left it shows Stopped. Removing a member revokes their keys. There is no separate read-only flag: a key whose scopes all end in read can only read. Write scopes are a closed list of sixteen. Two scopes spend your AI allowance, mission assignment and automation running, so give them only to keys that need them.
Rotate means replace. Rotating makes a new key with the same name, scopes and lifetime, and revokes the old key with the reason rotated, in the same step. There is never a second live key, so the old one stops working at once. Plan rotations for a moment when you can update the holding system straight away. Copy the new key, since it is shown once like any key, update the system, and expect calls on the old key to answer 401 from that moment.
Cutting a key off is instant. Revoking asks for a short lowercase hyphenated reason such as no-longer-needed, takes effect at once and stops every system using that key. The list shows name, access, expiry, last used and state: Revoked, Expired, Paused or Stopped. Last used updates at most once a minute, so do not stare at it during testing.
Three checks prove a key works. A call answers 200 and carries the API version. A call outside the key's scopes answers 403. After a revoke or rotate, the old key answers 401. And when a working key stops, check the state first: it expired, was revoked or rotated, or its maker was suspended or removed. A 403 after a role change means the maker lost a permission, and an owner makes a new key from a role that holds it.
Keys belong to people. Treat them like the people's authority they carry.



