{% extends "admin/base.html" %} {% block title %}{{ "Edit" if api_key else "New" }} API Key - Admin - {{ site_name() }}{% endblock %} {% block admin_content %}

{{ "Edit" if api_key else "New" }} API Key

{{ "Update key settings" if api_key else "Generate a new API key for programmatic access" }}

{% if new_api_key %}

API Key — save this now, it won't be shown again

{{ new_api_key[:12] }}••••••••••••

Refresh Token — save this too for key rotation

{{ new_refresh_token[:12] }}••••••••••••
{% endif %} {% if api_key %}

Key Prefix: {{ api_key.key_prefix }}...

User: {{ api_key.user.name or api_key.user.email }}

Created: {{ api_key.created_at.strftime("%Y-%m-%d %H:%M UTC") }}

{% if api_key.last_used_at %}

Last Used: {{ api_key.last_used_at.strftime("%Y-%m-%d %H:%M UTC") }}{% if api_key.last_used_ip %} from {{ api_key.last_used_ip }}{% endif %}

{% endif %}
{{ csrf_field() }}
{% if not new_api_key %} {% endif %} {% endif %}
{{ csrf_field() }} {% if not api_key %} {% endif %}
Scoped Permissions — leave all unchecked to inherit user's full permissions {% for perm in available_permissions %} {% endfor %}
Scoped Roles — leave all unchecked to inherit user's full roles {% for role_name, role_def in available_roles.items() %} {% endfor %}
{% if api_key %} {% endif %}
Cancel
{% if api_key %}
Danger Zone
{% if api_key.is_active %}
{{ csrf_field() }}
{% endif %}
{{ csrf_field() }}
{% endif %} {% endblock %}