{% extends "settings/_base.html" %} {% block settings_head_extra %} {% endblock %} {% block section_header %}

API keys

Tokens that agents use in Authorization: Bearer … when posting drops. Create one per agent so you can revoke them individually.

{% endblock %} {% block settings_content %} {# ------------------------------------------------------------------ One-time reveal card. Only rendered on the render that follows a successful POST; after the user navigates away or reloads, the plaintext is gone forever. The DB stores only sha256(token), so there's nowhere else to pull it from. ------------------------------------------------------------------- #} {% if new_token_plaintext %}

New key: {{ new_token_label }}

Save this now. You won't see it again.

{{ new_token_plaintext }}

Use it in your agent: Authorization: Bearer {{ new_token_plaintext }}

{# Copy-to-clipboard shim — same navigator.clipboard.writeText pattern the drop page uses for its "Copy link" action. Inline so the reveal works without extra route/asset wiring. #} {% endif %} {# ------------------------------------------------------------------ New-key form. Single + button — no separate form page at MVP. A POST renders this same list page with ``new_token_plaintext`` populated, so the user sees the reveal card above alongside the refreshed list. ------------------------------------------------------------------- #}
{% if error %}

{{ error }}

{% endif %}
{# ------------------------------------------------------------------ Existing keys list. ------------------------------------------------------------------- #}
{% if keys %} {% for key in keys %} {% endfor %}
Label Created Last used Status Actions
{{ key.label }} {{ key.created_at.strftime("%Y-%m-%d") }} {% if key.last_used_at %} {{ key.last_used_at.strftime("%Y-%m-%d %H:%M") }} {% else %} never {% endif %} {% if key.revoked_at %} revoked {% else %} active {% endif %} {% if not key.revoked_at %}
{% endif %}
{% else %}

No API keys yet.

Mint one above to give an agent posting access.

{% endif %} {# Revoked toggle — only rendered when there's something to toggle to. #} {% if revoked_count > 0 %}
{% if include_revoked %} Hide revoked {% else %} Show revoked ({{ revoked_count }}) {% endif %}
{% endif %}
{% endblock %}