{% extends "profile_base.html" %} {% set profile_security_active = "tokens" %} {% block profile_content %}
{% set breadcrumbs = [ {"name": current_user.name | display_name(current_user.username), "href": "/profile"}, {"name": "API tokens"} ] %} {% include "partials/breadcrumbs.html" %}
{% include "partials/flash.html" %} {% if created_token %} {% endif %}
API tokens
Create token

API tokens let you authenticate API requests and Git smart-HTTP operations from scripts and tools. You can have up to 5 active tokens at a time. Learn more in the docs.

{% with search_reset_url="/profile/tokens", search_actions_col_class="col-12" %} {% include "partials/search_actions.html" %} {% endwith %}
{% if page.results | length == 0 %}

No API tokens yet.

{% else %}
{% set order_value = query.order | default('-created_at', true) %} {% if order_value == "created_at" %} {% set next_created_order = "-created_at" %} {% else %} {% set next_created_order = "created_at" %} {% endif %} {% if order_value == "expires_at" %} {% set next_expires_order = "-expires_at" %} {% else %} {% set next_expires_order = "expires_at" %} {% endif %} {% for token in page.results %} {% endfor %}
Name Token Created {% if order_value == "created_at" %} ↑ {% elif order_value == "-created_at" %} ↓ {% endif %} Expires {% if order_value == "expires_at" %} ↑ {% elif order_value == "-expires_at" %} ↓ {% endif %} Status
{{ token.name }} {% if token.token_display | length > 12 %} {{ token.token_display[:12] }} {% else %} {{ token.token_display }} {% endif %} {{ token.created_at | humantime }} {{ token.expires_at | humantime }} {% if token.is_active and not token.is_expired %} Active {% elif token.is_revoked %} Revoked {% elif token.is_expired %} Expired {% else %} Inactive {% endif %} {% if token.is_active %}
{% elif token.is_revoked %}
{% endif %}
Token values are only shown once when created and cannot be retrieved later.
{% endif %}
{% with modal_id="confirm-revoke-token", modal_title="Revoke token", modal_body='Revoke ?', modal_confirm_text="Revoke token", modal_desc="Revoking a token immediately prevents it from being used to authenticate API requests. This action cannot be undone." %} {% include "partials/confirm_modal.html" %} {% endwith %} {% with modal_id="confirm-delete-token", modal_title="Delete token", modal_body='Delete ?', modal_confirm_text="Delete token", modal_desc="This token is permanently deleted and cannot be restored." %} {% include "partials/confirm_modal.html" %} {% endwith %} {% endblock %} {% block scripts %} {% endblock %}