API Keys¶
The API keys resource manages authentication tokens for programmatic access.
Methods¶
| Method | Description |
|---|---|
create(name, scopes, expires_at) |
Create a new API key |
list(limit, offset) |
List all API keys |
get(jti) |
Get API key details by JTI |
revoke(jti) |
Revoke an API key |
Creating an API key¶
Save the token!
The token is generated only once and you cannot recover it. Keep it safe.
Using an API key¶
API keys are regular JWT token. They are save to ineepy.toml (unless save_token=False) or you can pass them to the constructor.
token = client.api_keys.create(
name='My API Key',
scopes=['viewer', 'editor'],
save_token=False,
)
with Ineepy(token=token) as api_key_client:
Listing API keys¶
You can list your API keys.
Revoking an API key¶
Once revoked, the API key can no longer be used for authentication.
Warning
Create a unique API key for each application and revoke unused keys to minimize your attack
surface.
Set expires_at to automatically revoke the key on a specific date.